You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
520 lines
15 KiB
520 lines
15 KiB
import { IConfig, IPlugin } from 'umi-types';
|
|
import defaultSettings from './defaultSettings'; // https://umijs.org/config/
|
|
|
|
// import path from 'path';
|
|
import slash from 'slash2';
|
|
import webpackPlugin from './plugin.config';
|
|
const { pwa, primaryColor } = defaultSettings; // preview.pro.ant.design only do not use in your production ;
|
|
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
|
|
|
const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
|
|
const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
|
|
const plugins: IPlugin[] = [
|
|
[
|
|
'umi-plugin-react',
|
|
{
|
|
antd: true,
|
|
dva: {
|
|
hmr: true,
|
|
},
|
|
locale: {
|
|
// default false
|
|
enable: true,
|
|
// default zh-CN
|
|
default: 'zh-CN',
|
|
// default true, when it is true, will use `navigator.language` overwrite default
|
|
baseNavigator: true,
|
|
},
|
|
// dynamicImport: {
|
|
// loadingComponent: './components/PageLoading/index',
|
|
// webpackChunkName: true,
|
|
// level: 3,
|
|
// },
|
|
pwa: pwa
|
|
? {
|
|
workboxPluginMode: 'InjectManifest',
|
|
workboxOptions: {
|
|
importWorkboxFrom: 'local',
|
|
},
|
|
}
|
|
: false, // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665
|
|
// dll features https://webpack.js.org/plugins/dll-plugin/
|
|
// dll: {
|
|
// include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
|
|
// exclude: ['@babel/runtime', 'netlify-lambda'],
|
|
// },
|
|
},
|
|
],
|
|
[
|
|
'umi-plugin-pro-block',
|
|
{
|
|
moveMock: false,
|
|
moveService: false,
|
|
modifyRequest: true,
|
|
autoAddMenu: true,
|
|
},
|
|
],
|
|
]; // 针对 preview.pro.ant.design 的 GA 统计代码
|
|
|
|
if (isAntDesignProPreview) {
|
|
plugins.push([
|
|
'umi-plugin-ga',
|
|
{
|
|
code: 'UA-72788897-6',
|
|
},
|
|
]);
|
|
plugins.push([
|
|
'umi-plugin-pro',
|
|
{
|
|
serverUrl: 'https://ant-design-pro.netlify.com',
|
|
},
|
|
]);
|
|
}
|
|
export default ({
|
|
plugins,
|
|
block: {
|
|
// 国内用户可以使用码云
|
|
// defaultGitUrl: 'https://gitee.com/ant-design/pro-blocks',
|
|
defaultGitUrl: 'https://github.com/ant-design/pro-blocks',
|
|
},
|
|
base: '/',
|
|
publicPath: './',
|
|
manifest: {
|
|
basePath: './',
|
|
},
|
|
hash: true,
|
|
targets: {
|
|
ie: 11,
|
|
},
|
|
devtool: isAntDesignProPreview ? 'source-map' : false,
|
|
history: 'hash',
|
|
// base:publicPath,
|
|
// publicPath:publicPath,
|
|
proxy: {
|
|
'/base': {
|
|
// "target": "http://222.168.49.126:59996",
|
|
//"target": "http://10.10.22.26:9976",
|
|
target: 'http://10.10.14.187',
|
|
changeOrigin: true,
|
|
},
|
|
'/bigdata': {
|
|
// "target": "http://222.168.49.126:59996",
|
|
//"target": "http://10.10.22.26:9976",
|
|
target: 'http://10.10.14.187',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
/*
|
|
alias: {
|
|
'@ant-design/icons/lib/dist$': path.resolve(__dirname, '../src/icons.ts')
|
|
},*/
|
|
// umi routes: https://umijs.org/zh/guide/router.html
|
|
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: '/index',
|
|
},
|
|
// {
|
|
// name: 'hello',
|
|
// path: '/hello',
|
|
// component: './Hello',
|
|
// },
|
|
{
|
|
name: 'index',
|
|
path: '/index',
|
|
component: './index',
|
|
},
|
|
{
|
|
name: 'ceshi',
|
|
path: '/ceshi',
|
|
// icon: 'profile',
|
|
routes: [
|
|
{
|
|
name: 'demo',
|
|
path: '/ceshi/demo',
|
|
component: './ceshi/demo1.js',
|
|
},
|
|
]
|
|
},
|
|
{
|
|
name: 'dashboard',
|
|
path: '/dashboard',
|
|
icon: 'dashboard',
|
|
hideInMenu: true,
|
|
routes: [
|
|
{
|
|
name: 'monitors',
|
|
path: '/dashboard/workplace/analysis/monitor/:id',
|
|
component: './dashboard/monitor',
|
|
},
|
|
{
|
|
name: 'workplace',
|
|
path: '/dashboard/workplace',
|
|
component: './dashboard/workplace',
|
|
},
|
|
{
|
|
name: 'analysis',
|
|
path: '/dashboard/analysis',
|
|
component: './dashboard/analysis',
|
|
},
|
|
{
|
|
name: 'analysiss',
|
|
path: '/dashboard/workplace/analysis/:code',
|
|
component: './dashboard/analysis',
|
|
},
|
|
{
|
|
name: 'analysiss',
|
|
path: '/dashboard/workplace/analysis/:code/:num',
|
|
component: './dashboard/analysis',
|
|
},
|
|
{
|
|
name: 'monitor',
|
|
path: '/dashboard/monitor',
|
|
component: './dashboard/monitor',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
// 机构信息管理
|
|
name: 'organization',
|
|
path: '/organization',
|
|
icon: 'code-sandbox',
|
|
routes: [
|
|
{
|
|
// 教育局信息管理
|
|
name: 'bureau',
|
|
path: '/organization/bureau',
|
|
component: './organization/bureau',
|
|
},
|
|
{
|
|
// 教育局信息管理
|
|
name: 'bureau',
|
|
path: '/organization/bureau/:code',
|
|
component: './organization/bureau',
|
|
},
|
|
{
|
|
// 教职工管理
|
|
name: 'teacher',
|
|
path: '/organization/bureau/teacher/:id',
|
|
component: './organization/school/teacher',
|
|
},
|
|
{
|
|
// 未激活教育局列表
|
|
name: 'disableEdu',
|
|
path: '/organization/bureau/disableEdu/:id',
|
|
component: './organization/bureau/disableEdu',
|
|
hideInMenu: true,
|
|
},
|
|
{
|
|
// 部门管理
|
|
name: 'branch',
|
|
path: '/organization/bureau/department/:id',
|
|
component: './organization/school/branch',
|
|
hideInMenu: true,
|
|
},
|
|
{
|
|
// 教辅单位管理
|
|
name: 'effect',
|
|
path: '/organization/effect',
|
|
component: './organization/effect',
|
|
hideInMenu: false,
|
|
},
|
|
{
|
|
// 教辅单位管理
|
|
name: 'effect',
|
|
path: '/organization/effect/:code',
|
|
component: './organization/effect',
|
|
hideInMenu: false,
|
|
},
|
|
{
|
|
// 教职工管理
|
|
name: 'teacher',
|
|
path: '/organization/effect/teacher/:id',
|
|
component: './organization/school/teacher',
|
|
},
|
|
{
|
|
// 部门管理
|
|
name: 'branch',
|
|
path: '/organization/effect/branch/:id',
|
|
component: './organization/school/branch',
|
|
},
|
|
{
|
|
// 学校管理
|
|
name: 'school',
|
|
path: '/organization/school',
|
|
component: './organization/school',
|
|
},
|
|
{
|
|
// 学校管理
|
|
name: 'school',
|
|
path: '/organization/school/:code',
|
|
component: './organization/school',
|
|
},
|
|
{
|
|
// 教职工管理
|
|
name: 'teacher',
|
|
path: '/organization/school/teacher/:id',
|
|
component: './organization/school/teacher',
|
|
},
|
|
{
|
|
// 班级管理
|
|
name: 'class',
|
|
path: '/organization/school/class/:id',
|
|
component: './organization/school/class',
|
|
hideInMenu: true,
|
|
},
|
|
{
|
|
// 学生管理
|
|
name: 'student',
|
|
path: '/organization/school/student/:id',
|
|
component: './organization/school/student',
|
|
},
|
|
{
|
|
// 部门管理
|
|
name: 'branch',
|
|
path: '/organization/school/branch/:id',
|
|
component: './organization/school/branch',
|
|
},
|
|
{
|
|
// 教职工管理
|
|
name: 'teacher',
|
|
path: '/organization/teacher',
|
|
component: './organization/school/teacher',
|
|
},
|
|
{
|
|
// 班级管理
|
|
name: 'class',
|
|
path: '/organization/class',
|
|
component: './organization/school/class',
|
|
hideInMenu: true,
|
|
},
|
|
{
|
|
name: 'student',
|
|
path: '/organization/student',
|
|
component: './organization/school/student',
|
|
},
|
|
{
|
|
name: 'branch',
|
|
path: '/organization/branch',
|
|
component: './organization/school/branch',
|
|
},
|
|
{
|
|
name: 'user',
|
|
path: '/organization/user',
|
|
component: './organization/user',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'admin',
|
|
path: '/admin',
|
|
icon: 'deployment-unit',
|
|
routes: [
|
|
{
|
|
name: 'districtAdmin',
|
|
path: '/admin/districtAdmin',
|
|
component: './admin/districtAdmin',
|
|
},
|
|
{
|
|
name: 'cityUnitAdmin',
|
|
path: '/admin/cityUnitAdmin',
|
|
component: './admin/cityUnitAdmin',
|
|
},
|
|
{
|
|
name: 'districtUnitAdmin',
|
|
path: '/admin/districtUnitAdmin',
|
|
component: './admin/districtUnitAdmin',
|
|
},
|
|
|
|
]
|
|
},
|
|
{
|
|
name: 'acquisition',
|
|
path: '/dataAcquisition',
|
|
icon: 'profile',
|
|
routes: [
|
|
{
|
|
name: 'acquisitionMsg',
|
|
path: '/dataAcquisition/acquisition',
|
|
component: './dataAcquisition',
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'redirect',
|
|
path: '/redirect',
|
|
hideInMenu: true,
|
|
component: './redirect',
|
|
},
|
|
{
|
|
name: 'infoManagement',
|
|
path: '/infoManagement',
|
|
icon: 'profile',
|
|
routes: [
|
|
{
|
|
name: 'userPasswordSettings',
|
|
path: '/infoManagement/userPasswordSettings',
|
|
component: './infoManagement/userPasswordSettings',
|
|
},
|
|
{
|
|
name: 'globalInfoManagement',
|
|
path: '/infoManagement/globalInfoManagement',
|
|
component: './infoManagement/globalInfoManagement',
|
|
},
|
|
{
|
|
name: 'position',
|
|
path: '/infoManagement/position',
|
|
component: './infoManagement/position',
|
|
},
|
|
]
|
|
},
|
|
{
|
|
name: 'base',
|
|
path: '/base',
|
|
icon: 'deployment-unit',
|
|
routes: [
|
|
{
|
|
name: 'area',
|
|
path: '/base/area',
|
|
component: './base/area',
|
|
},
|
|
{
|
|
name: 'dict',
|
|
path: '/base/dict',
|
|
component: './base/dict',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'authority',
|
|
path: '/authority',
|
|
icon: 'database',
|
|
routes: [
|
|
{
|
|
name: 'category',
|
|
path: '/authority/category',
|
|
component: './authority/category',
|
|
},
|
|
{
|
|
name: 'permission',
|
|
path: '/authority/permission',
|
|
component: './authority/permission',
|
|
},
|
|
{
|
|
name: 'role',
|
|
path: '/authority/role',
|
|
component: './authority/role',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'system',
|
|
path: '/system',
|
|
icon: 'desktop',
|
|
routes: [
|
|
{
|
|
name: 'list',
|
|
path: '/system/list',
|
|
component: './system/list',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'config',
|
|
path: '/account/',
|
|
icon: 'tool',
|
|
routes: [
|
|
{
|
|
name: 'config',
|
|
path: '/account/',
|
|
component: './account/',
|
|
},
|
|
// {
|
|
// name: 'log',
|
|
// path: '/operation/log',
|
|
// component: './operation/log',
|
|
// },
|
|
],
|
|
},
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
],
|
|
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
|
|
theme: {
|
|
'primary-color': primaryColor,
|
|
},
|
|
define: {
|
|
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
|
|
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '',
|
|
},
|
|
ignoreMomentLocale: true,
|
|
lessLoaderOptions: {
|
|
javascriptEnabled: true,
|
|
},
|
|
disableRedirectHoist: true,
|
|
cssLoaderOptions: {
|
|
modules: true,
|
|
getLocalIdent: (
|
|
context: {
|
|
resourcePath: string;
|
|
},
|
|
_: string,
|
|
localName: string,
|
|
) => {
|
|
if (
|
|
context.resourcePath.includes('node_modules') ||
|
|
context.resourcePath.includes('ant.design.pro.less') ||
|
|
context.resourcePath.includes('global.less')
|
|
) {
|
|
return localName;
|
|
}
|
|
|
|
const match = context.resourcePath.match(/src(.*)/);
|
|
|
|
if (match && match[1]) {
|
|
const antdProPath = match[1].replace('.less', '');
|
|
const arr = slash(antdProPath)
|
|
.split('/')
|
|
.map((a: string) => a.replace(/([A-Z])/g, '-$1'))
|
|
.map((a: string) => a.toLowerCase());
|
|
return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
|
|
}
|
|
|
|
return localName;
|
|
},
|
|
},
|
|
chainWebpack: webpackPlugin,
|
|
} as unknown) as IConfig;
|