前端重构

This commit is contained in:
Yvan
2026-01-08 11:20:29 +08:00
parent d76655a30a
commit f12f2e0f00
201 changed files with 27517 additions and 537 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ export default defineConfig({
mock: {
include: ["mock/**/*", "src/pages/**/_mock.ts"],
},
utoopack: {},
// utoopack: {},
requestRecord: {},
exportStatic: {},
define: {
+30 -8
View File
@@ -1,28 +1,50 @@
import type { ProLayoutProps } from '@ant-design/pro-components';
/**
* @name
* KRA - Default Settings
* 默认布局配置
*/
const Settings: ProLayoutProps & {
pwa?: boolean;
logo?: string;
} = {
navTheme: 'light',
// 拂晓蓝
// 主题色 - 拂晓蓝
colorPrimary: '#1890ff',
// 布局模式: side | top | mix
layout: 'mix',
// 内容宽度: Fluid | Fixed
contentWidth: 'Fluid',
fixedHeader: false,
// 固定头部
fixedHeader: true,
// 固定侧边栏
fixSiderbar: true,
// 色弱模式
colorWeak: false,
title: 'Ant Design Pro',
pwa: true,
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
// 标题
title: 'Kratos Admin',
// PWA
pwa: false,
// Logo
logo: '/logo.svg',
// 图标字体
iconfontUrl: '',
// Token 配置
token: {
// 参见ts声明,demo 见文档,通过token 修改样式
//https://procomponents.ant.design/components/layout#%E9%80%9A%E8%BF%87-token-%E4%BF%AE%E6%94%B9%E6%A0%B7%E5%BC%8F
// 侧边栏背景色
sider: {
colorMenuBackground: '#fff',
colorTextMenu: 'rgba(0, 0, 0, 0.65)',
colorTextMenuSelected: '#1890ff',
colorBgMenuItemSelected: '#e6f7ff',
},
},
// 分割菜单
splitMenus: false,
// 页脚渲染
footerRender: true,
// 菜单头部渲染
menuHeaderRender: true,
};
export default Settings;
+239 -31
View File
@@ -1,47 +1,255 @@
/**
* KRA - 路由配置
* 对应 GVA 的路由结构
* @name umi 的路由配置
* @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
* @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
* @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
* @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
* @param redirect 配置路由跳转
* @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
* @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题
* @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
* @doc https://umijs.org/docs/guides/routes
*/
export default [
// 用户相关(无布局)
{
path: "/user",
path: '/user',
layout: false,
routes: [
{
name: "login",
path: "/user/login",
component: "./user/login",
name: 'login',
path: '/user/login',
component: './user/login',
},
],
},
// 数据库初始化(无布局)
{
path: "/welcome",
name: "welcome",
icon: "smile",
component: "./Welcome",
},
{
name: "admin",
icon: "crown",
path: "/admins",
access: "canAdmin",
component: "./admins",
},
{
path: "/",
redirect: "/welcome",
},
{
component: "404",
path: '/init',
layout: false,
path: "./*",
component: './init',
},
// 错误页面(无布局)
{
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' },
],
},
// 仪表盘
{
path: '/dashboard',
name: 'dashboard',
icon: 'dashboard',
component: './dashboard',
},
// 超级管理员 - 用户管理
{
path: '/admin',
name: 'superAdmin',
icon: 'crown',
access: 'isAdmin',
routes: [
{
path: '/admin/user',
name: 'user',
icon: 'user',
component: './system/user',
},
{
path: '/admin/authority',
name: 'authority',
icon: 'team',
component: './system/authority',
},
{
path: '/admin/menu',
name: 'menu',
icon: 'menu',
component: './system/menu',
},
{
path: '/admin/api',
name: 'api',
icon: 'api',
component: './system/api',
},
{
path: '/admin/operation',
name: 'operation',
icon: 'fileSearch',
component: './system/operation',
},
{
path: '/admin/dictionary',
name: 'dictionary',
icon: 'book',
component: './system/dictionary',
},
{
path: '/admin/dictionary/detail/:id',
name: 'dictionaryDetail',
component: './system/dictionary/detail',
hideInMenu: true,
},
{
path: '/admin/params',
name: 'params',
icon: 'setting',
component: './system/params',
},
],
},
// 系统工具
{
path: '/systemTools',
name: 'systemTools',
icon: 'tool',
access: 'isAdmin',
routes: [
{
path: '/systemTools/system',
name: 'system',
icon: 'setting',
component: './systemTools/system',
},
{
path: '/systemTools/version',
name: 'version',
icon: 'info-circle',
component: './systemTools/version',
},
{
path: '/systemTools/sysError',
name: 'sysError',
icon: 'warning',
component: './systemTools/sysError',
},
{
path: '/systemTools/autoCode',
name: 'autoCode',
icon: 'code',
component: './systemTools/autoCode',
},
{
path: '/systemTools/autoCodeAdmin',
name: 'autoCodeAdmin',
icon: 'database',
component: './systemTools/autoCodeAdmin',
},
{
path: '/systemTools/exportTemplate',
name: 'exportTemplate',
icon: 'export',
component: './systemTools/exportTemplate',
},
{
path: '/systemTools/formCreate',
name: 'formCreate',
icon: 'form',
component: './systemTools/formCreate',
},
{
path: '/systemTools/installPlugin',
name: 'installPlugin',
icon: 'appstore-add',
component: './systemTools/installPlugin',
},
{
path: '/systemTools/pubPlug',
name: 'pubPlug',
icon: 'cloud-upload',
component: './systemTools/pubPlug',
},
],
},
// 插件
{
path: '/plugin',
name: 'plugin',
icon: 'appstore',
routes: [
{
path: '/plugin/announcement',
name: 'announcement',
icon: 'notification',
component: './plugin/announcement',
},
{
path: '/plugin/email',
name: 'email',
icon: 'mail',
component: './plugin/email',
},
],
},
// 示例
{
path: '/example',
name: 'example',
icon: 'experiment',
routes: [
{
path: '/example/customer',
name: 'customer',
icon: 'contacts',
component: './example/customer',
},
{
path: '/example/upload',
name: 'upload',
icon: 'upload',
component: './example/upload',
},
{
path: '/example/upload/scan',
name: 'scanUpload',
icon: 'scan',
component: './example/upload/scanUpload',
hideInMenu: true,
},
{
path: '/example/breakpoint',
name: 'breakpoint',
icon: 'cloud-upload',
component: './example/breakpoint',
},
],
},
// 个人中心
{
path: '/person',
name: 'person',
icon: 'user',
component: './person',
hideInMenu: true,
},
// 关于
{
path: '/about',
name: 'about',
icon: 'info-circle',
component: './about',
},
// 默认重定向
{
path: '/',
redirect: '/dashboard',
},
// 404
{
path: '*',
layout: false,
component: './error/404',
},
];