diff --git a/config/config.ts b/config/config.ts index 8d93de29..12abaae9 100644 --- a/config/config.ts +++ b/config/config.ts @@ -2,6 +2,7 @@ import { defineConfig } from 'umi'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; +import routes from './routes'; const { REACT_APP_ENV } = process.env; @@ -11,6 +12,9 @@ export default defineConfig({ dva: { hmr: true, }, + history: { + type: 'browser', + }, locale: { // default zh-CN default: 'zh-CN', @@ -25,83 +29,17 @@ export default defineConfig({ ie: 11, }, // umi routes: https://umijs.org/docs/routing - routes: [ - { - path: '/user', - component: '../layouts/UserLayout', - routes: [ - { - name: 'login', - path: '/user/login', - component: './user/login', - }, - ], - }, - { - path: '/', - component: '../layouts/SecurityLayout', - routes: [ - { - path: '/', - component: '../layouts/BasicLayout', - authority: ['admin', 'user'], - routes: [ - { - path: '/', - redirect: '/welcome', - }, - { - path: '/welcome', - name: 'welcome', - icon: 'smile', - component: './Welcome', - }, - { - path: '/admin', - name: 'admin', - icon: 'crown', - component: './Admin', - authority: ['admin'], - routes: [ - { - path: '/admin/sub-page', - name: 'sub-page', - icon: 'smile', - component: './Welcome', - authority: ['admin'], - }, - ], - }, - { - name: 'list.table-list', - icon: 'table', - path: '/list', - component: './ListTableList', - }, - { - component: './404', - }, - ], - }, - { - component: './404', - }, - ], - }, - { - component: './404', - }, - ], + routes, // Theme for antd: https://ant.design/docs/react/customize-theme-cn theme: { - // ...darkTheme, 'primary-color': defaultSettings.primaryColor, }, - // @ts-ignore title: false, ignoreMomentLocale: true, proxy: proxy[REACT_APP_ENV || 'dev'], manifest: { basePath: '/', }, + exportStatic: {}, + esbuild: {}, }); diff --git a/config/routes.ts b/config/routes.ts new file mode 100644 index 00000000..ed0bc96f --- /dev/null +++ b/config/routes.ts @@ -0,0 +1,67 @@ +export default [ + { + path: '/user', + component: '../layouts/UserLayout', + routes: [ + { + name: 'login', + path: '/user/login', + component: './user/login', + }, + ], + }, + { + path: '/', + component: '../layouts/SecurityLayout', + routes: [ + { + path: '/', + component: '../layouts/BasicLayout', + authority: ['admin', 'user'], + routes: [ + { + path: '/', + redirect: '/welcome', + }, + { + path: '/welcome', + name: 'welcome', + icon: 'smile', + component: './Welcome', + }, + { + path: '/admin', + name: 'admin', + icon: 'crown', + component: './Admin', + authority: ['admin'], + routes: [ + { + path: '/admin/sub-page', + name: 'sub-page', + icon: 'smile', + component: './Welcome', + authority: ['admin'], + }, + ], + }, + { + name: 'list.table-list', + icon: 'table', + path: '/list', + component: './ListTableList', + }, + { + component: './404', + }, + ], + }, + { + component: './404', + }, + ], + }, + { + component: './404', + }, +]; diff --git a/package.json b/package.json index fdb93151..d4cf51dc 100644 --- a/package.json +++ b/package.json @@ -55,11 +55,11 @@ "dependencies": { "@ant-design/icons": "^4.0.0", "@ant-design/pro-descriptions": "^1.0.19", - "@ant-design/pro-form": "^1.2.0", - "@ant-design/pro-layout": "^6.4.19", - "@ant-design/pro-table": "^2.9.5", + "@ant-design/pro-form": "^1.3.0", + "@ant-design/pro-layout": "^6.5.0", + "@ant-design/pro-table": "^2.9.16", "@umijs/route-utils": "^1.0.33", - "antd": "^4.7.0", + "antd": "^4.8.0", "classnames": "^2.2.6", "lodash": "^4.17.11", "moment": "^2.25.3", @@ -85,6 +85,7 @@ "@types/react-helmet": "^6.1.0", "@umijs/fabric": "^2.3.0", "@umijs/plugin-blocks": "^2.0.5", + "@umijs/plugin-esbuild": "^1.0.1", "@umijs/preset-ant-design-pro": "^1.2.0", "@umijs/preset-react": "^1.4.8", "@umijs/yorkie": "^2.0.3",