v-fastmenu.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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. <a href="#" style="border-top: 1px solid #334780;"><i class="el-icon-s-home"></i>返回首页</a>
  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. 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. getUser(){
  71. getUserProfile().then(response => {
  72. this.nickName=response.data.nickName
  73. this.deptNames=response.data.deptNames
  74. this.phonenumber=response.data.phonenumber
  75. });
  76. },
  77. resetPwd(){
  78. getUserProfile().then(response => {
  79. this.user = response.data;
  80. this.roleGroup = response.roleGroup;
  81. this.postGroup = response.postGroup;
  82. this.isResetPwd=true
  83. });
  84. },
  85. backToMainPage() {
  86. let href = window.location.href
  87. let protacal = href.substr(0, href.indexOf("://") + 3)
  88. let mo = href.lastIndexOf(":") > 6 ? href.lastIndexOf(":") : href.lastIndexOf("/")
  89. let ip = href.substr(href.indexOf("://") + 3, mo);
  90. let url = href.substr(0, mo)
  91. let toUrl = url + ":15001/index58"
  92. window.location.href = toUrl
  93. },
  94. async logout() {
  95. this.$confirm('确定注销并退出系统吗?', '提示', {
  96. confirmButtonText: '确定',
  97. cancelButtonText: '取消',
  98. type: 'warning'
  99. }).then(() => {
  100. this.$store.dispatch('LogOut').then(() => {
  101. location.href = '/index';
  102. })
  103. }).catch(() => {});
  104. }
  105. },
  106. computed: {},
  107. }
  108. </script>
  109. <style rel="stylesheet/scss" lang="scss">
  110. @import '@/assets/styles/base.scss';
  111. .user-tip {
  112. width: 100%;
  113. display: flex;
  114. font-size: .8rem;
  115. flex-direction: column;
  116. .u-tip-1 {
  117. display: flex;
  118. margin-bottom: 1rem;
  119. img {
  120. margin-right: 1rem;
  121. border-radius: .3rem;
  122. }
  123. .user-info {
  124. display: flex;
  125. flex-direction: column;
  126. justify-content: space-between;
  127. .user-name {
  128. display: flex;
  129. align-items: flex-end;
  130. h2 {
  131. color: $inBlue;
  132. margin-right: .5rem;
  133. font-weight: bolder;
  134. }
  135. span {
  136. color: $grayBlue;
  137. }
  138. }
  139. .phone-number {
  140. color: $inBlue;
  141. }
  142. }
  143. }
  144. a {
  145. color: $inBlue;
  146. display: flex;
  147. border-bottom: 1px solid #334780;
  148. justify-content: center;
  149. align-items: center;
  150. height: 2rem;
  151. i{
  152. margin-right:.3rem ;
  153. }
  154. }
  155. a:hover{
  156. color: $inBlueHover;
  157. box-shadow:$shadowTip
  158. }
  159. }
  160. .fast-menu {
  161. right: 0.5rem;
  162. position: absolute;
  163. display: flex;
  164. .menu-list {
  165. margin-left: 20px;
  166. display: flex;
  167. align-items: center;
  168. }
  169. .el-badge__content.is-fixed {
  170. right: 3px;
  171. }
  172. .el-badge__content {
  173. border: 0;
  174. }
  175. }
  176. .el-popover{
  177. background:$searchBG;
  178. border:1px $barBorder;
  179. box-shadow:$shadowListHover;
  180. border-radius: 1rem;
  181. }
  182. </style>