From 0102299f096a3d6ad002030181e4f412c3e14c2e Mon Sep 17 00:00:00 2001 From: baiqi Date: Tue, 23 Jul 2024 10:45:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=85=A8=E5=B1=80):=20=E6=97=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=B5=84=E6=BA=90=E6=9D=83=E9=99=90=E5=88=A4=E5=AE=9A?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/modules/app/index.ts | 8 ++++---- frontend/src/store/modules/user/index.ts | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/src/store/modules/app/index.ts b/frontend/src/store/modules/app/index.ts index a30c2e9aa4..1edbfe7d6d 100644 --- a/frontend/src/store/modules/app/index.ts +++ b/frontend/src/store/modules/app/index.ts @@ -270,13 +270,13 @@ const useAppStore = defineStore('app', { }, async getProjectInfos() { try { - if (!this.currentProjectId) { + const routeName = router.currentRoute.value.name as string; + if (!this.currentProjectId || routeName?.includes('setting')) { + // 如果没有项目id,或访问的是系统设置下的页面,则不读取项目基础信息 return; } const res = await getProjectInfo(this.currentProjectId); - const routeName = router.currentRoute.value.name as string; - if ((!res || res.deleted) && !routeName?.includes('setting')) { - // 如果没有项目信息,且访问的不是系统设置下的页面,则跳转到无项目页面 + if (!res || res.deleted) { router.push({ name: NO_PROJECT_ROUTE_NAME, }); diff --git a/frontend/src/store/modules/user/index.ts b/frontend/src/store/modules/user/index.ts index 7b27571ab5..b75896c9b1 100644 --- a/frontend/src/store/modules/user/index.ts +++ b/frontend/src/store/modules/user/index.ts @@ -255,6 +255,12 @@ const useUserStore = defineStore('user', { }); return; } + const routeName = router.currentRoute.value.name as string; + if (routeName?.includes('setting')) { + // 访问系统设置下的页面,不需要获取项目信息,会在切换到非系统设置页面时获取(ms-menu组件内初始化会获取) + appStore.setCurrentMenuConfig([]); + return; + } const res = await getProjectInfo(appStore.currentProjectId); if (!res) { // 如果项目被删除或者被禁用,跳转到无项目页面