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
+2
View File
@@ -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',
+6 -1
View File
@@ -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,
+1 -1
View File
@@ -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
@@ -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 },
+1 -14
View File
@@ -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 };
@@ -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}`)) {