From 7c00b81934b61e876800b94b354434621b4251ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cls=5F=E5=AE=81=E6=B3=A2=E6=9C=AC=E6=9C=BA?= <908705107@qq.com> Date: Wed, 10 Jun 2026 15:49:02 +0800 Subject: [PATCH] Use lightweight control center home --- backend-fastapi/db_init.json | 14 +++---- web/apps/web-ele/src/locales/index.ts | 1 - web/apps/web-ele/src/preferences.ts | 2 +- web/apps/web-ele/src/router/access.ts | 40 +++++++++++++++---- web/apps/web-ele/src/router/guard.ts | 2 +- .../ui-config/modules/app-settings-form.vue | 2 +- web/packages/@core/preferences/src/config.ts | 2 +- 7 files changed, 42 insertions(+), 21 deletions(-) diff --git a/backend-fastapi/db_init.json b/backend-fastapi/db_init.json index 5bd011e..7de5896 100644 --- a/backend-fastapi/db_init.json +++ b/backend-fastapi/db_init.json @@ -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, diff --git a/web/apps/web-ele/src/locales/index.ts b/web/apps/web-ele/src/locales/index.ts index 9e61954..73b0057 100644 --- a/web/apps/web-ele/src/locales/index.ts +++ b/web/apps/web-ele/src/locales/index.ts @@ -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', diff --git a/web/apps/web-ele/src/preferences.ts b/web/apps/web-ele/src/preferences.ts index f85eb34..110ab8d 100644 --- a/web/apps/web-ele/src/preferences.ts +++ b/web/apps/web-ele/src/preferences.ts @@ -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: { diff --git a/web/apps/web-ele/src/router/access.ts b/web/apps/web-ele/src/router/access.ts index f4ea804..b976fc3 100644 --- a/web/apps/web-ele/src/router/access.ts +++ b/web/apps/web-ele/src/router/access.ts @@ -46,30 +46,55 @@ function normalizePageMap(pageMap: ComponentRecordType) { ) as ComponentRecordType; } -function filterAvailableRoutes( +function normalizeBackendRoute( + 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', diff --git a/web/apps/web-ele/src/router/guard.ts b/web/apps/web-ele/src/router/guard.ts index 34f2f17..4c943cf 100644 --- a/web/apps/web-ele/src/router/guard.ts +++ b/web/apps/web-ele/src/router/guard.ts @@ -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 diff --git a/web/apps/web-ele/src/views/_core/ui-config/modules/app-settings-form.vue b/web/apps/web-ele/src/views/_core/ui-config/modules/app-settings-form.vue index beee0df..3870d66 100644 --- a/web/apps/web-ele/src/views/_core/ui-config/modules/app-settings-form.vue +++ b/web/apps/web-ele/src/views/_core/ui-config/modules/app-settings-form.vue @@ -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: { diff --git a/web/packages/@core/preferences/src/config.ts b/web/packages/@core/preferences/src/config.ts index 6108aeb..801059f 100644 --- a/web/packages/@core/preferences/src/config.ts +++ b/web/packages/@core/preferences/src/config.ts @@ -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,