Use lightweight control center home

This commit is contained in:
2026-06-10 15:49:02 +08:00
parent 62fd2209da
commit 7c00b81934
7 changed files with 42 additions and 21 deletions
-1
View File
@@ -37,7 +37,6 @@ const businessModules = import.meta.glob([
'./langs/zh-CN/application.json',
'./langs/zh-CN/chat.json',
'./langs/zh-CN/dept.json',
'./langs/zh-CN/dashboard-design.json',
'./langs/zh-CN/dingtalk-sync.json',
'./langs/zh-CN/dict.json',
'./langs/zh-CN/feishu-sync.json',
+1 -1
View File
@@ -16,7 +16,7 @@ export const overridesPreferences = defineOverridesPreferences({
enablePreferences: false,
accessMode: 'mixed',
authPageLayout: 'panel-center',
defaultHomePath: '/page-render/main_home',
defaultHomePath: '/control-center',
layout: 'header-sidebar-nav',
},
shortcutKeys: {
+32 -8
View File
@@ -46,30 +46,55 @@ function normalizePageMap(pageMap: ComponentRecordType) {
) as ComponentRecordType;
}
function filterAvailableRoutes<T extends { children?: T[]; component?: string }>(
function normalizeBackendRoute<T extends { component?: string; name?: string; path?: string; query?: unknown }>(
route: T,
) {
if (route.name !== 'ControlCenter') return route;
const normalized = { ...route };
normalized.path = '/control-center';
normalized.component = '_core/control-center/index';
normalized.query = undefined;
return normalized;
}
function filterAvailableRoutes<
T extends {
children?: T[];
component?: string;
name?: string;
path?: string;
query?: unknown;
},
>(
routes: T[],
pageMap: ComponentRecordType,
layoutMap: ComponentRecordType,
): T[] {
return routes
.map((route) => {
const children = route.children
? filterAvailableRoutes(route.children, pageMap, layoutMap)
const normalizedRoute = normalizeBackendRoute(route);
const children = normalizedRoute.children
? filterAvailableRoutes(normalizedRoute.children, pageMap, layoutMap)
: undefined;
if (!route.component && route.children && !children?.length) {
if (
!normalizedRoute.component &&
normalizedRoute.children &&
!children?.length
) {
return undefined;
}
if (!hasPageComponent(route.component, pageMap, layoutMap)) {
if (!hasPageComponent(normalizedRoute.component, pageMap, layoutMap)) {
if (!children?.length) return undefined;
const groupRoute = { ...route, children };
const groupRoute = { ...normalizedRoute, children };
delete groupRoute.component;
return groupRoute;
}
return children ? { ...route, children } : route;
return children ? { ...normalizedRoute, children } : normalizedRoute;
})
.filter(Boolean) as T[];
}
@@ -101,7 +126,6 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
'../views/_core/system-config/index.vue',
'../views/_core/ui-config/index.vue',
'../views/_core/user/index.vue',
'../views/online-dev/page-render/index.vue',
'../views/ai-platform/agent/editor/index.vue',
'../views/ai-platform/agent/index.vue',
'../views/ai-platform/knowledge/detail/index.vue',
+1 -1
View File
@@ -191,7 +191,7 @@ function setupAccessGuard(router: Router) {
if (to.path === subAppRootPath) {
const defaultHome =
preferences.app.defaultHomePath || '/page-render/main_home';
preferences.app.defaultHomePath || '/control-center';
// 确保路径包含子应用前缀
const subAppTargetPath = defaultHome.startsWith(subAppRootPath)
? defaultHome
@@ -106,7 +106,7 @@ function getDefaultConfig() {
defaultHomePath:
overrides.app?.defaultHomePath ||
preferences.app.defaultHomePath ||
'/page-render/main_home',
'/control-center',
enablePreferences: overrides.app?.enablePreferences ?? true,
},
footer: {