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.
280 lines
7.9 KiB
280 lines
7.9 KiB
// https://umijs.org/config/
|
|
import { defineConfig, utils } from 'umi';
|
|
import defaultSettings from './defaultSettings';
|
|
import proxy from './proxy';
|
|
import webpackPlugin from './plugin.config';
|
|
const { winPath } = utils; // 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, REACT_APP_ENV, GA_KEY } = process.env;
|
|
export default defineConfig({
|
|
hash: true,
|
|
history: { type: 'hash' },
|
|
antd: {
|
|
dark: false,
|
|
compact: false
|
|
},
|
|
analytics: GA_KEY
|
|
? {
|
|
ga: GA_KEY,
|
|
}
|
|
: false,
|
|
dva: {
|
|
hmr: true,
|
|
},
|
|
locale: {
|
|
// default zh-CN
|
|
default: 'zh-CN',
|
|
// default true, when it is true, will use `navigator.language` overwrite default
|
|
antd: true,
|
|
baseNavigator: true,
|
|
|
|
},
|
|
dynamicImport: {
|
|
loading: '@/components/PageLoading/index',
|
|
},
|
|
targets: {
|
|
ie: 11,
|
|
},
|
|
proxy: {
|
|
'/IoTCenter': {
|
|
// "target": "http://222.168.49.126:59996",
|
|
target: "https://iot.edusoa.com",
|
|
// target: 'http://221.194.113.154:8100',
|
|
changeOrigin: true,
|
|
"secure": false, //配置关闭证书签名验证 跳过https证书验证
|
|
},
|
|
'/platform': {
|
|
// "target": "http://222.168.49.126:59996",
|
|
target: "https://iot.edusoa.com",
|
|
// target: 'http://221.194.113.154:8100',
|
|
changeOrigin: true,
|
|
"secure": false, //配置关闭证书签名验证
|
|
},
|
|
},
|
|
qiankun: {
|
|
master: {},
|
|
},
|
|
// umi routes: https://umijs.org/docs/routing
|
|
routes: [
|
|
{
|
|
path: '/',
|
|
component: '../layouts/BlankLayout',
|
|
routes: [
|
|
// 手动设置微应用路由,(后续需要动态匹配)
|
|
{
|
|
path: '/app1',
|
|
microApp: 'app1',
|
|
settings: { singular: false },
|
|
},
|
|
{
|
|
path:'/cas',
|
|
component: './cas',
|
|
},
|
|
{
|
|
path: '/user',
|
|
component: '../layouts/UserLayout',
|
|
routes: [
|
|
{
|
|
name: 'login',
|
|
icon: 'smile',
|
|
path: '/user/login',
|
|
component: './user/login',
|
|
},
|
|
{
|
|
name: 'register-result',
|
|
icon: 'smile',
|
|
path: '/user/register-result',
|
|
component: './user/register-result',
|
|
},
|
|
{
|
|
name: 'register',
|
|
icon: 'smile',
|
|
path: '/user/register',
|
|
component: './user/register',
|
|
},
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/dashboard',
|
|
component: '../layouts/BasicLayout',
|
|
routes: [
|
|
{
|
|
name: '学校数据',
|
|
icon: 'smile',
|
|
path: '/dashboard/schoolMain',
|
|
component: './dashboard/main/mainState'
|
|
},
|
|
{
|
|
name: '教室管理',
|
|
icon: 'HomeOutlined',
|
|
path: '/dashboard/monitor',
|
|
component: './dashboard/monitor',
|
|
},
|
|
{
|
|
name: '设备管理',
|
|
icon: 'SettingOutlined',
|
|
path: '/dashboard/workplace',
|
|
component: './dashboard/workplace',
|
|
},
|
|
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/',
|
|
component: '../layouts/MainLayout',
|
|
Routes: ['src/pages/Authorized'],
|
|
authority: ['admin', 'user'],
|
|
routes: [
|
|
{
|
|
name: 'data-center',
|
|
icon: 'FundOutlined',
|
|
path: '/main',
|
|
component: './dashboard/main',
|
|
},
|
|
{
|
|
path: '/',
|
|
redirect: '/main',
|
|
},
|
|
]
|
|
},
|
|
|
|
|
|
|
|
// {
|
|
// path: '/dashboard',
|
|
// component: '../layouts/BasicLayout',
|
|
// Routes: ['src/pages/Authorized'],
|
|
// authority: ['admin', 'user'],
|
|
// routes: [
|
|
// {
|
|
// path: '/dashboard',
|
|
// name: 'dashboard',
|
|
// icon: 'dashboard',
|
|
// routes: [
|
|
// {
|
|
// name: '数据中心',
|
|
// icon: 'FundOutlined',
|
|
// path: '/dashboard/main',
|
|
// component: './dashboard/main',
|
|
// },
|
|
// {
|
|
// name: '学校数据',
|
|
// icon: 'FundOutlined',
|
|
// path: '/dashboard/schoolMain',
|
|
// component: './dashboard/main/mainState'
|
|
// },
|
|
// // {
|
|
// // name: 'analysis',
|
|
// // icon: 'smile',
|
|
// // path: '/dashboard/analysis',
|
|
// // component: './dashboard/analysis',
|
|
// // },
|
|
// {
|
|
// name: 'monitor',
|
|
// icon: 'HomeOutlined',
|
|
// path: '/dashboard/monitor',
|
|
// component: './dashboard/monitor',
|
|
// },
|
|
// {
|
|
// name: 'workplace',
|
|
// icon: 'SettingOutlined',
|
|
// path: '/dashboard/workplace',
|
|
// component: './dashboard/workplace',
|
|
// },
|
|
// // {
|
|
// // name: 'classOne',
|
|
// // path: '/dashboard/monitor/classInfoCom',
|
|
// // component: './dashboard/monitor/components/ClassInfoCom',
|
|
// // },
|
|
// // {
|
|
// // name: 'classTwo',
|
|
// // path: '/dashboard/monitor/classInfoComTwo',
|
|
// // component: './dashboard/monitor/components/ClassInfoComTwo',
|
|
// // },
|
|
// ],
|
|
// },
|
|
// /*{
|
|
// path: '/',
|
|
// redirect: '/dashboard/main',
|
|
// },*/
|
|
// {
|
|
// path: '/',
|
|
// redirect: '/dashboard/main',
|
|
// },
|
|
{
|
|
name: 'DEMO',
|
|
icon: 'smile',
|
|
path: '/demo',
|
|
|
|
component: './demo',
|
|
},
|
|
{
|
|
component: './exception/404',
|
|
},
|
|
// ],
|
|
// },
|
|
],
|
|
},
|
|
],
|
|
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
|
|
theme: {
|
|
// ...darkTheme,
|
|
'primary-color': defaultSettings.primaryColor,
|
|
},
|
|
define: {
|
|
REACT_APP_ENV: REACT_APP_ENV || false,
|
|
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
|
|
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION || '', // preview.pro.ant.design only do not use in your production ; preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
|
|
},
|
|
ignoreMomentLocale: true,
|
|
lessLoader: {
|
|
javascriptEnabled: true,
|
|
},
|
|
cssLoader: {
|
|
modules: {
|
|
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 = winPath(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;
|
|
},
|
|
},
|
|
},
|
|
base: '/',
|
|
publicPath: './',
|
|
manifest: {
|
|
basePath: './',
|
|
},
|
|
// proxy: proxy[REACT_APP_ENV || 'dev'],
|
|
chainWebpack: webpackPlugin,
|
|
});
|