知与行后台管理端

config.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. import defaultSettings from './defaultSettings'; // https://umijs.org/config/
  2. import slash from 'slash2';
  3. import webpackPlugin from './plugin.config';
  4. const { pwa, primaryColor } = defaultSettings; // preview.pro.ant.design only do not use in your production ;
  5. // preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
  6. const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env;
  7. const isAntDesignProPreview = ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site';
  8. const plugins = [
  9. [
  10. 'umi-plugin-react',
  11. {
  12. antd: true,
  13. dva: {
  14. hmr: true,
  15. },
  16. locale: {
  17. // default false
  18. enable: true,
  19. // default zh-CN
  20. default: 'zh-CN',
  21. // default true, when it is true, will use `navigator.language` overwrite default
  22. baseNavigator: true,
  23. },
  24. dynamicImport: {
  25. loadingComponent: './components/PageLoading/index',
  26. webpackChunkName: true,
  27. level: 3,
  28. },
  29. pwa: pwa
  30. ? {
  31. workboxPluginMode: 'InjectManifest',
  32. workboxOptions: {
  33. importWorkboxFrom: 'local',
  34. },
  35. }
  36. : false, // default close dll, because issue https://github.com/ant-design/ant-design-pro/issues/4665
  37. // dll features https://webpack.js.org/plugins/dll-plugin/
  38. // dll: {
  39. // include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
  40. // exclude: ['@babel/runtime', 'netlify-lambda'],
  41. // },
  42. },
  43. ],
  44. [
  45. 'umi-plugin-pro-block',
  46. {
  47. moveMock: false,
  48. moveService: false,
  49. modifyRequest: true,
  50. autoAddMenu: true,
  51. },
  52. ],
  53. ]; // 针对 preview.pro.ant.design 的 GA 统计代码
  54. if (isAntDesignProPreview) {
  55. plugins.push([
  56. 'umi-plugin-ga',
  57. {
  58. code: 'UA-72788897-6',
  59. },
  60. ]);
  61. plugins.push([
  62. 'umi-plugin-pro',
  63. {
  64. serverUrl: 'https://ant-design-pro.netlify.com',
  65. },
  66. ]);
  67. }
  68. export default {
  69. plugins,
  70. block: {
  71. // 国内用户可以使用码云
  72. // defaultGitUrl: 'https://gitee.com/ant-design/pro-blocks',
  73. defaultGitUrl: 'https://github.com/ant-design/pro-blocks',
  74. },
  75. hash: true,
  76. targets: {
  77. ie: 11,
  78. },
  79. devtool: isAntDesignProPreview ? 'source-map' : false,
  80. // umi routes: https://umijs.org/zh/guide/router.html
  81. routes: [
  82. {
  83. path: '/user',
  84. component: '../layouts/UserLayout',
  85. routes: [
  86. {
  87. name: 'login',
  88. path: '/user/login',
  89. component: './user/login',
  90. },
  91. ],
  92. },
  93. {
  94. path: '/',
  95. component: '../layouts/SecurityLayout',
  96. routes: [
  97. {
  98. path: '/',
  99. component: '../layouts/BasicLayout',
  100. authority: ['admin', 'user'],
  101. routes: [
  102. {
  103. path: '/',
  104. redirect: '/welcome',
  105. },
  106. {
  107. path: '/welcome',
  108. name: '首页',
  109. component: './Welcome',
  110. },
  111. {
  112. path: '/building',
  113. name: '项目管理',
  114. component: '../layouts/BlankLayout',
  115. routes: [
  116. {
  117. path: '/building/list',
  118. name: '项目列表',
  119. component: './building/list/index',
  120. },
  121. {
  122. path: '/building/list/add',
  123. name: '', // 项目添加
  124. component: './building/list/add/index',
  125. },
  126. {
  127. path: '/building/type',
  128. name: '项目类型',
  129. component: './building/type/index',
  130. },
  131. {
  132. path: '/building/type/edi',
  133. name: '',
  134. component: './building/type/edi',
  135. },
  136. ],
  137. },
  138. {
  139. path: '/customer',
  140. name: '客户管理',
  141. component: '../layouts/BlankLayout',
  142. routes: [
  143. {
  144. path: '/customer/customerlist/list',
  145. name: '客户列表',
  146. component: './customer/customerlist/index',
  147. },
  148. {
  149. path: '/customer/customerlist/customerDetail',
  150. name: '',
  151. component: './customer/customerlist/customerDetail',
  152. },
  153. {
  154. path: '/customer/drift/list',
  155. name: '游客列表',
  156. component: './customer/drift/index',
  157. },
  158. {
  159. path: '/customer/report/list',
  160. name: '报备客户',
  161. component: './customer/report/index',
  162. },
  163. {
  164. path: '/customer/recommendCustomer/list',
  165. name: '推荐客户',
  166. component: './customer/recommendCustomer/index',
  167. },
  168. {
  169. path: '/customer/recommendCustomer/audit',
  170. name: '', //审核
  171. component: './customer/recommendCustomer/audit',
  172. },
  173. {
  174. path: '/customer/independentList',
  175. name: '经纪人',
  176. component: './customer/independentList/index',
  177. },
  178. ],
  179. },
  180. {
  181. path: '/integralMall',
  182. name: '积分商城',
  183. component: '../layouts/BlankLayout',
  184. routes: [
  185. {
  186. path: '/integralMall/GoodsList',
  187. name: '商品列表',
  188. component: './integralMall/GoodsList',
  189. },
  190. {
  191. path: '/integralMall/achieve',
  192. name: '积分获取',
  193. component: './integralMall/achieve',
  194. },
  195. {
  196. path: '/integralMall/editGoods',
  197. name: '',
  198. component: './integralMall/editGoods',
  199. },
  200. {
  201. path: '/integralMall/exchangeRecords',
  202. name: '兑换记录',
  203. component: './integralMall/exchangeRecords',
  204. },
  205. {
  206. path: '/integralMall/writeOff',
  207. name: '商品核销',
  208. component: './integralMall/writeOff',
  209. },
  210. {
  211. path: '/integralMall/verifyList',
  212. name: '',
  213. component: './integralMall/verifyList',
  214. },
  215. ],
  216. },
  217. {
  218. path: '/channel',
  219. name: '渠道管理',
  220. component: '../layouts/BlankLayout',
  221. routes: [
  222. {
  223. path: '/channel/channelList',
  224. name: '渠道管理',
  225. component: './channel/channelList',
  226. },
  227. {
  228. path: '/channel/addChannel',
  229. name: '',
  230. component: './channel/addChannel',
  231. },
  232. {
  233. path: '/channel/editChannel',
  234. name: '',
  235. component: './channel/editChannel',
  236. },
  237. {
  238. path: '/channel/brokerList',
  239. name: '经纪人',
  240. component: './channel/brokerList',
  241. },
  242. {
  243. path: '/channel/recommendClients',
  244. name: '',
  245. component: './channel/recommendClients',
  246. },
  247. {
  248. path: '/channel/InviteClients',
  249. name: '',
  250. component: './channel/InviteClients',
  251. },
  252. ],
  253. },
  254. {
  255. path: '/news',
  256. name: '资讯管理',
  257. component: '../layouts/BlankLayout',
  258. routes: [
  259. {
  260. path: '/news/type/NewsType',
  261. name: '资讯类型',
  262. component: './news/type/NewsType',
  263. },
  264. {
  265. path: '/news/type/editNews',
  266. name: '',
  267. component: './news/type/editNews',
  268. },
  269. {
  270. path: '/news/list/NewsList',
  271. name: '资讯列表',
  272. component: './news/list/NewsList',
  273. },
  274. {
  275. path: '/news/list/editNewsList',
  276. name: '',
  277. component: './news/list/editNewsList',
  278. },
  279. ],
  280. },
  281. {
  282. path: '/activity',
  283. name: '活动管理',
  284. component: '../layouts/BlankLayout',
  285. routes: [
  286. {
  287. path: '/activity/ActivityList',
  288. name: '活动列表',
  289. component: './activity/ActivityList',
  290. },
  291. {
  292. path: '/activity/editActivity',
  293. name: '',
  294. component: './activity/editActivity',
  295. },
  296. {
  297. path: '/activity/SignList',
  298. name: '',
  299. component: './activity/SignList',
  300. },
  301. ],
  302. },
  303. {
  304. path: '/staff',
  305. name: '员工管理',
  306. component: '../layouts/BlankLayout',
  307. routes: [
  308. {
  309. path: '/staff/StaffList',
  310. name: '员工列表',
  311. component: './staff/list/StaffList',
  312. },
  313. {
  314. path: '/staff/editStaff',
  315. name: '',
  316. component: './staff/list/editStaff',
  317. },
  318. {
  319. path: '/staff/RoleList',
  320. name: '角色管理',
  321. component: './staff/list/RoleList',
  322. },
  323. {
  324. path: '/staff/editRole',
  325. name: '',
  326. component: './staff/list/editRole',
  327. },
  328. ],
  329. },
  330. {
  331. path: '/carouselFigure',
  332. name: '轮播图管理',
  333. component: '../layouts/BlankLayout',
  334. routes: [
  335. {
  336. path: '/carouselFigure/carouselFigureList',
  337. name: '轮播图列表',
  338. component: './carouselFigure/carouselFigureList',
  339. },
  340. {
  341. path: '/carouselFigure/editCarousel',
  342. name: '',
  343. component: './carouselFigure/editCarousel',
  344. },
  345. {
  346. path: '/carouselFigure/advertisingList',
  347. name: '开屏广告',
  348. component: './carouselFigure/advertisingList',
  349. },
  350. {
  351. path: '/carouselFigure/editAdvertising',
  352. name: '',
  353. component: './carouselFigure/editAdvertising',
  354. },
  355. ],
  356. },
  357. {
  358. path: '/system',
  359. name: '系统管理',
  360. component: '../layouts/BlankLayout',
  361. routes: [
  362. {
  363. path: '/system/messageList',
  364. name: '客户留言',
  365. component: './system/messageList',
  366. },
  367. {
  368. path: '/system/report',
  369. name: '报表数据',
  370. component: './system/report',
  371. },
  372. {
  373. path: '/system/intention',
  374. name: '意向值',
  375. component: './system/intention',
  376. },
  377. {
  378. path: '/system/housingPolicy',
  379. name: '购房政策维护',
  380. component: './system/housingPolicy',
  381. },
  382. {
  383. path: '/system/editPolicy',
  384. name: '',
  385. component: './system/editPolicy',
  386. },
  387. ],
  388. },
  389. {
  390. component: './404',
  391. },
  392. ],
  393. },
  394. {
  395. component: './404',
  396. },
  397. ],
  398. },
  399. {
  400. component: './404',
  401. },
  402. ],
  403. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  404. theme: {
  405. 'primary-color': primaryColor,
  406. 'btn-primary-bg': '#EF273A',
  407. 'table-row-hover-bg': '#eee',
  408. 'btn-danger-bg': '#FF7E48',
  409. },
  410. define: {
  411. ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
  412. 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 专用环境变量,请不要在你的项目中使用它。
  413. },
  414. ignoreMomentLocale: true,
  415. lessLoaderOptions: {
  416. javascriptEnabled: true,
  417. },
  418. disableRedirectHoist: true,
  419. cssLoaderOptions: {
  420. modules: true,
  421. getLocalIdent: (context, _, localName) => {
  422. if (
  423. context.resourcePath.includes('node_modules') ||
  424. context.resourcePath.includes('ant.design.pro.less') ||
  425. context.resourcePath.includes('global.less')
  426. ) {
  427. return localName;
  428. }
  429. const match = context.resourcePath.match(/src(.*)/);
  430. if (match && match[1]) {
  431. const antdProPath = match[1].replace('.less', '');
  432. const arr = slash(antdProPath)
  433. .split('/')
  434. .map(a => a.replace(/([A-Z])/g, '-$1'))
  435. .map(a => a.toLowerCase());
  436. return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
  437. }
  438. return localName;
  439. },
  440. },
  441. manifest: {
  442. basePath: '/',
  443. },
  444. chainWebpack: webpackPlugin,
  445. proxy: {
  446. '/api/': {
  447. target: 'http://192.168.0.84:8080/',
  448. changeOrigin: true,
  449. // pathRewrite: { '^/server': '' },
  450. },
  451. },
  452. };