Replace online dev home with control center

This commit is contained in:
2026-06-11 08:51:32 +08:00
parent 86680ad7f8
commit 87a01d70fb
7 changed files with 247 additions and 11 deletions
+1 -1
View File
@@ -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: {
+3 -3
View File
@@ -79,8 +79,8 @@ function normalizeBackendRoute<
if (route.name !== 'ControlCenter') return route;
const normalized = { ...route };
normalized.path = '/page-render/main_home';
normalized.component = 'online-dev/page-render/index';
normalized.path = '/control-center';
normalized.component = '_core/control-center/index';
normalized.query = undefined;
return normalized;
}
@@ -138,6 +138,7 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
'../views/_core/announcement/index.vue',
'../views/_core/announcement/list.vue',
'../views/_core/authentication/login.vue',
'../views/_core/control-center/index.vue',
'../views/_core/authentication/oauth-callback.vue',
'../views/_core/fallback/**/*.vue',
'../views/_core/file-preview/index.vue',
@@ -155,7 +156,6 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
'../views/ai-platform/workflow/editor/index.vue',
'../views/ai-platform/workflow/index.vue',
'../views/ai-platform/workflow-runs/index.vue',
'../views/online-dev/page-render/index.vue',
]);
const layoutMap: ComponentRecordType = {
+1 -1
View File
@@ -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
@@ -1,6 +1,21 @@
import type { RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
meta: {
hideInMenu: true,
title: '控制中心',
},
name: 'ControlCenterStatic',
path: '/control-center',
component: () => import('#/views/_core/control-center/index.vue'),
},
{
meta: { hideInMenu: true },
name: 'LegacyMainHomeRedirect',
path: '/page-render/main_home',
redirect: '/control-center',
},
{
meta: { hideInMenu: true },
name: 'AIKnowledgeLegacyRedirect',
@@ -0,0 +1,222 @@
<script lang="ts" setup>
import type { DashboardConfig, DashboardWidget } from '#/components/dashboard-design';
import { ElScrollbar } from 'element-plus';
import DashboardRenderer from '#/components/dashboard-design/DashboardRenderer.vue';
defineOptions({ name: 'ControlCenter' });
type QuickLink = null | {
bgColor: string;
icon: string;
id: string;
path: string;
title: string;
};
const AI_LINKS: QuickLink[] = [
{
bgColor: '',
icon: 'lucide:square-user',
id: 'ai-agent',
path: '/ai-platform/agent',
title: '智能体',
},
{
bgColor: '',
icon: 'lucide:workflow',
id: 'ai-workflow',
path: '/ai-platform/workflow',
title: '流程编排',
},
{
bgColor: '',
icon: 'lucide:library-big',
id: 'ai-knowledge',
path: '/ai-platform/knowledge-base',
title: '知识库',
},
{
bgColor: '',
icon: 'lucide:settings',
id: 'ai-model',
path: '/ai-platform/model',
title: '模型配置',
},
{
bgColor: '',
icon: 'lucide:code',
id: 'codex',
path: '/agent-chat/codex',
title: 'Codex',
},
null,
];
const ADMIN_LINKS: QuickLink[] = [
{
bgColor: '',
icon: 'lucide:users',
id: 'system-user',
path: '/system/user',
title: '用户管理',
},
{
bgColor: '',
icon: 'lucide:shield-check',
id: 'system-role',
path: '/system/role',
title: '角色权限',
},
{
bgColor: '',
icon: 'lucide:key-round',
id: 'system-permission',
path: '/system/new-permission',
title: '权限管理',
},
{
bgColor: '',
icon: 'lucide:menu',
id: 'system-menu',
path: '/system/menu',
title: '菜单管理',
},
{
bgColor: '',
icon: 'lucide:megaphone',
id: 'announcement',
path: '/message/announcement',
title: '公告管理',
},
{
bgColor: '',
icon: 'lucide:message-square-text',
id: 'message-list',
path: '/message/list',
title: '消息中心',
},
];
function widget(
id: string,
type: DashboardWidget['type'],
layout: Pick<DashboardWidget, 'h' | 'w' | 'x' | 'y'>,
props: Record<string, any>,
): DashboardWidget {
return {
id,
i: id,
type,
...layout,
props,
style: {
borderRadius: 8,
padding: 0,
shadowEnabled: true,
},
};
}
const dashboardConfig: DashboardConfig = {
id: 'control-center',
name: '控制中心',
columns: 12,
rowHeight: 90,
margin: [12, 12],
showOuterMargin: false,
widgets: [
widget(
'welcome',
'welcome-card',
{ x: 0, y: 0, w: 8, h: 1 },
{
title: '欢迎回来罗',
subtitle: '今天是个好日子',
showTime: true,
},
),
widget(
'weather',
'weather',
{ x: 8, y: 0, w: 4, h: 1 },
{
title: '今日天气',
latitude: 39.9042,
longitude: 116.4074,
cityName: '北京',
refreshInterval: 600_000,
},
),
widget(
'ai-links',
'quick-links',
{ x: 0, y: 1, w: 4, h: 2 },
{
title: 'AI 协作',
columns: 3,
rows: 2,
menus: AI_LINKS,
},
),
widget(
'admin-links',
'quick-links',
{ x: 4, y: 1, w: 4, h: 2 },
{
title: '基础管理',
columns: 3,
rows: 2,
menus: ADMIN_LINKS,
},
),
widget(
'announcements',
'announcement-list',
{ x: 8, y: 1, w: 4, h: 2 },
{
title: '最新公告',
limit: 5,
},
),
widget(
'server-monitor',
'server-monitor',
{ x: 0, y: 3, w: 8, h: 2 },
{
title: '服务器信息',
refreshInterval: 5000,
},
),
widget(
'messages',
'notice-list',
{ x: 8, y: 3, w: 4, h: 2 },
{
title: '消息通知',
limit: 5,
},
),
widget(
'quick-links',
'quick-links',
{ x: 0, y: 5, w: 4, h: 2 },
{
title: '快捷入口',
columns: 3,
rows: 2,
menus: AI_LINKS,
},
),
],
};
</script>
<template>
<ElScrollbar class="rounded-[8px] py-3">
<div class="h-[calc(100vh-120px)] rounded-[8px] px-3">
<DashboardRenderer :config="dashboardConfig" />
</div>
</ElScrollbar>
</template>
@@ -99,6 +99,7 @@ const componentKeys: string[] = Object.keys(
'../../../_core/announcement/list.vue',
'../../../_core/authentication/login.vue',
'../../../_core/authentication/oauth-callback.vue',
'../../../_core/control-center/index.vue',
'../../../_core/fallback/**/*.vue',
'../../../_core/menu/index.vue',
'../../../_core/permission/index.vue',
@@ -113,15 +114,13 @@ const componentKeys: string[] = Object.keys(
'../../../ai-platform/workflow/editor/index.vue',
'../../../ai-platform/workflow/index.vue',
'../../../ai-platform/workflow-runs/index.vue',
'../../../online-dev/page-render/index.vue',
]),
)
.filter((item) => !item.includes('/modules/'))
.map((v) => {
const path = v
.replace('../../../_core/', '/_core/')
.replace('../../../ai-platform/', '/ai-platform/')
.replace('../../../online-dev/', '/online-dev/');
.replace('../../../ai-platform/', '/ai-platform/');
return path.endsWith('.vue') ? path.slice(0, -4) : path;
});
@@ -53,7 +53,7 @@ const appDynamicTitle = ref(true);
const appWatermark = ref(false);
const appWatermarkContent = ref('');
const appEnableCheckUpdates = ref(true);
const appDefaultHomePath = ref('/page-render/main_home');
const appDefaultHomePath = ref('/control-center');
const appEnablePreferences = ref(true);
const footerEnable = ref(true);
@@ -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: {
@@ -233,7 +233,7 @@ async function loadConfig() {
// 获取带子应用前缀的首页路径
function getDefaultHomePathWithPrefix(): string {
const path = appDefaultHomePath.value || '/page-render/main_home';
const path = appDefaultHomePath.value || '/control-center';
const appCode = appContextStore.appCode;
// 如果是子应用模式且路径不包含子应用前缀,自动添加
if (appCode && !path.startsWith(`/app/${appCode}`)) {