建立新的react-web模块,react工程迁移到这个模块

This commit is contained in:
Gao Shan
2022-10-19 21:31:57 +08:00
committed by Gao Shan
parent fcccb31717
commit 5b4f8dec95
102 changed files with 72 additions and 4 deletions
@@ -0,0 +1,15 @@
// https://umijs.org/config/
import { defineConfig } from 'umi';
export default defineConfig({
plugins: [
// https://github.com/zthxxx/react-dev-inspector
'react-dev-inspector/plugins/umi/react-inspector',
],
// https://github.com/zthxxx/react-dev-inspector#inspector-loader-props
inspectorConfig: {
exclude: [],
babelPlugins: [],
babelOptions: {},
},
});
@@ -0,0 +1,80 @@
// https://umijs.org/config/
import { defineConfig } from 'umi';
import { join } from 'path';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';
const { REACT_APP_ENV } = process.env;
export default defineConfig({
hash: true,
publicPath:"./",
antd: {},
dva: {
hmr: true,
},
layout: {
// https://umijs.org/zh-CN/plugins/plugin-layout
locale: false,
siderWidth: 208,
...defaultSettings,
},
// https://umijs.org/zh-CN/plugins/plugin-locale
locale: {
// default zh-CN
default: 'zh-CN',
antd: true,
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true,
},
dynamicImport: {
loading: '@ant-design/pro-layout/es/PageLoading',
},
targets: {
ie: 11,
},
// umi routes: https://umijs.org/docs/routing
routes,
access: {},
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
// 如果不想要 configProvide 动态设置主题需要把这个设置为 default
// 只有设置为 variable, 才能使用 configProvide 动态设置主色调
// https://ant.design/docs/react/customize-theme-variable-cn
'root-entry-name': 'variable',
},
// esbuild is father build tools
// https://umijs.org/plugins/plugin-esbuild
esbuild: {},
title: false,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'],
manifest: {
basePath: '/',
},
// Fast Refresh 热更新
fastRefresh: {},
openAPI: [
{
requestLibPath: "import { request } from 'umi'",
// 或者使用在线的版本
// schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
schemaPath: join(__dirname, 'oneapi.json'),
mock: false,
},
{
requestLibPath: "import { request } from 'umi'",
schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
projectName: 'swagger',
},
],
nodeModulesTransform: { type: 'none' },
mfsu: {},
webpack5: {},
exportStatic: {},
history: {
type: 'hash',
},
});
@@ -0,0 +1,21 @@
import { Settings as LayoutSettings } from '@ant-design/pro-components';
const Settings: LayoutSettings & {
pwa?: boolean;
logo?: string;
} = {
navTheme: 'dark',
// 拂晓蓝
primaryColor: '#1890ff',
layout: 'mix',
contentWidth: 'Fluid',
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: 'Microservices-Platform',
pwa: false,
logo: './logo.png',
iconfontUrl: '',
};
export default Settings;
@@ -0,0 +1,16 @@
{
"openapi": "3.0.1",
"info": {
"title": "zlt-web",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:8000/"
},
{
"url": "https://localhost:8000/"
}
],
"paths": {}
}
@@ -0,0 +1,50 @@
/**
* 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
* -------------------------------
* The agent cannot take effect in the production environment
* so there is no configuration of the production environment
* For details, please see
* https://pro.ant.design/docs/deploy
*/
export default {
dev: {
'/api-uaa/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-user/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-log/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-search/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-generator/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
'/api-file/': {
target: 'http://127.0.0.1:9900',
changeOrigin: true,
},
},
test: {
'/api/': {
target: 'https://proapi.azurewebsites.net',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
pre: {
'/api/': {
target: 'your pre url',
changeOrigin: true,
pathRewrite: { '^': '' },
},
},
};
@@ -0,0 +1,101 @@
export default [
{
path: '/user',
layout: false,
routes: [
{
name: 'login',
path: '/user/login',
component: './user/Login',
},
{
component: './404',
},
],
},
{
path: '/system',
routes: [
{
path: '/system/user.html',
component: './system/User',
},
{
path: '/system/role.html',
component: './system/Role',
},
{
path: '/system/tokens.html',
component: './system/Token',
},
{
path: '/system/menus.html',
component: './system/Menu',
},
{
path: '/system/myInfo.html',
component: './system/UserInfo',
},
],
},
{
path: '/files',
routes: [
{
path: '/files/files.html',
component: './files/File',
}
],
},
{
path: '/search',
routes: [
{
path: '/search/index_manager.html',
component: './search/Index',
},
{
path: '/search/user_search.html',
component: './search/User',
},
],
},
{
path: '/log',
routes: [
{
path: '/log/sysLog.html',
component: './log/SysLog',
},
{
path: '/log/auditLog.html',
component: './log/AuditLog',
},
{
path: '/log/slowQueryLog.html',
component: './log/SlowSqlLog',
},
],
},
{
path: '/attestation/app.html',
component: './system/App',
},
{
path: '/generator/list.html',
component: './system/Generator',
},
{
path: '/welcome',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
{
path: '/',
redirect: '/welcome',
},
{
component: './404',
},
];