config.ts 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import { join } from 'path';
  4. import defaultSettings from './defaultSettings';
  5. import proxy from './proxy';
  6. const { REACT_APP_ENV } = process.env;
  7. export default defineConfig({
  8. hash: true,
  9. antd: {},
  10. dva: {
  11. hmr: true,
  12. },
  13. layout: {
  14. // https://umijs.org/zh-CN/plugins/plugin-layout
  15. locale: true,
  16. siderWidth: 208,
  17. ...defaultSettings,
  18. },
  19. // https://umijs.org/zh-CN/plugins/plugin-locale
  20. locale: {
  21. // default zh-CN
  22. default: 'zh-CN',
  23. antd: true,
  24. // default true, when it is true, will use `navigator.language` overwrite default
  25. baseNavigator: true,
  26. },
  27. dynamicImport: {
  28. loading: '@ant-design/pro-layout/es/PageLoading',
  29. },
  30. targets: {
  31. ie: 11,
  32. },
  33. // umi routes: https://umijs.org/docs/routing
  34. routes: [
  35. {
  36. path: '/user',
  37. layout: false,
  38. routes: [
  39. {
  40. path: '/user/login',
  41. layout: false,
  42. name: 'login',
  43. component: './user/Login',
  44. },
  45. {
  46. path: '/user',
  47. redirect: '/user/login',
  48. },
  49. {
  50. name: 'register-result',
  51. icon: 'smile',
  52. path: '/user/register-result',
  53. component: './user/register-result',
  54. },
  55. {
  56. name: 'register',
  57. icon: 'smile',
  58. path: '/user/register',
  59. component: './user/register',
  60. },
  61. {
  62. component: '404',
  63. },
  64. ],
  65. },
  66. {
  67. path: '/dashboard',
  68. name: 'dashboard',
  69. icon: 'dashboard',
  70. routes: [
  71. {
  72. path: '/dashboard',
  73. redirect: '/dashboard/analysis',
  74. },
  75. {
  76. name: 'analysis',
  77. icon: 'smile',
  78. path: '/dashboard/analysis',
  79. component: './dashboard/analysis',
  80. },
  81. {
  82. name: 'monitor',
  83. icon: 'smile',
  84. path: '/dashboard/monitor',
  85. component: './dashboard/monitor',
  86. },
  87. {
  88. name: 'workplace',
  89. icon: 'smile',
  90. path: '/dashboard/workplace',
  91. component: './dashboard/workplace',
  92. },
  93. ],
  94. },
  95. {
  96. path: '/form',
  97. icon: 'form',
  98. name: 'form',
  99. routes: [
  100. {
  101. path: '/form',
  102. redirect: '/form/basic-form',
  103. },
  104. {
  105. name: 'basic-form',
  106. icon: 'smile',
  107. path: '/form/basic-form',
  108. component: './form/basic-form',
  109. },
  110. {
  111. name: 'step-form',
  112. icon: 'smile',
  113. path: '/form/step-form',
  114. component: './form/step-form',
  115. },
  116. {
  117. name: 'advanced-form',
  118. icon: 'smile',
  119. path: '/form/advanced-form',
  120. component: './form/advanced-form',
  121. },
  122. ],
  123. },
  124. {
  125. path: '/list',
  126. icon: 'table',
  127. name: 'list',
  128. routes: [
  129. {
  130. path: '/list/search',
  131. name: 'search-list',
  132. component: './list/search',
  133. routes: [
  134. {
  135. path: '/list/search',
  136. redirect: '/list/search/articles',
  137. },
  138. {
  139. name: 'articles',
  140. icon: 'smile',
  141. path: '/list/search/articles',
  142. component: './list/search/articles',
  143. },
  144. {
  145. name: 'projects',
  146. icon: 'smile',
  147. path: '/list/search/projects',
  148. component: './list/search/projects',
  149. },
  150. {
  151. name: 'applications',
  152. icon: 'smile',
  153. path: '/list/search/applications',
  154. component: './list/search/applications',
  155. },
  156. ],
  157. },
  158. {
  159. path: '/list',
  160. redirect: '/list/table-list',
  161. },
  162. {
  163. name: 'table-list',
  164. icon: 'smile',
  165. path: '/list/table-list',
  166. component: './list/table-list',
  167. },
  168. {
  169. name: 'basic-list',
  170. icon: 'smile',
  171. path: '/list/basic-list',
  172. component: './list/basic-list',
  173. },
  174. {
  175. name: 'card-list',
  176. icon: 'smile',
  177. path: '/list/card-list',
  178. component: './list/card-list',
  179. },
  180. ],
  181. },
  182. {
  183. path: '/profile',
  184. name: 'profile',
  185. icon: 'profile',
  186. routes: [
  187. {
  188. path: '/profile',
  189. redirect: '/profile/basic',
  190. },
  191. {
  192. name: 'basic',
  193. icon: 'smile',
  194. path: '/profile/basic',
  195. component: './profile/basic',
  196. },
  197. {
  198. name: 'advanced',
  199. icon: 'smile',
  200. path: '/profile/advanced',
  201. component: './profile/advanced',
  202. },
  203. ],
  204. },
  205. {
  206. name: 'exception',
  207. icon: 'warning',
  208. path: '/exception',
  209. routes: [
  210. {
  211. path: '/exception',
  212. redirect: '/exception/403',
  213. },
  214. {
  215. name: '403',
  216. icon: 'smile',
  217. path: '/exception/403',
  218. component: './exception/403',
  219. },
  220. {
  221. name: '404',
  222. icon: 'smile',
  223. path: '/exception/404',
  224. component: './exception/404',
  225. },
  226. {
  227. name: '500',
  228. icon: 'smile',
  229. path: '/exception/500',
  230. component: './exception/500',
  231. },
  232. ],
  233. },
  234. {
  235. name: 'account',
  236. icon: 'user',
  237. path: '/account',
  238. routes: [
  239. {
  240. path: '/account',
  241. redirect: '/account/center',
  242. },
  243. {
  244. name: 'center',
  245. icon: 'smile',
  246. path: '/account/center',
  247. component: './account/center',
  248. },
  249. {
  250. name: 'settings',
  251. icon: 'smile',
  252. path: '/account/settings',
  253. component: './account/settings',
  254. },
  255. ],
  256. },
  257. {
  258. path: '/',
  259. redirect: '/welcome',
  260. },
  261. {
  262. path: '/welcome',
  263. layout: false,
  264. component: './Welcome',
  265. },
  266. // 基础信息
  267. {
  268. path: '/basicInfo',
  269. name: 'basicInfo',
  270. component: './basicInfo/basicInfoIndex',
  271. routes: [
  272. {
  273. path: '/basicInfo',
  274. redirect: '/basicInfo/basicInfoIndex',
  275. },
  276. {
  277. path: '/basicInfo/carfile',
  278. name: 'carfile',
  279. component: './basicInfo/carfile',
  280. },
  281. {
  282. path: '/basicInfo/drivingRecord',
  283. name: 'drivingRecord',
  284. component: './basicInfo/drivingRecord',
  285. },
  286. {
  287. path: '/basicInfo/basicInfoIndex',
  288. name: 'basicInfoIndex',
  289. hideInMenu: true,
  290. component: './basicInfo/basicInfoIndex',
  291. },
  292. ],
  293. },
  294. {
  295. component: '404',
  296. },
  297. ],
  298. access: {},
  299. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  300. theme: {
  301. // 如果不想要 configProvide 动态设置主题需要把这个设置为 default
  302. // 只有设置为 variable, 才能使用 configProvide 动态设置主色调
  303. // https://ant.design/docs/react/customize-theme-variable-cn
  304. 'root-entry-name': 'variable',
  305. },
  306. // esbuild is father build tools
  307. // https://umijs.org/plugins/plugin-esbuild
  308. esbuild: {},
  309. title: false,
  310. ignoreMomentLocale: true,
  311. proxy: proxy[REACT_APP_ENV || 'dev'],
  312. manifest: {
  313. basePath: '/',
  314. },
  315. // Fast Refresh 热更新
  316. fastRefresh: {},
  317. openAPI: [
  318. {
  319. requestLibPath: "import { request } from 'umi'",
  320. // 或者使用在线的版本
  321. // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json"
  322. schemaPath: join(__dirname, 'oneapi.json'),
  323. mock: false,
  324. },
  325. {
  326. requestLibPath: "import { request } from 'umi'",
  327. schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json',
  328. projectName: 'swagger',
  329. },
  330. ],
  331. nodeModulesTransform: {
  332. type: 'none',
  333. },
  334. mfsu: {},
  335. webpack5: {},
  336. exportStatic: {},
  337. });