Home.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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 {
  78. dlMunList,
  79. munList
  80. } from '@/assets/js/admun.js'
  81. export default {
  82. name: 'Home',
  83. data() {
  84. return {
  85. menulist: dlMunList,
  86. menulogonj: {
  87. 1: 'el-icon-s-order',
  88. 4: 'el-icon-s-custom',
  89. 103: 'el-icon-s-cooperation',
  90. 101: 'el-icon-s-goods',
  91. 102: 'el-icon-s-order',
  92. 145: 'el-icon-s-marketing',
  93. },
  94. isopen: true,
  95. openOrClose: ['el-icon-arrow-right', 'el-icon-arrow-left'],
  96. }
  97. },
  98. computed: {
  99. ...mapState(['userInfo','baseInfo']),
  100. currenIndex() {
  101. return this.$route.path
  102. },
  103. },
  104. methods: {
  105. kf() {
  106. if(this.baseInfo.service_kf) {
  107. window.open(this.baseInfo.service_kf)
  108. }
  109. },
  110. logout() {
  111. window.sessionStorage.clear()
  112. this.$router.push('/login')
  113. },
  114. async getMenList() {
  115. const {
  116. data: res
  117. } = await this.$http.get('menus')
  118. if (res.meta.status !== 200) return this.$message.error(res.meta.msg)
  119. this.menulist = res.data
  120. },
  121. closeBtn() {
  122. this.isopen = !this.isopen
  123. },
  124. },
  125. created() {
  126. if(!this.userInfo.agent_id) {
  127. this.menulist = munList
  128. }
  129. },
  130. }
  131. </script>
  132. <style scoped lang="scss">
  133. .home {
  134. height: 100%;
  135. background-color: #eaedf2;
  136. }
  137. .home-wrapper {
  138. height: 100%;
  139. }
  140. .home-header {
  141. background-color: #fff;
  142. display: flex;
  143. justify-content: space-between;
  144. margin-bottom: 20px;
  145. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.01);
  146. }
  147. .home-loge {
  148. height: 100%;
  149. display: flex;
  150. align-items: center;
  151. }
  152. .home-loge img {
  153. height: 100%;
  154. }
  155. .home-loge span {
  156. margin-left: 15px;
  157. color: rgb(234, 237, 242);
  158. font-size: 18px;
  159. }
  160. .out-wrapper {
  161. display: flex;
  162. align-items: center;
  163. padding-right: 50px;
  164. .u-name {
  165. text-decoration: underline;
  166. padding: 0 20px;
  167. height: 100%;
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. position: relative;
  172. &:hover {
  173. .u-ban {
  174. display: block;
  175. }
  176. }
  177. .u-ban {
  178. position: absolute;
  179. width: 200px;
  180. height: 300px;
  181. display: none;
  182. bottom: -300px;
  183. left:-50px;
  184. margin: auto;
  185. z-index: 99;
  186. .u-wrap {
  187. display: flex;
  188. flex-direction: column;
  189. align-items: center;
  190. background-color: #fff;
  191. box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
  192. padding: 10px;
  193. .info {
  194. color: #333;
  195. font-size: 14px;
  196. padding: 10px 0;
  197. }
  198. }
  199. }
  200. }
  201. }
  202. .home-nav {
  203. /* background-color: rgb(50, 55, 68); */
  204. /* padding: 0 200px; */
  205. }
  206. .close-btn {
  207. color: aliceblue;
  208. display: flex;
  209. justify-content: space-between;
  210. padding: 0 10px;
  211. background-color: rgb(72, 81, 101);
  212. font-size: 25px;
  213. }
  214. .el-menu-wrap {
  215. width: 250px;
  216. display: inline-block;
  217. position: relative;
  218. }
  219. .home-main {
  220. /* width: 900px; */
  221. /* background-color: rgb(234, 237, 242); */
  222. width: 1130px;
  223. min-height: 800px;
  224. margin-left: 20px;
  225. }
  226. /deep/ .el-card__body {
  227. min-height: 700px;
  228. margin-top: 0;
  229. }
  230. /deep/ .el-card {
  231. margin-top: 0;
  232. }
  233. .boddy-wrap {
  234. min-width: 1200px;
  235. height: 100%;
  236. display: flex;
  237. justify-content: center;
  238. }
  239. .user-ifno {
  240. flex-direction: column;
  241. .name {
  242. color: black;
  243. font-weight: bold;
  244. }
  245. .user-id {
  246. color: black;
  247. font-size: 14px;
  248. padding-top: 10px;
  249. /* font-weight: bold; */
  250. }
  251. }
  252. </style>