v-fastmenu.vue 4.5 KB

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