index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="head-box">
  3. <div class="flex head-box-content">
  4. <div class="head-box-title">
  5. <span class="avt"></span>
  6. <span class="title">佛山交科4A统一身份安全管理平台</span>
  7. </div>
  8. <div class="head-box-menu flex-wrap">
  9. <div class="user">
  10. <img class="head-icon-img" src="../../assets/status/ic_user.png" alt="">
  11. <span class="name">{{ name }}</span>
  12. </div>
  13. <!-- <div class="seting">
  14. <span @click="toSystem" class="img-icon"></span>
  15. </div> -->
  16. <div class="lock">
  17. <span @click="dialogPwd" class="img-icon"></span>
  18. </div>
  19. <div class="exit">
  20. <span @click="exitDialog" class="img-icon"></span>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { loginUp } from '@/api/login'
  28. import { mapGetters } from 'vuex'
  29. export default {
  30. name: 'Hamburger',
  31. computed: {
  32. ...mapGetters(['firstLogin']),
  33. name () {
  34. return this.$store.state.user.name
  35. }
  36. },
  37. watch: {
  38. '$store.state.app.outcheck': {
  39. handler (val) {
  40. if (val) {
  41. this.logout()
  42. }
  43. },
  44. deep: true
  45. }
  46. },
  47. mounted () {
  48. // 首次登录
  49. if (this.firstLogin) {
  50. this.$message.warning('初次登录本系统,请修改密码')
  51. this.dialogPwd()
  52. }
  53. },
  54. methods: {
  55. //退出系统-弹框
  56. exitDialog () {
  57. this.$store.dispatch('app/toggleOutflag', true)
  58. },
  59. // 退出系统
  60. async logout () {
  61. let params = {
  62. UserId: this.$store.state.user.UserId,
  63. UserType: this.$store.state.user.UserType
  64. }
  65. // let loginUper = await loginUp(params)
  66. // if (loginUper) {}
  67. // await this.$store.dispatch('user/logout')
  68. // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
  69. // if (loginUper.code == 0) {
  70. await this.$store.dispatch('user/logout')
  71. this.$router.push(`/login?redirect=${this.$route.fullPath}`)
  72. // }
  73. },
  74. //修改密码
  75. dialogPwd () {
  76. this.$store.dispatch('app/togglePwdflag', true)
  77. },
  78. //跳转
  79. toSystem () {
  80. this.$router.push(`/systemManagement`)
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss" scoped>
  86. .head-box {
  87. .head-box-title {
  88. font-size: 20px;
  89. font-family: Microsoft YaHei;
  90. font-weight: bold;
  91. color: #303133;
  92. .avt {
  93. display: inline-block;
  94. width: 32px;
  95. height: 32px;
  96. background: #303133;
  97. border-radius: 50%;
  98. vertical-align: middle;
  99. margin-right: 16px;
  100. position: relative;
  101. top: -3px;
  102. img {
  103. max-width: 100%;
  104. }
  105. }
  106. }
  107. .head-box-menu {
  108. > div {
  109. margin-right: 20px;
  110. &:last-child {
  111. margin-right: 0;
  112. }
  113. }
  114. .head-icon-img {
  115. position: relative;
  116. top: 6px;
  117. }
  118. .img-icon {
  119. display: inline-block;
  120. width: 24px;
  121. height: 24px;
  122. vertical-align: middle;
  123. background-repeat: no-repeat;
  124. background-size: cover;
  125. cursor: pointer;
  126. transition: all 0.3s;
  127. }
  128. .user {
  129. font-size: 16px;
  130. font-family: Microsoft YaHei;
  131. font-weight: bold;
  132. color: #303133;
  133. .name {
  134. margin-left: 10px;
  135. }
  136. }
  137. .seting {
  138. .img-icon {
  139. background-image: url("../../assets/status/ic_setting.png");
  140. &:hover {
  141. background-image: url("../../assets/status/ic_setting_hovar.png");
  142. }
  143. }
  144. }
  145. .lock {
  146. .img-icon {
  147. background-image: url("../../assets/status/ic_password.png");
  148. &:hover {
  149. background-image: url("../../assets/status/ic_password_hovar.png");
  150. }
  151. }
  152. }
  153. .exit {
  154. .img-icon {
  155. background-image: url("../../assets/status/ic_exit.png");
  156. &:hover {
  157. background-image: url("../../assets/status/ic_exit_hovar.png");
  158. }
  159. }
  160. }
  161. }
  162. }
  163. </style>