知与行后台管理端

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