Home.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <div class="home">
  3. <el-container class="home-wrapper">
  4. <!-- 头部 -->
  5. <el-header class="home-header">
  6. <div class="home-loge">
  7. <!-- <el-image
  8. style="width: 50px; height: 50px;border-radius: 50%;"
  9. :src="userInfo.avatar"></el-image>
  10. <div class="flex user-ifno">
  11. <span class="name">{{userInfo.username}}</span>
  12. </div> -->
  13. </div>
  14. <div class="out-wrapper">
  15. <!-- <el-button type="info" @click="logout">退出</el-button> -->
  16. <div class="hand u-name" @click="kf">
  17. 客服
  18. </div>
  19. <div class="hand u-name" >
  20. 余额:{{userInfo.money}}
  21. </div>
  22. <div class="hand u-name">
  23. {{userInfo.username}}
  24. <div class="u-ban ">
  25. <div class="u-wrap">
  26. <el-image style="width: 40px; height: 40px;border-radius: 50%;"
  27. :src="userInfo.avatar"></el-image>
  28. <div class="info">
  29. 用户ID: {{userInfo.id}}
  30. </div>
  31. <div class="info">
  32. 用户名: {{userInfo.username}}
  33. </div>
  34. <div class="info">
  35. 昵称: {{userInfo.nickname}}
  36. </div>
  37. <div class="info">
  38. 余额: {{userInfo.money}}
  39. </div>
  40. <el-button @click="logout">退出登录</el-button>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </el-header>
  46. <div class="boddy-wrap">
  47. <div class="el-menu-wrap ">
  48. <el-menu active-text-color="#0f83fe" unique-opened :collapse="!isopen" :collapse-transition="false"
  49. router :default-active="currenIndex">
  50. <el-submenu v-for="item in menulist" :key="item.id" :index="item.id + ''">
  51. <template slot="title">
  52. <i :class="item.icon"></i>
  53. <span>{{ item.authName }}</span>
  54. </template>
  55. <el-menu-item :index="'/' + subItem.path + ''" v-for="subItem in item.children"
  56. :key="subItem.id">
  57. <template slot="title">
  58. <i class="el-icon-menu"></i>
  59. <span>{{ subItem.authName }}</span>
  60. </template>
  61. </el-menu-item>
  62. </el-submenu>
  63. </el-menu>
  64. </div>
  65. <div class="home-main">
  66. <router-view></router-view>
  67. </div>
  68. </div>
  69. </el-container>
  70. </div>
  71. </template>
  72. <script>
  73. import {
  74. mapState,
  75. mapMutations
  76. } from 'vuex';
  77. import { munList } from '@/assets/js/admun.js'
  78. export default {
  79. name: 'Home',
  80. data() {
  81. return {
  82. menulist: munList,
  83. menulogonj: {
  84. 1:'el-icon-s-order',
  85. 4: 'el-icon-s-custom',
  86. 103: 'el-icon-s-cooperation',
  87. 101: 'el-icon-s-goods',
  88. 102: 'el-icon-s-order',
  89. 145: 'el-icon-s-marketing',
  90. },
  91. isopen: true,
  92. openOrClose: ['el-icon-arrow-right', 'el-icon-arrow-left'],
  93. }
  94. },
  95. computed: {
  96. ...mapState(['userInfo','baseInfo']),
  97. currenIndex() {
  98. return this.$route.path
  99. },
  100. },
  101. methods: {
  102. kf() {
  103. if(this.baseInfo.service_kf) {
  104. window.open(this.baseInfo.service_kf)
  105. }
  106. },
  107. logout() {
  108. window.sessionStorage.clear()
  109. this.$router.push('/login')
  110. },
  111. async getMenList() {
  112. const {
  113. data: res
  114. } = await this.$http.get('menus')
  115. if (res.meta.status !== 200) return this.$message.error(res.meta.msg)
  116. this.menulist = res.data
  117. },
  118. closeBtn() {
  119. this.isopen = !this.isopen
  120. },
  121. },
  122. created() {
  123. },
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .home {
  128. height: 100%;
  129. background-color: #eaedf2;
  130. }
  131. .home-wrapper {
  132. height: 100%;
  133. }
  134. .home-header {
  135. background-color: #fff;
  136. display: flex;
  137. justify-content: space-between;
  138. margin-bottom: 20px;
  139. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.01);
  140. }
  141. .home-loge {
  142. height: 100%;
  143. display: flex;
  144. align-items: center;
  145. }
  146. .home-loge img {
  147. height: 100%;
  148. }
  149. .home-loge span {
  150. margin-left: 15px;
  151. color: rgb(234, 237, 242);
  152. font-size: 18px;
  153. }
  154. .out-wrapper {
  155. display: flex;
  156. align-items: center;
  157. padding-right: 50px;
  158. .u-name {
  159. text-decoration: underline;
  160. // width: 100px;
  161. padding: 0 20px;
  162. height: 100%;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. position: relative;
  167. &:hover {
  168. .u-ban {
  169. display: block;
  170. }
  171. }
  172. .u-ban {
  173. position: absolute;
  174. width: 200px;
  175. height: 300px;
  176. display: none;
  177. bottom: -300px;
  178. left:-50px;
  179. margin: auto;
  180. z-index: 99;
  181. .u-wrap {
  182. display: flex;
  183. flex-direction: column;
  184. align-items: center;
  185. background-color: #fff;
  186. box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
  187. padding: 10px;
  188. .info {
  189. color: #333;
  190. font-size: 14px;
  191. padding: 10px 0;
  192. }
  193. }
  194. }
  195. }
  196. }
  197. .home-nav {
  198. /* background-color: rgb(50, 55, 68); */
  199. /* padding: 0 200px; */
  200. }
  201. .close-btn {
  202. color: aliceblue;
  203. display: flex;
  204. justify-content: space-between;
  205. padding: 0 10px;
  206. background-color: rgb(72, 81, 101);
  207. font-size: 25px;
  208. }
  209. .el-menu-wrap {
  210. width: 250px;
  211. display: inline-block;
  212. position: relative;
  213. }
  214. .home-main {
  215. /* width: 900px; */
  216. /* background-color: rgb(234, 237, 242); */
  217. width: 1130px;
  218. min-height: 800px;
  219. margin-left: 20px;
  220. }
  221. /deep/ .el-card__body {
  222. min-height: 700px;
  223. margin-top: 0;
  224. }
  225. /deep/ .el-card {
  226. margin-top: 0;
  227. }
  228. .boddy-wrap {
  229. min-width: 1200px;
  230. height: 100%;
  231. display: flex;
  232. justify-content: center;
  233. }
  234. .user-ifno {
  235. flex-direction: column;
  236. .name {
  237. color: black;
  238. font-weight: bold;
  239. }
  240. .user-id {
  241. color: black;
  242. font-size: 14px;
  243. padding-top: 10px;
  244. /* font-weight: bold; */
  245. }
  246. }
  247. .m-l-20 {
  248. margin-left: 20px;
  249. }
  250. </style>