diff --git a/web/config/config.ts b/web/config/config.ts index 417cfa6..1a98ebe 100644 --- a/web/config/config.ts +++ b/web/config/config.ts @@ -24,12 +24,6 @@ export default defineConfig({ */ hash: true, - /** - * @name esbuild minify IIFE - * @description 解决 esbuild helpers 冲突问题 - */ - esbuildMinifyIIFE: true, - publicPath: PUBLIC_PATH, /** @@ -89,7 +83,7 @@ export default defineConfig({ * @name layout 插件 * @doc https://umijs.org/docs/max/layout-menu */ - title: "KRA Admin", + title: "Ant Design Pro", layout: { locale: true, ...defaultSettings, @@ -174,6 +168,7 @@ export default defineConfig({ mock: { include: ["mock/**/*", "src/pages/**/_mock.ts"], }, + utoopack: {}, requestRecord: {}, exportStatic: {}, define: { diff --git a/web/config/defaultSettings.ts b/web/config/defaultSettings.ts index b079a83..6710cad 100644 --- a/web/config/defaultSettings.ts +++ b/web/config/defaultSettings.ts @@ -1,47 +1,27 @@ import type { ProLayoutProps } from '@ant-design/pro-components'; /** - * @name KRA 后台管理系统布局配置 - * @description 参考 GVA 的布局配置,适配 Ant Design Pro + * @name */ const Settings: ProLayoutProps & { pwa?: boolean; logo?: string; - showWatermark?: boolean; } = { navTheme: 'light', - // 主题色 - 与 GVA 保持一致的蓝色 - colorPrimary: '#3b82f6', - // 布局模式: side | top | mix + // 拂晓蓝 + colorPrimary: '#1890ff', layout: 'mix', contentWidth: 'Fluid', - // 固定头部 - fixedHeader: true, - // 固定侧边栏 + fixedHeader: false, fixSiderbar: true, - // 色弱模式 colorWeak: false, - // 应用标题 - title: 'KRA Admin', + title: 'Ant Design Pro', pwa: true, - // Logo - logo: '/logo.svg', + logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', iconfontUrl: '', - // 显示水印 - showWatermark: true, - // 侧边栏宽度配置 - siderWidth: 256, token: { - // 头部高度 - header: { - heightLayoutHeader: 64, - }, - // 侧边栏配置 - sider: { - colorMenuBackground: '#fff', - colorTextMenuSelected: '#3b82f6', - colorBgMenuItemSelected: '#e6f4ff', - }, + // 参见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 }, }; diff --git a/web/config/proxy.ts b/web/config/proxy.ts index 854f271..c7ddc88 100644 --- a/web/config/proxy.ts +++ b/web/config/proxy.ts @@ -15,10 +15,9 @@ export default { * @doc https://github.com/chimurai/http-proxy-middleware */ dev: { - "/api/": { + "/v1/": { target: "http://localhost:8000", changeOrigin: true, - pathRewrite: { "^/api": "" }, - } + }, }, }; diff --git a/web/config/routes.ts b/web/config/routes.ts index b041188..c8fbf91 100644 --- a/web/config/routes.ts +++ b/web/config/routes.ts @@ -1,95 +1,47 @@ /** * @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, 注意去除风格后缀和大小写,如想要配置图标为 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 则取值应为 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: '/dashboard', - name: 'dashboard', - icon: 'dashboard', - component: './dashboard', + path: "/welcome", + name: "welcome", + icon: "smile", + component: "./Welcome", }, { - path: '/system', - name: 'system', - icon: 'setting', - access: 'canAdmin', - routes: [ - { - 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', - }, - ], + name: "admin", + icon: "crown", + path: "/admins", + access: "canAdmin", + component: "./admins", }, { - path: '/person', - name: 'person', - icon: 'idcard', - component: './person', - hideInMenu: true, + path: "/", + redirect: "/welcome", }, { - path: '/', - redirect: '/dashboard', - }, - { - path: '*', + component: "404", layout: false, - component: './404', + path: "./*", }, ];