import defaultSettings from './defaultSettings'; // https://umijs.org/config/ 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 = [ [ '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', }, hash: true, targets: { ie: 11, }, devtool: isAntDesignProPreview ? 'source-map' : false, // 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: '/welcome', }, { path: '/welcome', name: '首页', component: './Welcome', }, { path: '/building', name: '项目管理', component: '../layouts/BlankLayout', routes: [ { path: '/building/list', name: '项目列表', component: './building/list/index', }, { path: '/building/list/add', name: '', // 项目添加 component: './building/list/add/index', }, { path: '/building/type', name: '项目类型', component: './building/type/index', }, { path: '/building/type/edi', name: '', component: './building/type/edi', }, ], }, { path: '/customer', name: '客户管理', component: '../layouts/BlankLayout', routes: [ { path: '/customer/customerlist/list', name: '客户列表', component: './customer/customerlist/index', }, { path: '/customer/customerlist/customerDetail', name: '', component: './customer/customerlist/customerDetail', }, { path: '/customer/drift/list', name: '游客列表', component: './customer/drift/index', }, { path: '/customer/report/list', name: '报备客户', component: './customer/report/index', }, { path: '/customer/recommendCustomer/list', name: '推荐客户', component: './customer/recommendCustomer/index', }, { path: '/customer/recommendCustomer/audit', name: '', //审核 component: './customer/recommendCustomer/audit', }, { path: '/customer/independentList', name: '经纪人', component: './customer/independentList/index', }, ], }, { path: '/integralMall', name: '积分商城', component: '../layouts/BlankLayout', routes: [ { path: '/integralMall/GoodsList', name: '商品列表', component: './integralMall/GoodsList', }, { path: '/integralMall/achieve', name: '积分获取', component: './integralMall/achieve', }, { path: '/integralMall/editGoods', name: '', component: './integralMall/editGoods', }, { path: '/integralMall/exchangeRecords', name: '兑换记录', component: './integralMall/exchangeRecords', }, { path: '/integralMall/writeOff', name: '商品核销', component: './integralMall/writeOff', }, { path: '/integralMall/verifyList', name: '', component: './integralMall/verifyList', }, ], }, { path: '/channel', name: '渠道管理', component: '../layouts/BlankLayout', routes: [ { path: '/channel/channelList', name: '渠道管理', component: './channel/channelList', }, { path: '/channel/addChannel', name: '', component: './channel/addChannel', }, { path: '/channel/editChannel', name: '', component: './channel/editChannel', }, { path: '/channel/brokerList', name: '经纪人', component: './channel/brokerList', }, { path: '/channel/recommendClients', name: '', component: './channel/recommendClients', }, { path: '/channel/InviteClients', name: '', component: './channel/InviteClients', }, ], }, { path: '/news', name: '资讯管理', component: '../layouts/BlankLayout', routes: [ { path: '/news/type/NewsType', name: '资讯类型', component: './news/type/NewsType', }, { path: '/news/type/editNews', name: '', component: './news/type/editNews', }, { path: '/news/list/NewsList', name: '资讯列表', component: './news/list/NewsList', }, { path: '/news/list/editNewsList', name: '', component: './news/list/editNewsList', }, ], }, { path: '/activity', name: '活动管理', component: '../layouts/BlankLayout', routes: [ { path: '/activity/ActivityList', name: '活动列表', component: './activity/ActivityList', }, { path: '/activity/editActivity', name: '', component: './activity/editActivity', }, { path: '/activity/SignList', name: '', component: './activity/SignList', }, ], }, { path: '/staff', name: '员工管理', component: '../layouts/BlankLayout', routes: [ { path: '/staff/StaffList', name: '员工列表', component: './staff/list/StaffList', }, { path: '/staff/editStaff', name: '', component: './staff/list/editStaff', }, { path: '/staff/RoleList', name: '角色管理', component: './staff/list/RoleList', }, { path: '/staff/editRole', name: '', component: './staff/list/editRole', }, ], }, { path: '/carouselFigure', name: '轮播图管理', component: '../layouts/BlankLayout', routes: [ { path: '/carouselFigure/carouselFigureList', name: '轮播图列表', component: './carouselFigure/carouselFigureList', }, { path: '/carouselFigure/editCarousel', name: '', component: './carouselFigure/editCarousel', }, { path: '/carouselFigure/advertisingList', name: '开屏广告', component: './carouselFigure/advertisingList', }, { path: '/carouselFigure/editAdvertising', name: '', component: './carouselFigure/editAdvertising', }, ], }, { path: '/system', name: '系统管理', component: '../layouts/BlankLayout', routes: [ { path: '/system/messageList', name: '客户留言', component: './system/messageList', }, { path: '/system/report', name: '报表数据', component: './system/report', }, { path: '/system/intention', name: '意向值', component: './system/intention', }, { path: '/system/housingPolicy', name: '购房政策维护', component: './system/housingPolicy', }, { path: '/system/editPolicy', name: '', component: './system/editPolicy', }, ], }, { component: './404', }, ], }, { component: './404', }, ], }, { component: './404', }, ], // Theme for antd: https://ant.design/docs/react/customize-theme-cn theme: { 'primary-color': primaryColor, 'btn-primary-bg': '#EF273A', 'table-row-hover-bg': '#eee', 'btn-danger-bg': '#FF7E48', }, define: { 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, lessLoaderOptions: { javascriptEnabled: true, }, disableRedirectHoist: true, cssLoaderOptions: { modules: true, getLocalIdent: (context, _, localName) => { 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 => a.replace(/([A-Z])/g, '-$1')) .map(a => a.toLowerCase()); return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-'); } return localName; }, }, manifest: { basePath: '/', }, chainWebpack: webpackPlugin, proxy: { '/api/': { target: 'http://192.168.0.84:8080/', changeOrigin: true, // pathRewrite: { '^/server': '' }, }, }, };