知与行后台管理端

config.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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. <<<<<<< HEAD
  123. =======
  124. path: '/building/list/add',
  125. name: '项目添加', // 项目添加
  126. hideInMenu: true,
  127. component: './building/list/add/index',
  128. },
  129. {
  130. >>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
  131. path: '/building/type',
  132. name: '项目类型',
  133. component: './building/type/index',
  134. },
  135. {
  136. path: '/building/type/edi',
  137. name: '项目类型编辑',
  138. hideInMenu: true,
  139. component: './building/type/edi',
  140. },
  141. ],
  142. },
  143. {
  144. path: '/customer',
  145. name: '客户管理',
  146. component: '../layouts/BlankLayout',
  147. routes: [
  148. {
  149. path: '/customer/customerlist/list',
  150. name: '客户列表',
  151. component: './customer/customerlist/index',
  152. },
  153. {
  154. <<<<<<< HEAD
  155. =======
  156. path: '/customer/customerlist/customerDetail',
  157. name: '客户编辑',
  158. hideInMenu: true,
  159. component: './customer/customerlist/customerDetail',
  160. },
  161. {
  162. >>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
  163. path: '/customer/drift/list',
  164. name: '游客列表',
  165. component: './customer/drift/index',
  166. },
  167. {
  168. path: '/customer/report/list',
  169. name: '报备客户',
  170. component: './customer/report/index',
  171. },
  172. {
  173. path: '/customer/recommendCustomer/list',
  174. name: '推荐客户',
  175. component: './customer/recommendCustomer/index',
  176. },
  177. {
  178. path: '/customer/recommendCustomer/audit',
  179. name: '客户审核',
  180. hideInMenu: true,
  181. component: './customer/recommendCustomer/audit',
  182. },
  183. {
  184. path: '/customer/independentList',
  185. name: '经纪人',
  186. component: './customer/independentList/index',
  187. },
  188. ],
  189. },
  190. {
  191. path: '/integralMall',
  192. name: '积分商城',
  193. component: '../layouts/BlankLayout',
  194. routes: [
  195. {
  196. path: '/integralMall/GoodsList',
  197. name: '商品列表',
  198. component: './integralMall/GoodsList',
  199. },
  200. {
  201. path: '/integralMall/achieve',
  202. name: '积分获取',
  203. component: './integralMall/achieve',
  204. },
  205. {
  206. path: '/integralMall/editGoods',
  207. name: '商品编辑',
  208. hideInMenu: true,
  209. component: './integralMall/editGoods',
  210. },
  211. {
  212. path: '/integralMall/exchangeRecords',
  213. name: '兑换记录',
  214. component: './integralMall/exchangeRecords',
  215. },
  216. {
  217. path: '/integralMall/writeOff',
  218. name: '商品核销',
  219. component: './integralMall/writeOff',
  220. },
  221. {
  222. path: '/integralMall/verifyList',
  223. name: '商品核销列表',
  224. hideInMenu: true,
  225. component: './integralMall/verifyList',
  226. },
  227. ],
  228. },
  229. {
  230. path: '/channel',
  231. name: '渠道管理',
  232. component: '../layouts/BlankLayout',
  233. routes: [
  234. {
  235. path: '/channel/channelList',
  236. name: '渠道管理',
  237. component: './channel/channelList',
  238. },
  239. {
  240. path: '/channel/addChannel',
  241. name: '添加渠道',
  242. hideInMenu: true,
  243. component: './channel/addChannel',
  244. },
  245. {
  246. path: '/channel/editChannel',
  247. name: '编辑渠道',
  248. hideInMenu: true,
  249. component: './channel/editChannel',
  250. },
  251. {
  252. path: '/channel/brokerList',
  253. name: '经纪人',
  254. component: './channel/brokerList',
  255. },
  256. {
  257. path: '/channel/recommendClients',
  258. name: '渠道推荐',
  259. hideInMenu: true,
  260. component: './channel/recommendClients',
  261. },
  262. {
  263. path: '/channel/InviteClients',
  264. name: '邀请客户',
  265. hideInMenu: true,
  266. component: './channel/InviteClients',
  267. },
  268. ],
  269. },
  270. {
  271. path: '/news',
  272. name: '资讯管理',
  273. component: '../layouts/BlankLayout',
  274. routes: [
  275. {
  276. path: '/news/type/NewsType',
  277. name: '资讯类型',
  278. component: './news/type/NewsType',
  279. },
  280. {
  281. path: '/news/type/editNews',
  282. name: '编辑资讯类型',
  283. hideInMenu: true,
  284. component: './news/type/editNews',
  285. },
  286. {
  287. path: '/news/list/NewsList',
  288. name: '资讯列表',
  289. component: './news/list/NewsList',
  290. },
  291. <<<<<<< HEAD
  292. =======
  293. {
  294. path: '/news/list/editNewsList',
  295. name: '编辑资讯',
  296. hideInMenu: true,
  297. component: './news/list/editNewsList',
  298. },
  299. >>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
  300. ],
  301. },
  302. {
  303. path: '/activity',
  304. name: '活动管理',
  305. component: '../layouts/BlankLayout',
  306. routes: [
  307. {
  308. path: '/activity/ActivityList',
  309. name: '活动列表',
  310. component: './activity/ActivityList',
  311. },
  312. {
  313. path: '/activity/editActivity',
  314. name: '编辑活动',
  315. hideInMenu: true,
  316. component: './activity/editActivity',
  317. },
  318. {
  319. path: '/activity/SignList',
  320. name: '报名列表',
  321. hideInMenu: true,
  322. component: './activity/SignList',
  323. },
  324. ],
  325. },
  326. {
  327. path: '/staff',
  328. name: '员工管理',
  329. component: '../layouts/BlankLayout',
  330. routes: [
  331. {
  332. path: '/staff/StaffList',
  333. name: '员工列表',
  334. component: './staff/list/StaffList',
  335. },
  336. {
  337. path: '/staff/editStaff',
  338. name: '编辑员工',
  339. hideInMenu: true,
  340. component: './staff/list/editStaff',
  341. },
  342. {
  343. path: '/staff/RoleList',
  344. name: '角色管理',
  345. component: './staff/list/RoleList',
  346. },
  347. {
  348. path: '/staff/editRole',
  349. name: '编辑角色',
  350. hideInMenu: true,
  351. component: './staff/list/editRole',
  352. },
  353. <<<<<<< HEAD
  354. =======
  355. {
  356. path: '/staff/list/addRole',
  357. name: '添加角色',
  358. hideInMenu: true,
  359. component: './staff/list/addRole',
  360. },
  361. ],
  362. },
  363. {
  364. path: '/carouselFigure',
  365. name: '轮播图管理',
  366. component: '../layouts/BlankLayout',
  367. routes: [
  368. {
  369. path: '/carouselFigure/carouselFigureList',
  370. name: '轮播图列表',
  371. component: './carouselFigure/carouselFigureList',
  372. },
  373. {
  374. path: '/carouselFigure/editCarousel',
  375. name: '轮播图编辑',
  376. hideInMenu: true,
  377. component: './carouselFigure/editCarousel',
  378. },
  379. {
  380. path: '/carouselFigure/advertisingList',
  381. name: '开屏广告',
  382. component: './carouselFigure/advertisingList',
  383. },
  384. {
  385. path: '/carouselFigure/editAdvertising',
  386. name: '开屏广告编辑',
  387. hideInMenu: true,
  388. component: './carouselFigure/editAdvertising',
  389. },
  390. >>>>>>> ed52b30a02a5604a8626322e59d620f25aa7558d
  391. ],
  392. },
  393. {
  394. path: '/indexEcharts',
  395. name: 'echarts',
  396. component: '../layouts/BlankLayout',
  397. routes: [
  398. {
  399. path: '/indexEcharts/index',
  400. name: '报表',
  401. component: './indexEcharts/index',
  402. },
  403. {
  404. path: '/indexEcharts/userSource',
  405. name: '用户来源',
  406. component: './indexEcharts/userSource',
  407. },
  408. {
  409. path: '/system/intention',
  410. name: '意向值',
  411. component: './system/intention',
  412. },
  413. {
  414. path: '/system/housingPolicy',
  415. name: '购房政策维护',
  416. component: './system/housingPolicy',
  417. },
  418. {
  419. path: '/system/editPolicy',
  420. name: '购房政策编辑',
  421. hideInMenu: true,
  422. component: './system/editPolicy',
  423. },
  424. ],
  425. },
  426. {
  427. component: './404',
  428. },
  429. ],
  430. },
  431. {
  432. component: './404',
  433. },
  434. ],
  435. },
  436. {
  437. component: './404',
  438. },
  439. ],
  440. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  441. theme: {
  442. 'primary-color': primaryColor,
  443. 'btn-primary-bg': '#EF273A',
  444. 'table-row-hover-bg': '#eee',
  445. 'btn-danger-bg': '#FF7E48',
  446. },
  447. define: {
  448. ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION:
  449. 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 专用环境变量,请不要在你的项目中使用它。
  450. },
  451. ignoreMomentLocale: true,
  452. lessLoaderOptions: {
  453. javascriptEnabled: true,
  454. },
  455. disableRedirectHoist: true,
  456. cssLoaderOptions: {
  457. modules: true,
  458. getLocalIdent: (context, _, localName) => {
  459. if (
  460. context.resourcePath.includes('node_modules') ||
  461. context.resourcePath.includes('ant.design.pro.less') ||
  462. context.resourcePath.includes('global.less')
  463. ) {
  464. return localName;
  465. }
  466. const match = context.resourcePath.match(/src(.*)/);
  467. if (match && match[1]) {
  468. const antdProPath = match[1].replace('.less', '');
  469. const arr = slash(antdProPath)
  470. .split('/')
  471. .map(a => a.replace(/([A-Z])/g, '-$1'))
  472. .map(a => a.toLowerCase());
  473. return `antd-pro${arr.join('-')}-${localName}`.replace(/--/g, '-');
  474. }
  475. return localName;
  476. },
  477. },
  478. manifest: {
  479. basePath: '/',
  480. },
  481. chainWebpack: webpackPlugin,
  482. proxy: {
  483. '/api/': {
  484. target: 'http://192.168.0.84:8080/',
  485. changeOrigin: true,
  486. // pathRewrite: { '^/server': '' },
  487. },
  488. },
  489. };