LeftWrap.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <script setup>
  2. import { useRouter } from 'vue-router'
  3. import { useLayoutState } from '../hooks/index'
  4. // import {apiSystemRole} from '@/api/system'
  5. const router = useRouter()
  6. const { menuClose } = useLayoutState()
  7. const navList = ref([
  8. {
  9. name: '客户管理',
  10. path: '/customer',
  11. IsLevel: 2,
  12. Children: [
  13. {
  14. name: '商家管理',
  15. path: '/business'
  16. },
  17. {
  18. name: '用户管理',
  19. path: '/customer/userList'
  20. }
  21. ]
  22. },
  23. {
  24. name: 'ETA客户行为统计',
  25. path: '/',
  26. IsLevel: 1,
  27. Children: [
  28. {
  29. name: 'ETA客户行为统计',
  30. path: '/',
  31. }
  32. ]
  33. },
  34. {
  35. name: 'ETA试用管理',
  36. path: '/',
  37. IsLevel: 1,
  38. Children: [
  39. {
  40. name: 'ETA试用管理',
  41. path: '/',
  42. }
  43. ]
  44. },
  45. {
  46. name: 'ETA社区管理',
  47. path: '/etaChart',
  48. IsLevel: 1,
  49. Children: [
  50. {
  51. name: 'ETA社区管理',
  52. path: '/etaChart/index',
  53. }
  54. ]
  55. },
  56. {
  57. name: 'ETA菜单配置',
  58. path: '/',
  59. IsLevel: 1,
  60. Children: [
  61. {
  62. name: 'ETA菜单配置',
  63. path: '/',
  64. }
  65. ]
  66. },
  67. {
  68. name: '培训管理',
  69. path: '/',
  70. IsLevel: 2,
  71. Children: [
  72. {
  73. name: '视频管理',
  74. path: '/',
  75. },
  76. {
  77. name: '标签管理',
  78. path: '/',
  79. },
  80. {
  81. name: '分类管理',
  82. path: '/',
  83. }
  84. ]
  85. },
  86. {
  87. name: '个性化设置',
  88. path: '/',
  89. IsLevel: 1,
  90. Children: [
  91. {
  92. name: '个性化设置',
  93. path: '/',
  94. }
  95. ]
  96. },
  97. {
  98. name: '权限配置',
  99. path: '/',
  100. IsLevel: 1,
  101. Children: [
  102. {
  103. name: '权限配置',
  104. path: '/',
  105. }
  106. ]
  107. },
  108. {
  109. name: '系统设置',
  110. path: '/',
  111. IsLevel: 2,
  112. Children: [
  113. {
  114. name: '更新日志配置',
  115. path: '/',
  116. },
  117. {
  118. name: '帮助中心配置',
  119. path: '/',
  120. }
  121. ]
  122. },
  123. ])
  124. function getNavList() {
  125. //mock navList
  126. /* navList.value = [
  127. {
  128. Path:'/customer',
  129. Name:'客户管理',
  130. Children:[
  131. {
  132. Path:'/customer/tempUserList',
  133. Name:'临时用户列表',
  134. }
  135. ]
  136. },
  137. {
  138. Path:'/authorMgt/authorList',
  139. Name:'研究员管理',
  140. Children:[]
  141. },
  142. {
  143. Path:'/mediaMgt',
  144. Name:'音视频管理',
  145. Children:[
  146. {
  147. Path:'/mediaMgt/audioList',
  148. Name:'音频管理',
  149. },
  150. {
  151. Path:'/mediaMgt/videoList',
  152. Name:'视频管理',
  153. }
  154. ]
  155. },
  156. {
  157. Path:'/customer/notification',
  158. Name:'消息推送管理',
  159. Children:[]
  160. },
  161. {
  162. Path:'/mediaMgt/pictureLib',
  163. Name:'图片资源库',
  164. Children:[]
  165. },
  166. {
  167. Path:'/customer/feedbackList',
  168. Name:'客户反馈',
  169. Children:[]
  170. },
  171. {
  172. Path:'/system',
  173. Name:'系统设置',
  174. Children:[
  175. {
  176. Path:'/system/userList',
  177. Name:'用户列表',
  178. },
  179. {
  180. Path:'/system/roleList',
  181. Name:'角色管理',
  182. },
  183. {
  184. Path:'/system/authSet',
  185. Name:'权限管理',
  186. }
  187. ]
  188. },
  189. ] */
  190. // apiSystemRole.menuData().then(res=>{
  191. // if(res.Ret===200){
  192. // navList.value=res.Data||[]
  193. // }
  194. // })
  195. }
  196. getNavList()
  197. function getMenuIcon(item) {
  198. const iconMap = {
  199. '/customer': 'menu/customer',
  200. }
  201. return iconMap[item] || 'menu/setting'
  202. }
  203. </script>
  204. <template>
  205. <div :class="['left-wrap', menuClose ? 'left-wrap__close' : '']">
  206. <t-menu
  207. class="menu-wrap"
  208. :value="$route.path"
  209. :collapsed="menuClose"
  210. :width="['200px', '80px']"
  211. >
  212. <template v-for="level1 in navList" :key="level1.SysMenuId">
  213. <t-menu-item :value="level1.path" v-if="level1.IsLevel === 1">
  214. <svg-icon
  215. :name="getMenuIcon(level1.path)"
  216. :color="$route.path === level1.path ? '#086CE0' : '#333'"
  217. style="font-size: 16px"
  218. ></svg-icon>
  219. <span style="margin-left: 5px">{{ level1.name }}</span>
  220. </t-menu-item>
  221. <t-submenu :value="level1.path" v-if="level1.IsLevel === 2">
  222. <template #title>
  223. <svg-icon
  224. :name="getMenuIcon(level1.path)"
  225. :color="$route.path === level1.path ? '#086CE0' : '#333'"
  226. style="font-size: 16px"
  227. ></svg-icon>
  228. <span style="margin-left: 5px">{{ level1.name }}</span>
  229. </template>
  230. <t-menu-item
  231. v-for="child in level1.Children"
  232. :value="child.path"
  233. :key="child.path"
  234. >
  235. <span style="margin-left: 5px">{{ child.name }}</span>
  236. </t-menu-item>
  237. </t-submenu>
  238. </template>
  239. </t-menu>
  240. </div>
  241. </template>
  242. <style lang="scss" scoped>
  243. .left-wrap {
  244. width: 200px;
  245. z-index: 50;
  246. position: fixed;
  247. top: 67px;
  248. left: 0;
  249. bottom: 0;
  250. padding: 8px 0;
  251. background-color: #fff;
  252. display: flex;
  253. flex-direction: column;
  254. padding-bottom: 111px;
  255. transition: all 0.5s;
  256. .menu-wrap {
  257. flex: 1;
  258. height: 100%;
  259. border: none;
  260. .t-submenu {
  261. :deep(.t-menu-item) {
  262. padding-left: var(--t-menu-base-level-padding);
  263. }
  264. :deep(.t-submenu__icon-arrow) {
  265. transform: rotateZ(-90deg) !important;
  266. }
  267. &.is-opened {
  268. :deep(.t-submenu__icon-arrow) {
  269. transform: rotateZ(0deg) !important;
  270. border-radius: 4px;
  271. }
  272. }
  273. }
  274. :deep(.t-menu-item.is-active) {
  275. background-color: #f3f9ff;
  276. }
  277. }
  278. .user-box {
  279. background-color: var(--t-menu-hover-bg-color);
  280. color: #333;
  281. text-align: center;
  282. padding: 20px;
  283. .name-box {
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. gap: 0 5px;
  288. }
  289. .opt {
  290. margin: 10px 0;
  291. cursor: pointer;
  292. }
  293. }
  294. }
  295. .left-wrap__close {
  296. width: 80px;
  297. }
  298. </style>