/** * @name umi 的路由配置(静态路由 — 编译期) * * 重要约定: * - `path` + `component` 必须编译期可解析(component 是 src/pages 下的相对路径)。 * - **path 必须与后端 /menu/all 返回的完整路径一致**(含父级前缀),否则点击侧边栏菜单会 404。 * 后端菜单结构详见:build-flow.api/src/modules/platform/Application/Menus/Handlers/GetAllMenusQueryHandler.cs * - 菜单的显示文案/title/icon 由后端 menu/all 覆盖,这里 name 仅作 i18n fallback。 * * @doc https://umijs.org/docs/guides/routes */ export default [ // ====================== 登录/注册(不走 BasicLayout) ====================== { path: '/user', layout: false, routes: [ { path: '/user/login', name: 'login', component: './user/login' }, { path: '/user', redirect: '/user/login' }, { name: 'register-result', path: '/user/register-result', component: './user/register-result', }, { name: 'register', path: '/user/register', component: './user/register', }, { name: '404', component: './exception/404', path: '/user/*' }, ], }, // ====================== 概览 /dashboard ====================== // 后端菜单:/dashboard → 重定向到 /dashboard/workspace { path: '/dashboard', redirect: '/dashboard/workspace', }, { path: '/dashboard/workspace', name: 'workbench', component: './Welcome', }, { path: '/dashboard/analytics', name: 'analytics', component: './Analytics', }, // ====================== 文件管理 /files ====================== { path: '/files', redirect: '/files/list' }, { path: '/files/list', name: 'file-list', component: './FileManager' }, // ====================== 知识库 /ai ====================== { path: '/ai', redirect: '/ai/chat' }, { path: '/ai/chat', name: 'ai-chat', component: './AIChat' }, { path: '/ai/knowledge', name: 'knowledge', component: './Knowledge' }, { path: '/ai/documents', name: 'document', component: './Document' }, { path: '/ai/models', name: 'models', component: './Analytics' }, // 暂时复用,待独立 Models 页 // ====================== 即时通讯 /im ====================== { path: '/im', redirect: '/im/chat' }, { path: '/im/chat', name: 'im-chat', component: './Im' }, // ====================== 流程管理 /workflow ====================== { path: '/workflow', redirect: '/workflow/list' }, { path: '/workflow/tasks', name: 'workflow-tasks', component: './Workflow' }, { path: '/workflow/list', name: 'workflow-list', component: './Workflow' }, { path: '/workflow/designer/:id', name: 'workflow-designer', component: './Workflow/Designer', }, // ====================== 平台管理 /system ====================== { path: '/system', redirect: '/system/user' }, { path: '/system/user', name: 'sys-user', component: './User' }, { path: '/system/role', name: 'sys-role', component: './Role' }, { path: '/system/permission', name: 'sys-permission', component: './Permission', }, { path: '/system/menu', name: 'sys-menu', component: './Menu' }, { path: '/system/storage', name: 'sys-storage', component: './Storage' }, // ====================== BuildFlow 应用 /buildflow ====================== { path: '/buildflow', redirect: '/buildflow/forms' }, { path: '/buildflow/forms', name: 'bf-forms', component: './FormList' }, { path: '/buildflow/buttons', name: 'bf-buttons', component: './Button', }, { path: '/buildflow/components', name: 'bf-components', component: './Button', // 暂时复用,待独立 }, // ====================== 脚本函数 /scripts ====================== { path: '/scripts', name: 'scripts', component: './Function', }, // ====================== 监控中心 /monitoring ====================== { path: '/monitoring', redirect: '/monitoring/systems', }, { path: '/monitoring/systems', name: 'monitoring-systems', component: './Storage', // 暂时复用 }, { path: '/monitoring/detail/:systemId', name: 'monitoring-detail', component: './Storage', // 暂时复用 }, // ====================== 旧路径兼容(用户直接输入老路径时) ====================== { path: '/welcome', redirect: '/dashboard/workspace' }, // ====================== 根路径 → 默认首页 ====================== { path: '/', redirect: '/dashboard/workspace' }, // ====================== 404 兜底 ====================== { component: './exception/404', layout: false, path: '*' }, ];