v-fastmenu.vue 5.0 KB

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