From 81552f0cb93501751b00831ee8fc3383b309b554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 8 Apr 2026 11:49:53 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86=20=E5=A2=9E=E5=8A=A0=E6=BF=80?= =?UTF-8?q?=E6=B4=BB=E8=8F=9C=E5=8D=95=E4=B8=8E=E6=89=A9=E5=B1=95=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/menu/types.ts | 4 ++++ src/components/TopNav/index.vue | 5 +++-- src/store/modules/permission.ts | 6 +++--- src/views/system/menu/index.vue | 13 ++++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/api/system/menu/types.ts b/src/api/system/menu/types.ts index ca19840..d566fbe 100644 --- a/src/api/system/menu/types.ts +++ b/src/api/system/menu/types.ts @@ -44,6 +44,8 @@ export interface MenuVO extends BaseEntity { visible: string; status: string; icon: string; + activeMenu: string; + ext: string; remark: string; } @@ -63,6 +65,8 @@ export interface MenuForm { visible?: string; status?: string; icon?: string; + activeMenu?: string; + ext?: string; remark?: string; query?: string; perms?: string; diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 80e1ee5..26c79b5 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -97,8 +97,9 @@ const childrenMenus = computed(() => { // 默认激活的菜单 const activeMenu = computed(() => { - let path = route.path; - if (path === '/index') { + const { meta } = route; + let path = meta.activeMenu || route.path; + if (path === '/index' || route.path === '/index') { path = '/system/user'; } let activePath = path; diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index bca0688..706cbf8 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -47,8 +47,8 @@ export const usePermissionStore = defineStore('permission', () => { }; const generateRoutes = async (): Promise => { const res = await getRouters(); - const { data } = res; - let text = JSON.stringify(data); + const data = Array.isArray(res.data) ? res.data : []; + const text = JSON.stringify(data); const sdata = JSON.parse(text); const rdata = JSON.parse(text); const defaultData = JSON.parse(text); @@ -65,7 +65,7 @@ export const usePermissionStore = defineStore('permission', () => { setTopbarRoutes(defaultRoutes); // 路由name重复检查 duplicateRouteChecker(asyncRoutes, sidebarRoutes); - return new Promise(resolve => resolve(rewriteRoutes)); + return rewriteRoutes; }; /** diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 4b31a80..3616017 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -313,7 +313,7 @@ - + - + + + + + + @@ -398,7 +403,9 @@ const initFormData = { isFrame: 'N', isCache: 'Y', visible: '0', - status: '0' + status: '0', + activeMenu: '', + remark: '' }; const data = reactive>({ form: { ...initFormData },