Use lightweight control center home
This commit is contained in:
@@ -7038,14 +7038,12 @@
|
||||
"name": "ControlCenter",
|
||||
"title": "menu-title.controlCenter",
|
||||
"authCode": null,
|
||||
"path": "/page-render/main_home",
|
||||
"type": "online_page",
|
||||
"component": "online-dev/page-render/index",
|
||||
"path": "/control-center",
|
||||
"type": "menu",
|
||||
"component": "_core/control-center/index",
|
||||
"redirect": null,
|
||||
"activePath": null,
|
||||
"query": {
|
||||
"pageCode": "main_home"
|
||||
},
|
||||
"query": null,
|
||||
"noBasicLayout": false,
|
||||
"icon": "lucide:layout-dashboard",
|
||||
"activeIcon": null,
|
||||
@@ -9343,7 +9341,7 @@
|
||||
"fields": {
|
||||
"application_id": "23CFVEUHdZcOQyku1mbIO",
|
||||
"config_key": "frontend_preferences",
|
||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
|
||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/control-center\"}}",
|
||||
"config_type": "preferences",
|
||||
"description": "子应用UI偏好配置",
|
||||
"status": true,
|
||||
@@ -9363,7 +9361,7 @@
|
||||
"fields": {
|
||||
"application_id": "uRFPsrZ0BSJodp-qesFq6",
|
||||
"config_key": "frontend_preferences",
|
||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
|
||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/control-center\"}}",
|
||||
"config_type": "preferences",
|
||||
"description": "子应用UI偏好配置",
|
||||
"status": true,
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -17,7 +17,7 @@ const defaultPreferences: Preferences = {
|
||||
contentPaddingTop: 0,
|
||||
defaultAvatar:
|
||||
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp',
|
||||
defaultHomePath: '/page-render/main_home',
|
||||
defaultHomePath: '/control-center',
|
||||
dynamicTitle: true,
|
||||
enableCheckUpdates: true,
|
||||
enablePreferences: true,
|
||||
|
||||
Reference in New Issue
Block a user