v-fastmenu.vue 4.4 KB

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