index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="Top-wrapper">
  3. <div class="top-title">配网安全精益管理辅助应用</div>
  4. <div class="profile">
  5. <div class="right-menu">
  6. <template v-if="device !== 'mobile'">
  7. <el-tooltip
  8. class="back"
  9. effect="dark"
  10. content="首页"
  11. placement="bottom"
  12. >
  13. <i
  14. @click="() => $router.push('/index')"
  15. class="el-icon-full-screen back-icon"
  16. ></i>
  17. </el-tooltip>
  18. <search id="header-search" class="right-menu-item" />
  19. <screenfull id="screenfull" class="right-menu-item hover-effect" />
  20. <el-tooltip content="布局大小" effect="dark" placement="bottom">
  21. <size-select
  22. id="size-select"
  23. class="right-menu-item hover-effect"
  24. />
  25. </el-tooltip>
  26. <span @click="routePush">
  27. <el-badge :value="value == 0 ? '' : value" class="hasWaitTask">
  28. <el-icon class="el-icon-message-solid"></el-icon>
  29. <div @click="routePush"></div>
  30. </el-badge>
  31. </span>
  32. </template>
  33. <el-dropdown
  34. class="avatar-container right-menu-item hover-effect"
  35. trigger="click"
  36. style="margin-left: 10px"
  37. >
  38. <div class="avatar-wrapper">
  39. <span style="margin-right: 4px">{{ user.name }}</span>
  40. <i style="font-size: 20px" class="el-icon-caret-bottom" />
  41. </div>
  42. <el-dropdown-menu slot="dropdown">
  43. <router-link to="/user/profile">
  44. <el-dropdown-item>个人中心</el-dropdown-item>
  45. </router-link>
  46. <el-dropdown-item @click.native="setting = true">
  47. <span>布局设置</span>
  48. </el-dropdown-item>
  49. <el-dropdown-item divided @click.native="logout">
  50. <span>退出登录</span>
  51. </el-dropdown-item>
  52. </el-dropdown-menu>
  53. </el-dropdown>
  54. <!-- <span style="font-size: 16px;color: #ffffff">{{this.$store.state.user.orgName}}</span>-->
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { mapGetters, mapState } from "vuex";
  61. import Search from "@/components/HeaderSearch";
  62. import Screenfull from "@/components/Screenfull";
  63. import SizeSelect from "@/components/SizeSelect";
  64. export default {
  65. name: "Top",
  66. components: { Search, Screenfull, SizeSelect },
  67. data() {
  68. return {
  69. title: process.env.VUE_APP_TITLE,
  70. value: this.$store.state.user.waitta,
  71. };
  72. },
  73. computed: {
  74. ...mapGetters(["sidebar", "avatar", "device"]),
  75. ...mapState(["user"]),
  76. setting: {
  77. get() {
  78. return this.$store.state.settings.showSettings;
  79. },
  80. set(val) {
  81. this.$store.dispatch("settings/changeSetting", {
  82. key: "showSettings",
  83. value: val,
  84. });
  85. },
  86. },
  87. },
  88. watch: {
  89. "this.$store.state.user.waitta"(newvalue, oldvalue) {
  90. this.value = newvalue;
  91. },
  92. },
  93. mounted() {
  94. console.log(this.$store.state.user, "--------------");
  95. },
  96. methods: {
  97. routePush() {
  98. console.log(this.$router);
  99. this.$router.push({
  100. path: "/commission/index",
  101. });
  102. },
  103. async logout() {
  104. this.$confirm("确定注销并退出系统吗?", "提示", {
  105. confirmButtonText: "确定",
  106. cancelButtonText: "取消",
  107. type: "warning",
  108. })
  109. .then(() => {
  110. this.$store.dispatch("LogOut").then(() => {
  111. //启用isc登陆前
  112. // location.href = '/index';
  113. //启用isc登陆后
  114. window.location.replace(
  115. "http://10.223.57.127:17089/isc_sso/logout?service=http://25.212.177.102:19888/pdm?token=isc"
  116. );
  117. });
  118. })
  119. .catch(() => {});
  120. },
  121. },
  122. };
  123. </script>
  124. <style lang="scss" scoped>
  125. @import "@/assets/styles/variables.scss";
  126. .back-icon {
  127. cursor: pointer;
  128. color: #fff;
  129. font-size: 25px;
  130. font-weight: bold;
  131. margin-right: 10px;
  132. }
  133. .Top-wrapper {
  134. width: 100%;
  135. height: 80px;
  136. background-image: url("../../../assets/images/top-bg.png");
  137. padding: 0 60px;
  138. display: flex;
  139. align-items: center;
  140. justify-content: space-between;
  141. .top-title {
  142. font-size: 1.6rem;
  143. color: white;
  144. }
  145. .profile {
  146. .right-menu {
  147. &:focus {
  148. outline: none;
  149. }
  150. .right-menu-item {
  151. display: inline-block;
  152. padding: 0 8px;
  153. height: 100%;
  154. font-size: 18px;
  155. color: #fff;
  156. vertical-align: text-bottom;
  157. &.hover-effect {
  158. cursor: pointer;
  159. transition: background 0.3s;
  160. &:hover {
  161. background: rgba(0, 0, 0, 0.025);
  162. }
  163. }
  164. }
  165. .avatar-container {
  166. margin-right: 25px;
  167. .avatar-wrapper {
  168. margin-top: 5px;
  169. position: relative;
  170. .user-avatar {
  171. cursor: pointer;
  172. width: 40px;
  173. height: 40px;
  174. border-radius: 10px;
  175. }
  176. .el-icon-caret-bottom {
  177. cursor: pointer;
  178. position: absolute;
  179. right: -20px;
  180. top: 0px;
  181. font-size: 12px;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. .hasWaitTask {
  189. // color: #34ada1;
  190. color: #fff;
  191. cursor: pointer;
  192. }
  193. </style>