From 75f8ffd47fe52ff317fa374363e5c64adf1ac286 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: Sun, 21 Jun 2026 20:09:19 +0800 Subject: [PATCH] fix: restore control center home --- backend-fastapi/core/menu/service.py | 8 ++++---- backend-fastapi/db_init.json | 14 ++++++++------ web/apps/web-ele/src/locales/index.ts | 2 ++ web/apps/web-ele/src/preferences.ts | 7 ++++++- web/apps/web-ele/src/router/guard.ts | 2 +- .../src/router/routes/modules/ai-platform.ts | 4 ++-- web/apps/web-ele/src/utils/legacy-home.ts | 15 +-------------- .../_core/ui-config/modules/app-settings-form.vue | 6 +++--- 8 files changed, 27 insertions(+), 31 deletions(-) diff --git a/backend-fastapi/core/menu/service.py b/backend-fastapi/core/menu/service.py index c008a4e..0efa3f6 100644 --- a/backend-fastapi/core/menu/service.py +++ b/backend-fastapi/core/menu/service.py @@ -49,11 +49,11 @@ def _filter_ai_agent_admin_menus(menus: List[Menu]) -> List[Menu]: def _normalize_ai_agent_admin_menu(menu: Menu) -> None: - """Keep the retained control center on the lightweight admin dashboard.""" + """Keep the retained control center on the original configurable dashboard.""" if menu.name == "ControlCenter": - menu.path = "/dashboard/workspace" - menu.component = "/dashboard/workspace/index" - menu.query = None + menu.path = "/page-render/main_home" + menu.component = "/_core/page-render/index" + menu.query = {"pageCode": "main_home"} class MenuService(BaseService[Menu, MenuCreate, MenuUpdate]): diff --git a/backend-fastapi/db_init.json b/backend-fastapi/db_init.json index 88de436..476d0b1 100644 --- a/backend-fastapi/db_init.json +++ b/backend-fastapi/db_init.json @@ -7038,12 +7038,14 @@ "name": "ControlCenter", "title": "menu-title.controlCenter", "authCode": null, - "path": "/dashboard/workspace", + "path": "/page-render/main_home", "type": "menu", - "component": "/dashboard/workspace/index", + "component": "/_core/page-render/index", "redirect": null, "activePath": null, - "query": null, + "query": { + "pageCode": "main_home" + }, "noBasicLayout": false, "icon": "lucide:layout-dashboard", "activeIcon": null, @@ -9386,7 +9388,7 @@ "fields": { "application_id": "23CFVEUHdZcOQyku1mbIO", "config_key": "frontend_preferences", - "config_value": "{\"app\":{\"defaultHomePath\":\"/dashboard/workspace\"}}", + "config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}", "config_type": "preferences", "description": "子应用UI偏好配置", "status": true, @@ -9406,7 +9408,7 @@ "fields": { "application_id": "uRFPsrZ0BSJodp-qesFq6", "config_key": "frontend_preferences", - "config_value": "{\"app\":{\"defaultHomePath\":\"/dashboard/workspace\"}}", + "config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}", "config_type": "preferences", "description": "子应用UI偏好配置", "status": true, @@ -12988,7 +12990,7 @@ "cover": "", "app_type": "ai", "status": "published", - "home_path": "/dashboard/workspace", + "home_path": "/page-render/main_home", "version": 1, "config": {}, "owner_id": null, diff --git a/web/apps/web-ele/src/locales/index.ts b/web/apps/web-ele/src/locales/index.ts index 99738c4..cc7736a 100644 --- a/web/apps/web-ele/src/locales/index.ts +++ b/web/apps/web-ele/src/locales/index.ts @@ -32,7 +32,9 @@ const baseModules = import.meta.glob([ const businessModules = import.meta.glob([ './langs/zh-CN/ai-platform.json', './langs/zh-CN/announcement.json', + './langs/zh-CN/dashboard-design.json', './langs/zh-CN/menu.json', + './langs/zh-CN/message.json', './langs/zh-CN/permission.json', './langs/zh-CN/role.json', './langs/zh-CN/system.json', diff --git a/web/apps/web-ele/src/preferences.ts b/web/apps/web-ele/src/preferences.ts index 37d8592..2272119 100644 --- a/web/apps/web-ele/src/preferences.ts +++ b/web/apps/web-ele/src/preferences.ts @@ -16,10 +16,15 @@ export const overridesPreferences = defineOverridesPreferences({ enablePreferences: false, accessMode: 'mixed', authPageLayout: 'panel-center', - defaultHomePath: '/dashboard/workspace', + defaultHomePath: '/page-render/main_home', layout: 'header-sidebar-nav', preferencesButtonPosition: 'header', }, + sidebar: { + collapsed: false, + collapsedShowTitle: false, + width: 224, + }, shortcutKeys: { enable: true, globalLockScreen: false, diff --git a/web/apps/web-ele/src/router/guard.ts b/web/apps/web-ele/src/router/guard.ts index 1426730..ff44c71 100644 --- a/web/apps/web-ele/src/router/guard.ts +++ b/web/apps/web-ele/src/router/guard.ts @@ -206,7 +206,7 @@ function setupAccessGuard(router: Router) { if (to.path === subAppRootPath) { const defaultHome = - preferences.app.defaultHomePath || '/dashboard/workspace'; + preferences.app.defaultHomePath || '/page-render/main_home'; // 确保路径包含子应用前缀 const subAppTargetPath = defaultHome.startsWith(subAppRootPath) ? defaultHome diff --git a/web/apps/web-ele/src/router/routes/modules/ai-platform.ts b/web/apps/web-ele/src/router/routes/modules/ai-platform.ts index 04fe57f..ed6042f 100644 --- a/web/apps/web-ele/src/router/routes/modules/ai-platform.ts +++ b/web/apps/web-ele/src/router/routes/modules/ai-platform.ts @@ -5,7 +5,7 @@ const routes: RouteRecordRaw[] = [ meta: { hideInMenu: true }, name: 'ControlCenterLegacyRedirect', path: '/control-center', - redirect: '/dashboard/workspace', + redirect: '/page-render/main_home', }, { meta: { @@ -14,7 +14,7 @@ const routes: RouteRecordRaw[] = [ }, name: 'PageRenderMainHome', path: '/page-render/main_home', - redirect: '/dashboard/workspace', + component: () => import('#/views/_core/page-render/index.vue'), }, { meta: { hideInMenu: true }, diff --git a/web/apps/web-ele/src/utils/legacy-home.ts b/web/apps/web-ele/src/utils/legacy-home.ts index 53da6e4..a800f4b 100644 --- a/web/apps/web-ele/src/utils/legacy-home.ts +++ b/web/apps/web-ele/src/utils/legacy-home.ts @@ -1,11 +1,5 @@ import { preferences } from '@vben/preferences'; -const LEGACY_HOME_PATTERNS = [ - /^\/app\/[^/]+\/page-render\//, - /^\/app\/[^/]+\/form-render\//, - /^\/form-render\//, -]; - function decodePath(path: string) { try { return decodeURIComponent(path); @@ -14,19 +8,12 @@ function decodePath(path: string) { } } -function isLegacyHomePath(path: string) { - return LEGACY_HOME_PATTERNS.some((pattern) => pattern.test(path)); -} - function normalizeHomePath(path?: null | string) { if (!path) { return preferences.app.defaultHomePath; } - const decodedPath = decodePath(path); - return isLegacyHomePath(decodedPath) - ? preferences.app.defaultHomePath - : decodedPath; + return decodePath(path); } export { normalizeHomePath }; 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 90b859e..01fa8d1 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 @@ -53,7 +53,7 @@ const appDynamicTitle = ref(true); const appWatermark = ref(false); const appWatermarkContent = ref(''); const appEnableCheckUpdates = ref(true); -const appDefaultHomePath = ref('/dashboard/workspace'); +const appDefaultHomePath = ref('/page-render/main_home'); const appEnablePreferences = ref(true); const footerEnable = ref(true); @@ -106,7 +106,7 @@ function getDefaultConfig() { defaultHomePath: overrides.app?.defaultHomePath || preferences.app.defaultHomePath || - '/dashboard/workspace', + '/page-render/main_home', enablePreferences: overrides.app?.enablePreferences ?? true, }, footer: { @@ -229,7 +229,7 @@ async function loadConfig() { // 获取带子应用前缀的首页路径 function getDefaultHomePathWithPrefix(): string { - const path = appDefaultHomePath.value || '/dashboard/workspace'; + const path = appDefaultHomePath.value || '/page-render/main_home'; const appCode = appContextStore.appCode; // 如果是子应用模式且路径不包含子应用前缀,自动添加 if (appCode && !path.startsWith(`/app/${appCode}`)) {