kra/web/config/routes.ts

160 lines
5.1 KiB
TypeScript

/**
* KRA - 路由配置
* 路由在编译时静态配置,菜单从后端动态获取
* 菜单显示由 app.tsx 中的 menu.request 控制
*/
export default [
// 用户相关(无布局)
{
path: '/user',
layout: false,
routes: [
{
name: '登录',
path: '/user/login',
component: './user/login',
},
],
},
// 数据库初始化(无布局)
{
path: '/init',
name: '初始化',
layout: false,
component: './init',
},
// 扫码上传(无布局,客户端页面)
{
path: '/scanUpload',
name: '扫码上传',
layout: false,
component: './example/upload/scanUpload',
},
// 错误页面(无布局)
{
path: '/error',
layout: false,
routes: [
{ path: '/error/403', component: './error/403' },
{ path: '/error/404', component: './error/404' },
{ path: '/error/500', component: './error/500' },
{ path: '/error/reload', component: './error/reload' },
],
},
// ========== 以下路由在菜单中由后端控制显示 ==========
// 路由必须静态配置,菜单显示由后端 /menu/getMenu 接口控制
// 仪表盘
{
path: '/dashboard',
name: '仪表盘',
component: './dashboard',
hideInMenu: true, // 菜单由后端控制
},
// 超级管理员
{
path: '/admin',
name: '超级管理员',
hideInMenu: true,
routes: [
{ path: '/admin/user', name: '用户管理', component: './system/user' },
{ path: '/admin/authority', name: '角色管理', component: './system/authority' },
{ path: '/admin/menu', name: '菜单管理', component: './system/menu' },
{ path: '/admin/api', name: 'API管理', component: './system/api' },
{ path: '/admin/operation', name: '操作历史', component: './system/operation' },
{ path: '/admin/dictionary', name: '字典管理', component: './system/dictionary' },
{ path: '/admin/dictionary/detail/:id', name: '字典详情', component: './system/dictionary/detail', hideInMenu: true },
{ path: '/admin/sysParams', name: '参数管理', component: './system/params' },
],
},
// 系统工具
{
path: '/systemTools',
name: '系统工具',
hideInMenu: true,
routes: [
{ path: '/systemTools/autoCode', name: '代码生成器', component: './systemTools/autoCode' },
{ path: '/systemTools/autoCodeAdmin', name: '自动化代码管理', component: './systemTools/autoCodeAdmin' },
{ path: '/systemTools/autoCodeEdit/:id', name: '自动化代码编辑', component: './systemTools/autoCode', hideInMenu: true },
{ path: '/systemTools/formCreate', name: '表单生成器', component: './systemTools/formCreate' },
{ path: '/systemTools/system', name: '系统配置', component: './systemTools/system' },
{ path: '/systemTools/autoPkg', name: '模板配置', component: './systemTools/autoPkg' },
{ path: '/systemTools/exportTemplate', name: '导出模板', component: './systemTools/exportTemplate' },
{ path: '/systemTools/picture', name: 'AI页面绘制', component: './systemTools/autoCode/picture' },
{ path: '/systemTools/mcpTool', name: 'Mcp Tools模板', component: './systemTools/autoCode/mcp' },
{ path: '/systemTools/mcpTest', name: 'Mcp Tools测试', component: './systemTools/autoCode/mcpTest' },
{ path: '/systemTools/sysVersion', name: '版本管理', component: './systemTools/version' },
{ path: '/systemTools/sysError', name: '错误日志', component: './systemTools/sysError' },
{ path: '/systemTools/installPlugin', name: '插件安装', component: './systemTools/installPlugin' },
{ path: '/systemTools/pubPlug', name: '打包插件', component: './systemTools/pubPlug' },
],
},
// 插件
{
path: '/plugin',
name: '插件系统',
hideInMenu: true,
routes: [
{ path: '/plugin/installPlugin', name: '插件安装', component: './systemTools/installPlugin' },
{ path: '/plugin/pubPlug', name: '打包插件', component: './systemTools/pubPlug' },
{ path: '/plugin/plugin-email', name: '邮件插件', component: './plugin/email' },
{ path: '/plugin/anInfo', name: '公告管理', component: './plugin/announcement' },
],
},
// 示例
{
path: '/example',
name: '示例文件',
hideInMenu: true,
routes: [
{ path: '/example/customer', name: '客户列表', component: './example/customer' },
{ path: '/example/upload', name: '媒体库', component: './example/upload' },
{ path: '/example/breakpoint', name: '断点续传', component: './example/breakpoint' },
],
},
// 个人中心
{
path: '/person',
name: '个人信息',
component: './person',
hideInMenu: true,
},
// 关于
{
path: '/about',
name: '关于我们',
component: './about',
hideInMenu: true,
},
// 服务器状态
{
path: '/state',
name: '服务器状态',
component: './system/state',
hideInMenu: true,
},
// 默认重定向
{
path: '/',
redirect: '/dashboard',
},
// 404 - 放在最后
{
path: '/*',
component: './error/404',
},
];