From 709d2449b70230ce77a1d7d7ba505bb60a02ba1b Mon Sep 17 00:00:00 2001 From: From-wh Date: Thu, 23 Feb 2023 14:14:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?improve:=20=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E5=AE=9A=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/admin/src/router/routers.js | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/template/admin/src/router/routers.js b/template/admin/src/router/routers.js index d9db9c854..423697d8e 100644 --- a/template/admin/src/router/routers.js +++ b/template/admin/src/router/routers.js @@ -24,7 +24,7 @@ import BasicLayout from '@/components/main'; import statistic from './modules/statistic'; import frameOut from './modules/frameOut'; import division from './modules/division'; -import settings from '@/setting' +import settings from '@/setting'; let routePre = settings.routePre; /** * 在主框架内显示 @@ -51,7 +51,7 @@ const frameIn = [ // component: () => import('@/pages/system/log') // }, { - path: routePre+'/system/user', + path: routePre + '/system/user', name: `systemUser`, meta: { auth: true, @@ -60,7 +60,7 @@ const frameIn = [ component: () => import('@/pages/setting/user/index'), }, { - path: routePre+'/system/files', + path: routePre + '/system/files', name: `systemFiles`, meta: { auth: ['admin-setting-files'], @@ -95,7 +95,17 @@ const frameIn = [ ], }, { - path: routePre+'/widget.images/index.html', + path: routePre, + meta: { + title: 'CRMEB', + }, + redirect: { + name: 'home_index', + }, + component: BasicLayout, + }, + { + path: routePre + '/widget.images/index.html', name: `images`, meta: { auth: ['admin-user-user-index'], @@ -104,7 +114,7 @@ const frameIn = [ component: () => import('@/components/uploadPictures/widgetImg'), }, { - path: routePre+'/widget.widgets/icon.html', + path: routePre + '/widget.widgets/icon.html', name: `imagesIcon`, meta: { auth: ['admin-user-user-index'], @@ -113,7 +123,7 @@ const frameIn = [ component: () => import('@/components/iconFrom/index'), }, { - path: routePre+'/store.StoreProduct/index.html', + path: routePre + '/store.StoreProduct/index.html', name: `storeProduct`, meta: { title: '选择商品', @@ -121,7 +131,7 @@ const frameIn = [ component: () => import('@/components/goodsList/index'), }, { - path: routePre+'/system.User/list.html', + path: routePre + '/system.User/list.html', name: `changeUser`, meta: { title: '选择用户', @@ -129,7 +139,7 @@ const frameIn = [ component: () => import('@/components/customerInfo/index'), }, { - path: routePre+'/widget.video/index.html', + path: routePre + '/widget.video/index.html', name: `video`, meta: { title: '上传视频', @@ -163,7 +173,7 @@ const frameOuts = frameOut; const errorPage = [ { - path: routePre+'/403', + path: routePre + '/403', name: '403', meta: { title: '403', @@ -171,7 +181,7 @@ const errorPage = [ component: () => import('@/pages/system/error/403'), }, { - path: routePre+'/500', + path: routePre + '/500', name: '500', meta: { title: '500', @@ -179,7 +189,7 @@ const errorPage = [ component: () => import('@/pages/system/error/500'), }, { - path: routePre+'/*', + path: routePre + '/*', name: '404', meta: { title: '404', From 7d43be051e66e211fde7d060dcabdac2bc373673 Mon Sep 17 00:00:00 2001 From: From-wh Date: Thu, 23 Feb 2023 14:22:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?improve:=20=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/components/side-menu/side-menu.vue | 24 ++++++++++++------- template/admin/src/components/main/main.vue | 1 - 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/template/admin/src/components/main/components/side-menu/side-menu.vue b/template/admin/src/components/main/components/side-menu/side-menu.vue index 21adadeb0..07de96187 100644 --- a/template/admin/src/components/main/components/side-menu/side-menu.vue +++ b/template/admin/src/components/main/components/side-menu/side-menu.vue @@ -170,6 +170,15 @@ export default { this.$refs.menu.updateOpened(); }); }, + collapsed(val) { + if (!val) { + console.log(this.$route, this.findParentById(this.menuList, this.$route.path)); + this.handleSelect(this.findParentById(this.menuList, this.$route.path)); + this.$nextTick(() => { + this.$refs.childMenu.updateOpened(); + }); + } + }, $route(newRoute) {}, $route: { handler(newRoute) { @@ -189,9 +198,9 @@ export default { console.log(this.menuList); this.openedNames = getUnion(this.openedNames, this.getOpenedNamesByActiveName()); if (sessionStorage.getItem('menuActive')) { - // this.activeMenuPath = sessionStorage.getItem('menuActive'); - // this.catName = sessionStorage.getItem('menuActiveTitle'); - // this.getChildrenList(sessionStorage.getItem('menuActive')); + this.activeMenuPath = sessionStorage.getItem('menuActive'); + this.catName = sessionStorage.getItem('menuActiveTitle'); + this.getChildrenList(sessionStorage.getItem('menuActive')); } else { this.handleSelect(this.openedNames[0]); } @@ -256,11 +265,12 @@ export default { this.turnToPage(name); }, collHandleSelect(name) { + console.log(this.menuList) this.activeMenuPath = this.findParentById(this.menuList, name); this.turnToPage(name); }, findParentById(arr, path) { - var parentId = '没有父元素', + var parentId = '', hasParentId = (function loop(arr) { return arr.some((item) => { if (item.path === path) { @@ -338,7 +348,6 @@ export default {