config.js 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. // https://umijs.org/config/
  2. import { defineConfig } from 'umi';
  3. import defaultSettings from './defaultSettings';
  4. import proxy from './proxy';
  5. const { REACT_APP_ENV } = process.env;
  6. export default defineConfig({
  7. hash: true,
  8. antd: {},
  9. dva: {
  10. hmr: true,
  11. },
  12. history: {
  13. type: 'browser',
  14. },
  15. locale: {
  16. // default zh-CN
  17. default: 'zh-CN',
  18. antd: true,
  19. // default true, when it is true, will use `navigator.language` overwrite default
  20. baseNavigator: true,
  21. },
  22. dynamicImport: {
  23. loading: '@/components/PageLoading/index',
  24. },
  25. targets: {
  26. ie: 11,
  27. },
  28. // umi routes: https://umijs.org/docs/routing
  29. routes: [
  30. {
  31. path: '/',
  32. component: '../layouts/BlankLayout',
  33. routes: [
  34. {
  35. path: '/user',
  36. component: '../layouts/UserLayout',
  37. routes: [
  38. {
  39. path: '/user/login',
  40. name: 'login',
  41. component: './User/login',
  42. },
  43. {
  44. path: '/user',
  45. redirect: '/user/login',
  46. },
  47. {
  48. name: 'register-result',
  49. icon: 'smile',
  50. path: '/user/register-result',
  51. component: './user/register-result',
  52. },
  53. {
  54. name: 'register',
  55. icon: 'smile',
  56. path: '/user/register',
  57. component: './user/register',
  58. },
  59. {
  60. component: '404',
  61. },
  62. ],
  63. },
  64. {
  65. path: '/',
  66. component: '../layouts/BasicLayout',
  67. Routes: ['src/pages/Authorized'],
  68. authority: ['admin', 'user'],
  69. routes: [
  70. {
  71. path: '/',
  72. redirect: '/dashboard/analysis',
  73. },
  74. {
  75. path: '/edit',
  76. name:'edit',
  77. icon:'edit',
  78. component: './edit'
  79. },
  80. {
  81. path: '/dashboard',
  82. name: 'dashboard',
  83. icon: 'dashboard',
  84. routes: [
  85. {
  86. path: '/',
  87. redirect: '/dashboard/analysis',
  88. },
  89. {
  90. name: 'analysis',
  91. icon: 'smile',
  92. path: '/dashboard/analysis',
  93. component: './dashboard/analysis',
  94. },
  95. {
  96. name: 'monitor',
  97. icon: 'smile',
  98. path: '/dashboard/monitor',
  99. component: './dashboard/monitor',
  100. },
  101. {
  102. name: 'workplace',
  103. icon: 'smile',
  104. path: '/dashboard/workplace',
  105. component: './dashboard/workplace',
  106. },
  107. ],
  108. },
  109. {
  110. path: '/form',
  111. icon: 'form',
  112. name: 'form',
  113. routes: [
  114. {
  115. path: '/',
  116. redirect: '/form/basic-form',
  117. },
  118. {
  119. name: 'basic-form',
  120. icon: 'smile',
  121. path: '/form/basic-form',
  122. component: './form/basic-form',
  123. },
  124. {
  125. name: 'step-form',
  126. icon: 'smile',
  127. path: '/form/step-form',
  128. component: './form/step-form',
  129. },
  130. {
  131. name: 'advanced-form',
  132. icon: 'smile',
  133. path: '/form/advanced-form',
  134. component: './form/advanced-form',
  135. },
  136. ],
  137. },
  138. {
  139. path: '/list',
  140. icon: 'table',
  141. name: 'list',
  142. routes: [
  143. {
  144. path: '/list/search',
  145. name: 'search-list',
  146. component: './list/search',
  147. routes: [
  148. {
  149. path: '/list/search',
  150. redirect: '/list/search/articles',
  151. },
  152. {
  153. name: 'articles',
  154. icon: 'smile',
  155. path: '/list/search/articles',
  156. component: './list/search/articles',
  157. },
  158. {
  159. name: 'projects',
  160. icon: 'smile',
  161. path: '/list/search/projects',
  162. component: './list/search/projects',
  163. },
  164. {
  165. name: 'applications',
  166. icon: 'smile',
  167. path: '/list/search/applications',
  168. component: './list/search/applications',
  169. },
  170. ],
  171. },
  172. {
  173. path: '/',
  174. redirect: '/list/table-list',
  175. },
  176. {
  177. name: 'table-list',
  178. icon: 'smile',
  179. path: '/list/table-list',
  180. component: './list/table-list',
  181. },
  182. {
  183. name: 'basic-list',
  184. icon: 'smile',
  185. path: '/list/basic-list',
  186. component: './list/basic-list',
  187. },
  188. {
  189. name: 'card-list',
  190. icon: 'smile',
  191. path: '/list/card-list',
  192. component: './list/card-list',
  193. },
  194. ],
  195. },
  196. {
  197. path: '/profile',
  198. name: 'profile',
  199. icon: 'profile',
  200. routes: [
  201. {
  202. path: '/',
  203. redirect: '/profile/basic',
  204. },
  205. {
  206. name: 'basic',
  207. icon: 'smile',
  208. path: '/profile/basic',
  209. component: './profile/basic',
  210. },
  211. {
  212. name: 'advanced',
  213. icon: 'smile',
  214. path: '/profile/advanced',
  215. component: './profile/advanced',
  216. },
  217. ],
  218. },
  219. {
  220. name: 'result',
  221. icon: 'CheckCircleOutlined',
  222. path: '/result',
  223. routes: [
  224. {
  225. path: '/',
  226. redirect: '/result/success',
  227. },
  228. {
  229. name: 'success',
  230. icon: 'smile',
  231. path: '/result/success',
  232. component: './result/success',
  233. },
  234. {
  235. name: 'fail',
  236. icon: 'smile',
  237. path: '/result/fail',
  238. component: './result/fail',
  239. },
  240. ],
  241. },
  242. {
  243. name: 'exception',
  244. icon: 'warning',
  245. path: '/exception',
  246. routes: [
  247. {
  248. path: '/',
  249. redirect: '/exception/403',
  250. },
  251. {
  252. name: '403',
  253. icon: 'smile',
  254. path: '/exception/403',
  255. component: './exception/403',
  256. },
  257. {
  258. name: '404',
  259. icon: 'smile',
  260. path: '/exception/404',
  261. component: './exception/404',
  262. },
  263. {
  264. name: '500',
  265. icon: 'smile',
  266. path: '/exception/500',
  267. component: './exception/500',
  268. },
  269. ],
  270. },
  271. {
  272. name: 'account',
  273. icon: 'user',
  274. path: '/account',
  275. routes: [
  276. {
  277. path: '/',
  278. redirect: '/account/center',
  279. },
  280. {
  281. name: 'center',
  282. icon: 'smile',
  283. path: '/account/center',
  284. component: './account/center',
  285. },
  286. {
  287. name: 'settings',
  288. icon: 'smile',
  289. path: '/account/settings',
  290. component: './account/settings',
  291. },
  292. ],
  293. },
  294. {
  295. name: 'editor',
  296. icon: 'highlight',
  297. path: '/editor',
  298. routes: [
  299. {
  300. path: '/',
  301. redirect: '/editor/flow',
  302. },
  303. {
  304. name: 'flow',
  305. icon: 'smile',
  306. path: '/editor/flow',
  307. component: './editor/flow',
  308. },
  309. {
  310. name: 'mind',
  311. icon: 'smile',
  312. path: '/editor/mind',
  313. component: './editor/mind',
  314. },
  315. {
  316. name: 'koni',
  317. icon: 'smile',
  318. path: '/editor/koni',
  319. component: './editor/koni',
  320. },
  321. ],
  322. },
  323. {
  324. component: '404',
  325. },
  326. ],
  327. },
  328. ],
  329. },
  330. ],
  331. // Theme for antd: https://ant.design/docs/react/customize-theme-cn
  332. theme: {
  333. 'primary-color': defaultSettings.primaryColor,
  334. },
  335. title: false,
  336. ignoreMomentLocale: true,
  337. proxy: proxy[REACT_APP_ENV || 'dev'],
  338. manifest: {
  339. basePath: '/',
  340. },
  341. esbuild: {},
  342. });