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) { // 如果项目被删除或者被禁用,跳转到无项目页面