fix: hide unsupported menus in minimal scope

This commit is contained in:
wren
2026-04-29 18:14:04 +08:00
parent 3d3d8d6e6b
commit 1b67358e5b
3 changed files with 64 additions and 2 deletions
+20 -1
View File
@@ -1,4 +1,5 @@
import { apiRequest } from "../axios-client";
import { normalizeHomeTargetPath } from '~/config/minimal-scope';
// import dayjs from 'dayjs';
/**
@@ -257,7 +258,25 @@ export async function getEntryModules(token?: string): Promise<EntryModule[]> {
return [];
}
return modules;
const normalizedModules: EntryModule[] = [];
for (const module of modules) {
const normalizedTargetPath = normalizeHomeTargetPath(
module.targetPath,
Array.isArray(module.documentTypes) && module.documentTypes.length > 0
);
if (!normalizedTargetPath) {
continue;
}
normalizedModules.push({
...module,
targetPath: normalizedTargetPath,
routePath: normalizedTargetPath
});
}
return normalizedModules;
} catch (error) {
console.error('❌ [getEntryModules] 获取入口模块失败:', error instanceof Error ? error.message : String(error));
return [];