Use lightweight control center home
This commit is contained in:
@@ -7038,14 +7038,12 @@
|
|||||||
"name": "ControlCenter",
|
"name": "ControlCenter",
|
||||||
"title": "menu-title.controlCenter",
|
"title": "menu-title.controlCenter",
|
||||||
"authCode": null,
|
"authCode": null,
|
||||||
"path": "/page-render/main_home",
|
"path": "/control-center",
|
||||||
"type": "online_page",
|
"type": "menu",
|
||||||
"component": "online-dev/page-render/index",
|
"component": "_core/control-center/index",
|
||||||
"redirect": null,
|
"redirect": null,
|
||||||
"activePath": null,
|
"activePath": null,
|
||||||
"query": {
|
"query": null,
|
||||||
"pageCode": "main_home"
|
|
||||||
},
|
|
||||||
"noBasicLayout": false,
|
"noBasicLayout": false,
|
||||||
"icon": "lucide:layout-dashboard",
|
"icon": "lucide:layout-dashboard",
|
||||||
"activeIcon": null,
|
"activeIcon": null,
|
||||||
@@ -9343,7 +9341,7 @@
|
|||||||
"fields": {
|
"fields": {
|
||||||
"application_id": "23CFVEUHdZcOQyku1mbIO",
|
"application_id": "23CFVEUHdZcOQyku1mbIO",
|
||||||
"config_key": "frontend_preferences",
|
"config_key": "frontend_preferences",
|
||||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
|
"config_value": "{\"app\":{\"defaultHomePath\":\"/control-center\"}}",
|
||||||
"config_type": "preferences",
|
"config_type": "preferences",
|
||||||
"description": "子应用UI偏好配置",
|
"description": "子应用UI偏好配置",
|
||||||
"status": true,
|
"status": true,
|
||||||
@@ -9363,7 +9361,7 @@
|
|||||||
"fields": {
|
"fields": {
|
||||||
"application_id": "uRFPsrZ0BSJodp-qesFq6",
|
"application_id": "uRFPsrZ0BSJodp-qesFq6",
|
||||||
"config_key": "frontend_preferences",
|
"config_key": "frontend_preferences",
|
||||||
"config_value": "{\"app\":{\"defaultHomePath\":\"/page-render/main_home\"}}",
|
"config_value": "{\"app\":{\"defaultHomePath\":\"/control-center\"}}",
|
||||||
"config_type": "preferences",
|
"config_type": "preferences",
|
||||||
"description": "子应用UI偏好配置",
|
"description": "子应用UI偏好配置",
|
||||||
"status": true,
|
"status": true,
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const businessModules = import.meta.glob([
|
|||||||
'./langs/zh-CN/application.json',
|
'./langs/zh-CN/application.json',
|
||||||
'./langs/zh-CN/chat.json',
|
'./langs/zh-CN/chat.json',
|
||||||
'./langs/zh-CN/dept.json',
|
'./langs/zh-CN/dept.json',
|
||||||
'./langs/zh-CN/dashboard-design.json',
|
|
||||||
'./langs/zh-CN/dingtalk-sync.json',
|
'./langs/zh-CN/dingtalk-sync.json',
|
||||||
'./langs/zh-CN/dict.json',
|
'./langs/zh-CN/dict.json',
|
||||||
'./langs/zh-CN/feishu-sync.json',
|
'./langs/zh-CN/feishu-sync.json',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export const overridesPreferences = defineOverridesPreferences({
|
|||||||
enablePreferences: false,
|
enablePreferences: false,
|
||||||
accessMode: 'mixed',
|
accessMode: 'mixed',
|
||||||
authPageLayout: 'panel-center',
|
authPageLayout: 'panel-center',
|
||||||
defaultHomePath: '/page-render/main_home',
|
defaultHomePath: '/control-center',
|
||||||
layout: 'header-sidebar-nav',
|
layout: 'header-sidebar-nav',
|
||||||
},
|
},
|
||||||
shortcutKeys: {
|
shortcutKeys: {
|
||||||
|
|||||||
@@ -46,30 +46,55 @@ function normalizePageMap(pageMap: ComponentRecordType) {
|
|||||||
) as 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[],
|
routes: T[],
|
||||||
pageMap: ComponentRecordType,
|
pageMap: ComponentRecordType,
|
||||||
layoutMap: ComponentRecordType,
|
layoutMap: ComponentRecordType,
|
||||||
): T[] {
|
): T[] {
|
||||||
return routes
|
return routes
|
||||||
.map((route) => {
|
.map((route) => {
|
||||||
const children = route.children
|
const normalizedRoute = normalizeBackendRoute(route);
|
||||||
? filterAvailableRoutes(route.children, pageMap, layoutMap)
|
const children = normalizedRoute.children
|
||||||
|
? filterAvailableRoutes(normalizedRoute.children, pageMap, layoutMap)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
if (!route.component && route.children && !children?.length) {
|
if (
|
||||||
|
!normalizedRoute.component &&
|
||||||
|
normalizedRoute.children &&
|
||||||
|
!children?.length
|
||||||
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasPageComponent(route.component, pageMap, layoutMap)) {
|
if (!hasPageComponent(normalizedRoute.component, pageMap, layoutMap)) {
|
||||||
if (!children?.length) return undefined;
|
if (!children?.length) return undefined;
|
||||||
|
|
||||||
const groupRoute = { ...route, children };
|
const groupRoute = { ...normalizedRoute, children };
|
||||||
delete groupRoute.component;
|
delete groupRoute.component;
|
||||||
return groupRoute;
|
return groupRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
return children ? { ...route, children } : route;
|
return children ? { ...normalizedRoute, children } : normalizedRoute;
|
||||||
})
|
})
|
||||||
.filter(Boolean) as T[];
|
.filter(Boolean) as T[];
|
||||||
}
|
}
|
||||||
@@ -101,7 +126,6 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
|||||||
'../views/_core/system-config/index.vue',
|
'../views/_core/system-config/index.vue',
|
||||||
'../views/_core/ui-config/index.vue',
|
'../views/_core/ui-config/index.vue',
|
||||||
'../views/_core/user/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/editor/index.vue',
|
||||||
'../views/ai-platform/agent/index.vue',
|
'../views/ai-platform/agent/index.vue',
|
||||||
'../views/ai-platform/knowledge/detail/index.vue',
|
'../views/ai-platform/knowledge/detail/index.vue',
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ function setupAccessGuard(router: Router) {
|
|||||||
|
|
||||||
if (to.path === subAppRootPath) {
|
if (to.path === subAppRootPath) {
|
||||||
const defaultHome =
|
const defaultHome =
|
||||||
preferences.app.defaultHomePath || '/page-render/main_home';
|
preferences.app.defaultHomePath || '/control-center';
|
||||||
// 确保路径包含子应用前缀
|
// 确保路径包含子应用前缀
|
||||||
const subAppTargetPath = defaultHome.startsWith(subAppRootPath)
|
const subAppTargetPath = defaultHome.startsWith(subAppRootPath)
|
||||||
? defaultHome
|
? defaultHome
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ function getDefaultConfig() {
|
|||||||
defaultHomePath:
|
defaultHomePath:
|
||||||
overrides.app?.defaultHomePath ||
|
overrides.app?.defaultHomePath ||
|
||||||
preferences.app.defaultHomePath ||
|
preferences.app.defaultHomePath ||
|
||||||
'/page-render/main_home',
|
'/control-center',
|
||||||
enablePreferences: overrides.app?.enablePreferences ?? true,
|
enablePreferences: overrides.app?.enablePreferences ?? true,
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const defaultPreferences: Preferences = {
|
|||||||
contentPaddingTop: 0,
|
contentPaddingTop: 0,
|
||||||
defaultAvatar:
|
defaultAvatar:
|
||||||
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp',
|
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp',
|
||||||
defaultHomePath: '/page-render/main_home',
|
defaultHomePath: '/control-center',
|
||||||
dynamicTitle: true,
|
dynamicTitle: true,
|
||||||
enableCheckUpdates: true,
|
enableCheckUpdates: true,
|
||||||
enablePreferences: true,
|
enablePreferences: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user