fix(全局): 无项目资源权限判定调整

This commit is contained in:
baiqi 2024-07-23 10:45:34 +08:00 committed by Craftsman
parent 2f7ac16d86
commit 0102299f09
2 changed files with 10 additions and 4 deletions

View File

@ -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,
});

View File

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