v-fastmenu.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="fast-menu">
  3. <div class="menu-list">
  4. <!-- <a @click="backToMainPage" class="header-right">
  5. <span><i class="el-icon-s-home"></i>返回首页</span>
  6. </a>
  7. <a @click="backToMainPage" class="header-right">
  8. <span><i class="el-icon-monitor"></i>管理端</span>
  9. </a> -->
  10. <el-popover placement="top-start" trigger="hover" width="300px">
  11. <div class="user-tip">
  12. <div class="u-tip-1">
  13. <img src="@/assets/images/user-photo.png" />
  14. <div class="user-info">
  15. <div class="user-name">
  16. <h2>{{ nickName }}</h2><span>{{ deptNames }}</span>
  17. </div>
  18. <div class="phone-number">{{ phonenumber }}</div>
  19. </div>
  20. </div>
  21. <div style="margin-bottom: 1rem;">
  22. <el-button type="primary" size="small" @click="resetPwd">修改密码</el-button>
  23. <el-button type="warning" size="small" @click="logout">退出登录</el-button>
  24. </div>
  25. <el-link type="primary" @click="backToMainPage" style="border-top: 1px solid #334780;" icon="el-icon-s-home">返回首页</el-link>
  26. <!-- <a href="#"><i class="el-icon-monitor"></i>管理系统</a>-->
  27. </div>
  28. <div slot="reference" style="text-align: center; width:4rem;height:3rem;">
  29. <img src="@/assets/images/mascot-small.png" />
  30. </div>
  31. </el-popover>
  32. </div>
  33. <el-dialog title="修改密码" :visible.sync="isResetPwd" v-if="isResetPwd" width="30%" append-to-body>
  34. <resetPwd :user="user" />
  35. </el-dialog>
  36. </div>
  37. </template>
  38. <script>
  39. import resetPwd from "../views/system/user/profile/resetPwd";
  40. import { getUserProfile } from "@/api/system/user";
  41. import { selectConfigKey } from "@/api/system/config";
  42. import Cookies from 'js-cookie';
  43. export default {
  44. components: {resetPwd },
  45. data() {
  46. return {
  47. user: {},
  48. visible: false,
  49. isResetPwd: false,
  50. nickName:null,
  51. deptNames:null,
  52. phonenumber:null,
  53. // fastMenu: [{
  54. // name: '返回首页',
  55. // path: '/',
  56. // icon: 'el-icon-s-home',
  57. // // msValue: 1
  58. // },
  59. // {
  60. // name: '管理端',
  61. // path: '/',
  62. // icon: 'sj-icon-rwzx',
  63. // // msValue: 2
  64. // },
  65. // ],
  66. }
  67. },
  68. created() {
  69. this.getUser()
  70. },
  71. methods: {
  72. backToMainPage(){
  73. selectConfigKey('backToMainPage').then(res => {
  74. window.location.href = res.data;
  75. })
  76. },
  77. getUser(){
  78. getUserProfile().then(response => {
  79. this.nickName=response.data.nickName
  80. this.deptNames=response.data.deptNames
  81. this.phonenumber=response.data.phonenumber
  82. this.userId=response.data.userId
  83. Cookies.set('userId',response.data.userId);
  84. Cookies.set('nickName',response.data.nickName);
  85. });
  86. },
  87. resetPwd(){
  88. getUserProfile().then(response => {
  89. this.user = response.data;
  90. this.roleGroup = response.roleGroup;
  91. this.postGroup = response.postGroup;
  92. this.isResetPwd=true
  93. });
  94. },
  95. async logout() {
  96. this.$confirm('确定注销并退出系统吗?', '提示', {
  97. confirmButtonText: '确定',
  98. cancelButtonText: '取消',
  99. type: 'warning'
  100. }).then(() => {
  101. this.$store.dispatch('LogOut').then(() => {
  102. location.href = '/index';
  103. })
  104. }).catch(() => {});
  105. }
  106. },
  107. computed: {},
  108. }
  109. </script>
  110. <style rel="stylesheet/scss" lang="scss">
  111. @import '@/assets/styles/base.scss';
  112. .user-tip {
  113. width: 100%;
  114. display: flex;
  115. font-size: .8rem;
  116. flex-direction: column;
  117. .u-tip-1 {
  118. display: flex;
  119. margin-bottom: 1rem;
  120. img {
  121. margin-right: 1rem;
  122. border-radius: .3rem;
  123. }
  124. .user-info {
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: space-between;
  128. .user-name {
  129. display: flex;
  130. align-items: flex-end;
  131. h2 {
  132. color: $inBlue;
  133. margin-right: .5rem;
  134. font-weight: bolder;
  135. }
  136. span {
  137. color: $grayBlue;
  138. }
  139. }
  140. .phone-number {
  141. color: $inBlue;
  142. }
  143. }
  144. }
  145. a {
  146. color: $inBlue;
  147. display: flex;
  148. border-bottom: 1px solid #334780;
  149. justify-content: center;
  150. align-items: center;
  151. height: 2rem;
  152. i{
  153. margin-right:.3rem ;
  154. }
  155. }
  156. a:hover{
  157. color: $inBlueHover;
  158. box-shadow:$shadowTip
  159. }
  160. }
  161. .fast-menu {
  162. right: 0.5rem;
  163. position: absolute;
  164. display: flex;
  165. .menu-list {
  166. margin-left: 20px;
  167. display: flex;
  168. align-items: center;
  169. }
  170. .el-badge__content.is-fixed {
  171. right: 3px;
  172. }
  173. .el-badge__content {
  174. border: 0;
  175. }
  176. }
  177. .el-popover{
  178. background:#0c1327;
  179. border:1px solid #334780;
  180. box-shadow:$shadowListHover;
  181. border-radius: 1rem;
  182. }
  183. </style>