fix: restore control center home

This commit is contained in:
2026-06-21 20:09:19 +08:00
parent 61f164a6f8
commit 75f8ffd47f
8 changed files with 27 additions and 31 deletions
+4 -4
View File
@@ -49,11 +49,11 @@ def _filter_ai_agent_admin_menus(menus: List[Menu]) -> List[Menu]:
def _normalize_ai_agent_admin_menu(menu: Menu) -> None: 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": if menu.name == "ControlCenter":
menu.path = "/dashboard/workspace" menu.path = "/page-render/main_home"
menu.component = "/dashboard/workspace/index" menu.component = "/_core/page-render/index"
menu.query = None menu.query = {"pageCode": "main_home"}
class MenuService(BaseService[Menu, MenuCreate, MenuUpdate]): class MenuService(BaseService[Menu, MenuCreate, MenuUpdate]):
+8 -6
View File
@@ -7038,12 +7038,14 @@
"name": "ControlCenter", "name": "ControlCenter",
"title": "menu-title.controlCenter", "title": "menu-title.controlCenter",
"authCode": null, "authCode": null,
"path": "/dashboard/workspace", "path": "/page-render/main_home",
"type": "menu", "type": "menu",
"component": "/dashboard/workspace/index", "component": "/_core/page-render/index",
"redirect": null, "redirect": null,
"activePath": null, "activePath": null,
"query": null, "query": {
"pageCode": "main_home"
},
"noBasicLayout": false, "noBasicLayout": false,
"icon": "lucide:layout-dashboard", "icon": "lucide:layout-dashboard",
"activeIcon": null, "activeIcon": null,
@@ -9386,7 +9388,7 @@
"fields": { "fields": {
"application_id": "23CFVEUHdZcOQyku1mbIO", "application_id": "23CFVEUHdZcOQyku1mbIO",
"config_key": "frontend_preferences", "config_key": "frontend_preferences",
"config_value": "{\"app\":{\"defaultHomePath\":\"/dashboard/workspace\"}}", "config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
"config_type": "preferences", "config_type": "preferences",
"description": "子应用UI偏好配置", "description": "子应用UI偏好配置",
"status": true, "status": true,
@@ -9406,7 +9408,7 @@
"fields": { "fields": {
"application_id": "uRFPsrZ0BSJodp-qesFq6", "application_id": "uRFPsrZ0BSJodp-qesFq6",
"config_key": "frontend_preferences", "config_key": "frontend_preferences",
"config_value": "{\"app\":{\"defaultHomePath\":\"/dashboard/workspace\"}}", "config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
"config_type": "preferences", "config_type": "preferences",
"description": "子应用UI偏好配置", "description": "子应用UI偏好配置",
"status": true, "status": true,
@@ -12988,7 +12990,7 @@
"cover": "", "cover": "",
"app_type": "ai", "app_type": "ai",
"status": "published", "status": "published",
"home_path": "/dashboard/workspace", "home_path": "/page-render/main_home",
"version": 1, "version": 1,
"config": {}, "config": {},
"owner_id": null, "owner_id": null,
+2
View File
@@ -32,7 +32,9 @@ const baseModules = import.meta.glob([
const businessModules = import.meta.glob([ const businessModules = import.meta.glob([
'./langs/zh-CN/ai-platform.json', './langs/zh-CN/ai-platform.json',
'./langs/zh-CN/announcement.json', './langs/zh-CN/announcement.json',
'./langs/zh-CN/dashboard-design.json',
'./langs/zh-CN/menu.json', './langs/zh-CN/menu.json',
'./langs/zh-CN/message.json',
'./langs/zh-CN/permission.json', './langs/zh-CN/permission.json',
'./langs/zh-CN/role.json', './langs/zh-CN/role.json',
'./langs/zh-CN/system.json', './langs/zh-CN/system.json',
+6 -1
View File
@@ -16,10 +16,15 @@ export const overridesPreferences = defineOverridesPreferences({
enablePreferences: false, enablePreferences: false,
accessMode: 'mixed', accessMode: 'mixed',
authPageLayout: 'panel-center', authPageLayout: 'panel-center',
defaultHomePath: '/dashboard/workspace', defaultHomePath: '/page-render/main_home',
layout: 'header-sidebar-nav', layout: 'header-sidebar-nav',
preferencesButtonPosition: 'header', preferencesButtonPosition: 'header',
}, },
sidebar: {
collapsed: false,
collapsedShowTitle: false,
width: 224,
},
shortcutKeys: { shortcutKeys: {
enable: true, enable: true,
globalLockScreen: false, globalLockScreen: false,
+1 -1
View File
@@ -206,7 +206,7 @@ function setupAccessGuard(router: Router) {
if (to.path === subAppRootPath) { if (to.path === subAppRootPath) {
const defaultHome = const defaultHome =
preferences.app.defaultHomePath || '/dashboard/workspace'; preferences.app.defaultHomePath || '/page-render/main_home';
// 确保路径包含子应用前缀 // 确保路径包含子应用前缀
const subAppTargetPath = defaultHome.startsWith(subAppRootPath) const subAppTargetPath = defaultHome.startsWith(subAppRootPath)
? defaultHome ? defaultHome
@@ -5,7 +5,7 @@ const routes: RouteRecordRaw[] = [
meta: { hideInMenu: true }, meta: { hideInMenu: true },
name: 'ControlCenterLegacyRedirect', name: 'ControlCenterLegacyRedirect',
path: '/control-center', path: '/control-center',
redirect: '/dashboard/workspace', redirect: '/page-render/main_home',
}, },
{ {
meta: { meta: {
@@ -14,7 +14,7 @@ const routes: RouteRecordRaw[] = [
}, },
name: 'PageRenderMainHome', name: 'PageRenderMainHome',
path: '/page-render/main_home', path: '/page-render/main_home',
redirect: '/dashboard/workspace', component: () => import('#/views/_core/page-render/index.vue'),
}, },
{ {
meta: { hideInMenu: true }, meta: { hideInMenu: true },
+1 -14
View File
@@ -1,11 +1,5 @@
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
const LEGACY_HOME_PATTERNS = [
/^\/app\/[^/]+\/page-render\//,
/^\/app\/[^/]+\/form-render\//,
/^\/form-render\//,
];
function decodePath(path: string) { function decodePath(path: string) {
try { try {
return decodeURIComponent(path); 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) { function normalizeHomePath(path?: null | string) {
if (!path) { if (!path) {
return preferences.app.defaultHomePath; return preferences.app.defaultHomePath;
} }
const decodedPath = decodePath(path); return decodePath(path);
return isLegacyHomePath(decodedPath)
? preferences.app.defaultHomePath
: decodedPath;
} }
export { normalizeHomePath }; export { normalizeHomePath };
@@ -53,7 +53,7 @@ const appDynamicTitle = ref(true);
const appWatermark = ref(false); const appWatermark = ref(false);
const appWatermarkContent = ref(''); const appWatermarkContent = ref('');
const appEnableCheckUpdates = ref(true); const appEnableCheckUpdates = ref(true);
const appDefaultHomePath = ref('/dashboard/workspace'); const appDefaultHomePath = ref('/page-render/main_home');
const appEnablePreferences = ref(true); const appEnablePreferences = ref(true);
const footerEnable = ref(true); const footerEnable = ref(true);
@@ -106,7 +106,7 @@ function getDefaultConfig() {
defaultHomePath: defaultHomePath:
overrides.app?.defaultHomePath || overrides.app?.defaultHomePath ||
preferences.app.defaultHomePath || preferences.app.defaultHomePath ||
'/dashboard/workspace', '/page-render/main_home',
enablePreferences: overrides.app?.enablePreferences ?? true, enablePreferences: overrides.app?.enablePreferences ?? true,
}, },
footer: { footer: {
@@ -229,7 +229,7 @@ async function loadConfig() {
// 获取带子应用前缀的首页路径 // 获取带子应用前缀的首页路径
function getDefaultHomePathWithPrefix(): string { function getDefaultHomePathWithPrefix(): string {
const path = appDefaultHomePath.value || '/dashboard/workspace'; const path = appDefaultHomePath.value || '/page-render/main_home';
const appCode = appContextStore.appCode; const appCode = appContextStore.appCode;
// 如果是子应用模式且路径不包含子应用前缀,自动添加 // 如果是子应用模式且路径不包含子应用前缀,自动添加
if (appCode && !path.startsWith(`/app/${appCode}`)) { if (appCode && !path.startsWith(`/app/${appCode}`)) {