leftWindow.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <template>
  2. <el-aside width="180px" class="aside" ref="asideChange">
  3. <el-image class="headImg" ref="headImgChange" :src="require('static/img/logo.jpg')" fit="contain"></el-image>
  4. <el-menu :collapse="fold" class="menu sele_none" :default-active="onRoutes" background-color="#fff"
  5. text-color="#000" active-text-color="#3492e9" unique-opened router>
  6. <template v-for="item in items">
  7. <template v-if="item.subs && item.subs.length > 0">
  8. <el-submenu :index="item.url" :key="item.index">
  9. <template slot="title">
  10. <i class="icon margin_r_20" :class="item.icon"></i>
  11. <span slot="title">{{ item.title }}</span>
  12. </template>
  13. <template v-for="subItem in item.subs">
  14. <el-menu-item :index="subItem.url" :key="subItem.index">{{ subItem.title }}</el-menu-item>
  15. </template>
  16. </el-submenu>
  17. </template>
  18. <template v-else>
  19. <el-menu-item :index="item.url" :key="item.index">
  20. <i class="icon margin_r_20" :class="item.icon"></i>
  21. <span slot="title">{{ item.title }}</span>
  22. </el-menu-item>
  23. </template>
  24. </template>
  25. </el-menu>
  26. </el-aside>
  27. </template>
  28. <script>
  29. import bus from '@/common/bus';
  30. export default {
  31. data() {
  32. return {
  33. fold: false,
  34. items: [],
  35. datas: []
  36. };
  37. },
  38. methods: {
  39. getSubs(params) {
  40. let arr = this.datas.filter(x => x.module_parent_guid == params.guid);
  41. let subs = [];
  42. arr.forEach(data => {
  43. subs.push({
  44. index: 'sub_' + data.id,
  45. url: data.module_url || 'sub_' + data.id,
  46. title: data.module_name
  47. });
  48. });
  49. return subs;
  50. },
  51. getMenu() {
  52. const res = {
  53. code: 200,
  54. msg: '',
  55. datas: {
  56. authorize_modules: [
  57. // {
  58. // id: 59,
  59. // guid: '758a7f6c-f033-449e-b3c8-dca323c3e1f9',
  60. // module_parent_guid: '',
  61. // module_name: '系统首页',
  62. // module_sys_name: null,
  63. // module_type: null,
  64. // module_url: '/pages/home',
  65. // module_icon: 'iconfont iconshouye01-01',
  66. // module_img_url: null,
  67. // module_level: 1,
  68. // module_code: '10005'
  69. // },
  70. {
  71. id: 60,
  72. guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  73. module_parent_guid: '',
  74. module_name: '店铺管理',
  75. module_sys_name: null,
  76. module_type: null,
  77. module_url: '',
  78. module_icon: 'iconfont icondianpu',
  79. module_img_url: null,
  80. module_level: 1,
  81. module_code: '10006'
  82. },
  83. {
  84. id: 61,
  85. guid: '88fb4c51-cc31-4abe-abb4-46c67c4476b3',
  86. module_parent_guid: '',
  87. module_name: '商品管理',
  88. module_sys_name: null,
  89. module_type: null,
  90. module_url: '',
  91. module_icon: 'iconfont iconchanpin',
  92. module_img_url: null,
  93. module_level: 1,
  94. module_code: '10007'
  95. },
  96. {
  97. id: 62,
  98. guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  99. module_parent_guid: '',
  100. module_name: '订单管理',
  101. module_sys_name: null,
  102. module_type: null,
  103. module_url: '',
  104. module_icon: 'iconfont iconquanbudingdan',
  105. module_img_url: null,
  106. module_level: 1,
  107. module_code: '10008'
  108. },
  109. // {
  110. // id: 63,
  111. // guid: '3f853e04-eab3-4019-93fc-9478cda764c9',
  112. // module_parent_guid: '',
  113. // module_name: '会员管理',
  114. // module_sys_name: null,
  115. // module_type: null,
  116. // module_url: '',
  117. // module_icon: 'iconfont iconyonghu',
  118. // module_img_url: null,
  119. // module_level: 1,
  120. // module_code: '10009'
  121. // },
  122. // {
  123. // id: 69,
  124. // guid: '91a55a2c-335a-4c36-a9f5-5d1cea96132e',
  125. // module_parent_guid: '',
  126. // module_name: '应用管理',
  127. // module_sys_name: null,
  128. // module_type: null,
  129. // module_url: '',
  130. // module_icon: 'iconfont iconyingyong',
  131. // module_img_url: null,
  132. // module_level: 1,
  133. // module_code: '10015'
  134. // },
  135. {
  136. id: 50,
  137. guid: 'f517cade-46ee-4735-9a1d-b48be2f9d1cc',
  138. module_parent_guid: '',
  139. module_name: '系统设置',
  140. module_sys_name: 'sys',
  141. module_type: '',
  142. module_url: '',
  143. module_icon: 'iconfont iconxitongshezhi',
  144. module_img_url: '',
  145. module_level: 1,
  146. module_code: '10065'
  147. },
  148. // {
  149. // id: 91,
  150. // guid: 'f8bed44c-bb20-46d3-9b60-6e182540e8e8',
  151. // module_parent_guid: '',
  152. // module_name: '日志管理',
  153. // module_sys_name: null,
  154. // module_type: null,
  155. // module_url: '',
  156. // module_icon: 'iconfont iconrizhi',
  157. // module_img_url: null,
  158. // module_level: 1,
  159. // module_code: '10070'
  160. // },
  161. {
  162. id: 1,
  163. guid: '06b7301b-e433-4429-9476-e93f3eff963c',
  164. module_parent_guid: '91a55a2c-335a-4c36-a9f5-5d1cea96132e',
  165. module_name: '小程序',
  166. module_sys_name: 'app 微信小程序',
  167. module_type: '',
  168. module_url: '/pages/app/mp/mp_page',
  169. module_icon: '',
  170. module_img_url: '',
  171. module_level: 2,
  172. module_code: '10015.20003'
  173. },
  174. {
  175. id: 6,
  176. guid: 'd9105323-15dc-43a2-9165-13d0f36f4c2a',
  177. module_parent_guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  178. module_name: '店铺首页',
  179. module_sys_name: 'app 应用轮播图',
  180. module_type: '',
  181. module_url: '/pages/shop/home/page',
  182. module_icon: '',
  183. module_img_url: '',
  184. module_level: 2,
  185. module_code: '10006.20012'
  186. },
  187. {
  188. id: 15,
  189. guid: '5ade17a5-99d8-41fd-9ed3-0f2b832159f7',
  190. module_parent_guid: '88fb4c51-cc31-4abe-abb4-46c67c4476b3',
  191. module_name: '商品列表',
  192. module_sys_name: 'goods 商品',
  193. module_type: '',
  194. module_url: '/pages/goods/list/goods_list',
  195. module_icon: '',
  196. module_img_url: '',
  197. module_level: 2,
  198. module_code: '10007.20012'
  199. },
  200. {
  201. id: 26,
  202. guid: '5437d34a-3de2-4347-a893-3ffff57e2162',
  203. module_parent_guid: '3f853e04-eab3-4019-93fc-9478cda764c9',
  204. module_name: '会员列表',
  205. module_sys_name: 'member 会员',
  206. module_type: '',
  207. module_url: '/pages/member/list/member_list',
  208. module_icon: '',
  209. module_img_url: '',
  210. module_level: 2,
  211. module_code: '10009.20012'
  212. },
  213. {
  214. id: 35,
  215. guid: '56b1109a-7db4-4c7a-a078-9d278586a7ac',
  216. module_parent_guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  217. module_name: '订单列表',
  218. module_sys_name: 'order 订单',
  219. module_type: '',
  220. module_url: '/pages/order/order/order_list',
  221. module_icon: '',
  222. module_img_url: '',
  223. module_level: 2,
  224. module_code: '10008.20012'
  225. },
  226. {
  227. id: 99,
  228. guid: '82b57c1b-d5fc-4c20-8a39-2a45a0c27542',
  229. module_parent_guid: 'f8bed44c-bb20-46d3-9b60-6e182540e8e8',
  230. module_name: '操作日志',
  231. module_sys_name: null,
  232. module_type: null,
  233. module_url: '/pages/log/operation_log',
  234. module_icon: '',
  235. module_img_url: null,
  236. module_level: 2,
  237. module_code: '10070.20019'
  238. },
  239. // {
  240. // id: 4,
  241. // guid: '6f4f903a-77c1-454e-8943-7df6b5bf6ac9',
  242. // module_parent_guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  243. // module_name: '分类导航',
  244. // module_sys_name: 'app 应用分类',
  245. // module_type: '',
  246. // module_url: '/pages/shop/classify/classify_navigation',
  247. // module_icon: '',
  248. // module_img_url: '',
  249. // module_level: 2,
  250. // module_code: '10006.20012'
  251. // },
  252. {
  253. id: 18,
  254. guid: '4a248661-531c-429c-a513-031375572f9e',
  255. module_parent_guid: '88fb4c51-cc31-4abe-abb4-46c67c4476b3',
  256. module_name: '商品分类',
  257. module_sys_name: 'goods 商品分类',
  258. module_type: '',
  259. module_url: '/pages/goods/classify/goods_classify',
  260. module_icon: '',
  261. module_img_url: '',
  262. module_level: 2,
  263. module_code: '10007.20012'
  264. },
  265. {
  266. id: 55,
  267. guid: '4482135a-09c9-4b08-93e4-955e8c5e6314',
  268. module_parent_guid: 'f517cade-46ee-4735-9a1d-b48be2f9d1cc',
  269. module_name: '账号管理',
  270. module_sys_name: 'sys.user 账号',
  271. module_type: '',
  272. module_url: '/pages/system_set/account/account',
  273. module_icon: '',
  274. module_img_url: '',
  275. module_level: 2,
  276. module_code: '10065.20008'
  277. },
  278. {
  279. id: 79,
  280. guid: '6a3c2b73-c69a-484b-8894-8976bde06350',
  281. module_parent_guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  282. module_name: '退款处理',
  283. module_sys_name: null,
  284. module_type: null,
  285. module_url: '/pages/order/refunds_dispose',
  286. module_icon: '',
  287. module_img_url: null,
  288. module_level: 2,
  289. module_code: '10008.20012'
  290. },
  291. {
  292. id: 88,
  293. guid: '6a3c2b73-c69a-484b-8894-8976bde06350',
  294. module_parent_guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  295. module_name: '快递公司',
  296. module_sys_name: null,
  297. module_type: null,
  298. module_url: '/pages/order/kuaidi',
  299. module_icon: '',
  300. module_img_url: null,
  301. module_level: 2,
  302. module_code: '10008.20012'
  303. },
  304. // {
  305. // id: 89,
  306. // guid: '6a3c2b73-c69a-484b-8894-8976bde06350',
  307. // module_parent_guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  308. // module_name: '编辑快递公司',
  309. // module_sys_name: null,
  310. // module_type: null,
  311. // module_url: '/pages/order/kuaidi_add_edit',
  312. // module_icon: '',
  313. // module_img_url: null,
  314. // module_level: 2,
  315. // module_code: '10008.20012'
  316. // },
  317. {
  318. id: 17,
  319. guid: '63dad488-27dc-4711-8d2b-b6b8a9f6fe04',
  320. module_parent_guid: '88fb4c51-cc31-4abe-abb4-46c67c4476b3',
  321. module_name: '标签管理',
  322. module_sys_name: 'goods 商品标签',
  323. module_type: '',
  324. module_url: '/pages/goods/label/page',
  325. module_icon: '',
  326. module_img_url: '',
  327. module_level: 2,
  328. module_code: '10007.20012'
  329. },
  330. // {
  331. // id: 53,
  332. // guid: '8006f8db-f724-453e-bf91-7c5e5a2daf95',
  333. // module_parent_guid: 'f517cade-46ee-4735-9a1d-b48be2f9d1cc',
  334. // module_name: '角色管理',
  335. // module_sys_name: 'sys.role 角色',
  336. // module_type: '',
  337. // module_url: '/pages/system_set/role/role',
  338. // module_icon: '',
  339. // module_img_url: '',
  340. // module_level: 2,
  341. // module_code: '10065.20006'
  342. // },
  343. {
  344. id: 75,
  345. guid: '4443db8b-5597-4d25-a508-6c52f312d007',
  346. module_parent_guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  347. module_name: '限时精选',
  348. module_sys_name: null,
  349. module_type: null,
  350. module_url: '/pages/shop/limit',
  351. module_icon: '',
  352. module_img_url: null,
  353. module_level: 2,
  354. module_code: '10006.20012'
  355. },
  356. {
  357. id: 77,
  358. guid: 'd6626496-5d0e-4d97-871f-8efe964505f8',
  359. module_parent_guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  360. module_name: '热门推荐',
  361. module_sys_name: null,
  362. module_type: null,
  363. module_url: '/pages/shop/hot',
  364. module_icon: '',
  365. module_img_url: null,
  366. module_level: 2,
  367. module_code: '10006.20012'
  368. },
  369. {
  370. id: 20,
  371. guid: '400f5055-c1c6-456f-a3cf-69349036df05',
  372. module_parent_guid: '88fb4c51-cc31-4abe-abb4-46c67c4476b3',
  373. module_name: '商品评价',
  374. module_sys_name: 'goods 商品评论',
  375. module_type: '',
  376. module_url: '/pages/goods/evaluate',
  377. module_icon: '',
  378. module_img_url: '',
  379. module_level: 2,
  380. module_code: '10007.20012'
  381. },
  382. {
  383. id: 40,
  384. guid: 'f12276ee-fb94-4e9e-942c-bab97e789c0a',
  385. module_parent_guid: '0f15d115-c4b8-46a8-9469-b1c404aab6e6',
  386. module_name: '搜索管理',
  387. module_sys_name: 'search 历史搜索',
  388. module_type: '',
  389. module_url: '/pages/shop/search/page',
  390. module_icon: '',
  391. module_img_url: '',
  392. module_level: 2,
  393. module_code: '10006.20012'
  394. },
  395. // {
  396. // id: 81,
  397. // guid: '9f7f2915-c9e3-4d04-a4c8-e9d649d2e0a8',
  398. // module_parent_guid: '465b3efa-d5c2-4dce-808d-16c2aeddbe55',
  399. // module_name: '交易设置',
  400. // module_sys_name: null,
  401. // module_type: null,
  402. // module_url: '/pages/order/deal_set',
  403. // module_icon: '',
  404. // module_img_url: null,
  405. // module_level: 2,
  406. // module_code: '10008.20013'
  407. // }
  408. ]
  409. }
  410. };
  411. this.datas = res.datas.authorize_modules;
  412. this.datas.forEach(data => {
  413. if (data.module_parent_guid == '')
  414. this.items.push({
  415. icon: data.module_icon,
  416. url: data.module_url || data.id + '',
  417. index: data.id + '',
  418. title: data.module_name,
  419. subs: this.getSubs(data)
  420. });
  421. });
  422. uni.setStorage({
  423. key: '__menu',
  424. data: this.datas
  425. });
  426. }
  427. },
  428. created() {
  429. bus.$on('fold', res => {
  430. this.fold = res;
  431. if (res) {
  432. this.$refs.asideChange.$el.style.width = '64px';
  433. this.$refs.headImgChange.$el.style.width = '64px';
  434. this.$refs.headImgChange.$el.style.height = '100px';
  435. } else {
  436. this.$refs.asideChange.$el.style.width = '180px';
  437. this.$refs.headImgChange.$el.style.width = '100%';
  438. this.$refs.headImgChange.$el.style.height = '100px';
  439. }
  440. });
  441. this.items = [];
  442. if (this.items.length <= 0) {
  443. this.getMenu();
  444. }
  445. },
  446. computed: {
  447. onRoutes() {
  448. return this.$route.path;
  449. }
  450. }
  451. };
  452. </script>
  453. <style>
  454. >>>.el-menu {
  455. border: none;
  456. }
  457. >>>.el-submenu__title:hover,
  458. >>>.el-menu-item:hover,
  459. >>>.el-submenu__title:hover i {
  460. color: #3492e9 !important;
  461. background-color: #fff !important;
  462. }
  463. >>>.el-submenu__icon-arrow {
  464. transform: rotate(-90deg);
  465. top: 31px;
  466. right: 20px;
  467. }
  468. >>>.el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow {
  469. transform: rotate(0deg);
  470. }
  471. >>>.el-submenu .el-menu-item {
  472. padding: 0 0 0 68px !important;
  473. min-width: initial !important;
  474. }
  475. >>>.el-menu-item i {
  476. color: #909399;
  477. }
  478. >>>.el-menu-item.is-active:after {
  479. content: ' ';
  480. position: absolute;
  481. right: 0rem;
  482. width: 0.3125rem;
  483. height: 1.25rem;
  484. background-color: #3492e9;
  485. top: 50%;
  486. transform: translate(0, -50%);
  487. }
  488. .aside {
  489. background-color: #ffffff;
  490. overflow-x: hidden;
  491. overflow-y: hidden;
  492. position: fixed;
  493. left: 0;
  494. top: 0;
  495. bottom: 0;
  496. transition: all 0.3s ease-in-out;
  497. }
  498. .headImg {
  499. width: 100%;
  500. height: 100px;
  501. transition: all 0.3s ease-in-out;
  502. }
  503. .menu {
  504. overflow: auto;
  505. height: calc(100% - 100px);
  506. overflow-x: hidden;
  507. }
  508. .main::-webkit-scrollbar {
  509. display: none;
  510. }
  511. .icon {
  512. font-size: 20px;
  513. }
  514. </style>