前端重构

This commit is contained in:
Yvan
2026-01-07 20:00:51 +08:00
parent 3bdf684eae
commit 2eb9ccfff8
4 changed files with 38 additions and 112 deletions
+2 -7
View File
@@ -24,12 +24,6 @@ export default defineConfig({
*/ */
hash: true, hash: true,
/**
* @name esbuild minify IIFE
* @description 解决 esbuild helpers 冲突问题
*/
esbuildMinifyIIFE: true,
publicPath: PUBLIC_PATH, publicPath: PUBLIC_PATH,
/** /**
@@ -89,7 +83,7 @@ export default defineConfig({
* @name layout 插件 * @name layout 插件
* @doc https://umijs.org/docs/max/layout-menu * @doc https://umijs.org/docs/max/layout-menu
*/ */
title: "KRA Admin", title: "Ant Design Pro",
layout: { layout: {
locale: true, locale: true,
...defaultSettings, ...defaultSettings,
@@ -174,6 +168,7 @@ export default defineConfig({
mock: { mock: {
include: ["mock/**/*", "src/pages/**/_mock.ts"], include: ["mock/**/*", "src/pages/**/_mock.ts"],
}, },
utoopack: {},
requestRecord: {}, requestRecord: {},
exportStatic: {}, exportStatic: {},
define: { define: {
+8 -28
View File
@@ -1,47 +1,27 @@
import type { ProLayoutProps } from '@ant-design/pro-components'; import type { ProLayoutProps } from '@ant-design/pro-components';
/** /**
* @name KRA 后台管理系统布局配置 * @name
* @description 参考 GVA 的布局配置,适配 Ant Design Pro
*/ */
const Settings: ProLayoutProps & { const Settings: ProLayoutProps & {
pwa?: boolean; pwa?: boolean;
logo?: string; logo?: string;
showWatermark?: boolean;
} = { } = {
navTheme: 'light', navTheme: 'light',
// 主题色 - 与 GVA 保持一致的蓝色 // 拂晓蓝
colorPrimary: '#3b82f6', colorPrimary: '#1890ff',
// 布局模式: side | top | mix
layout: 'mix', layout: 'mix',
contentWidth: 'Fluid', contentWidth: 'Fluid',
// 固定头部 fixedHeader: false,
fixedHeader: true,
// 固定侧边栏
fixSiderbar: true, fixSiderbar: true,
// 色弱模式
colorWeak: false, colorWeak: false,
// 应用标题 title: 'Ant Design Pro',
title: 'KRA Admin',
pwa: true, pwa: true,
// Logo logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
logo: '/logo.svg',
iconfontUrl: '', iconfontUrl: '',
// 显示水印
showWatermark: true,
// 侧边栏宽度配置
siderWidth: 256,
token: { token: {
// 头部高度 // 参见ts声明,demo 见文档,通过token 修改样式
header: { //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
heightLayoutHeader: 64,
},
// 侧边栏配置
sider: {
colorMenuBackground: '#fff',
colorTextMenuSelected: '#3b82f6',
colorBgMenuItemSelected: '#e6f4ff',
},
}, },
}; };
+2 -3
View File
@@ -15,10 +15,9 @@ export default {
* @doc https://github.com/chimurai/http-proxy-middleware * @doc https://github.com/chimurai/http-proxy-middleware
*/ */
dev: { dev: {
"/api/": { "/v1/": {
target: "http://localhost:8000", target: "http://localhost:8000",
changeOrigin: true, changeOrigin: true,
pathRewrite: { "^/api": "" }, },
}
}, },
}; };
+26 -74
View File
@@ -1,95 +1,47 @@
/** /**
* @name umi 的路由配置 * @name umi 的路由配置
* @description 与 GVA 保持一致的路由结构 * @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 [ export default [
{ {
path: '/user', path: "/user",
layout: false, layout: false,
routes: [ routes: [
{ {
name: 'login', name: "login",
path: '/user/login', path: "/user/login",
component: './user/login', component: "./user/login",
}, },
], ],
}, },
{ {
path: '/dashboard', path: "/welcome",
name: 'dashboard', name: "welcome",
icon: 'dashboard', icon: "smile",
component: './dashboard', component: "./Welcome",
}, },
{ {
path: '/system', name: "admin",
name: 'system', icon: "crown",
icon: 'setting', path: "/admins",
access: 'canAdmin', access: "canAdmin",
routes: [ component: "./admins",
{
path: '/system/user',
name: 'user',
icon: 'user',
component: './system/user',
},
{
path: '/system/authority',
name: 'authority',
icon: 'team',
component: './system/authority',
},
{
path: '/system/menu',
name: 'menu',
icon: 'menu',
component: './system/menu',
},
{
path: '/system/api',
name: 'api',
icon: 'api',
component: './system/api',
},
{
path: '/system/dictionary',
name: 'dictionary',
icon: 'book',
component: './system/dictionary',
},
{
path: '/system/operation',
name: 'operation',
icon: 'fileSearch',
component: './system/operation',
},
{
path: '/system/params',
name: 'params',
icon: 'control',
component: './system/params',
},
{
path: '/system/state',
name: 'state',
icon: 'monitor',
component: './system/state',
},
],
}, },
{ {
path: '/person', path: "/",
name: 'person', redirect: "/welcome",
icon: 'idcard',
component: './person',
hideInMenu: true,
}, },
{ {
path: '/', component: "404",
redirect: '/dashboard',
},
{
path: '*',
layout: false, layout: false,
component: './404', path: "./*",
}, },
]; ];