router.config.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. // eslint-disable-next-line
  2. import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/layouts'
  3. import { bxAnaalyse } from '@/core/icons'
  4. export const asyncRouterMap = [
  5. {
  6. path: '/',
  7. name: 'index',
  8. component: BasicLayout,
  9. meta: { title: '首页' },
  10. redirect: '/dashboard/workplace',
  11. children: [
  12. // dashboard
  13. {
  14. path: '/dashboard',
  15. name: 'dashboard',
  16. redirect: '/dashboard/workplace',
  17. component: RouteView,
  18. meta: { title: '仪表盘', keepAlive: true, icon: bxAnaalyse, permission: [ 'dashboard' ] },
  19. children: [
  20. {
  21. path: '/dashboard/analysis',
  22. name: 'Analysis',
  23. component: () => import('@/views/dashboard/Analysis'),
  24. meta: { title: '分析页', keepAlive: false, permission: [ 'dashboard' ] }
  25. },
  26. // 外部链接
  27. {
  28. path: 'https://www.baidu.com/',
  29. name: 'Monitor',
  30. meta: { title: '监控页(外部)', target: '_blank' }
  31. },
  32. {
  33. path: '/dashboard/workplace',
  34. name: 'Workplace',
  35. component: () => import('@/views/dashboard/Workplace'),
  36. meta: { title: '工作台', keepAlive: true, permission: [ 'dashboard' ] }
  37. }
  38. ]
  39. },
  40. // forms
  41. {
  42. path: '/form',
  43. redirect: '/form/base-form',
  44. component: PageView,
  45. meta: { title: '表单页', icon: 'form', permission: [ 'form' ] },
  46. children: [
  47. {
  48. path: '/form/base-form',
  49. name: 'BaseForm',
  50. component: () => import('@/views/form/BasicForm'),
  51. meta: { title: '基础表单', keepAlive: true, permission: [ 'form' ] }
  52. },
  53. {
  54. path: '/form/step-form',
  55. name: 'StepForm',
  56. component: () => import('@/views/form/stepForm/StepForm'),
  57. meta: { title: '分步表单', keepAlive: true, permission: [ 'form' ] }
  58. },
  59. {
  60. path: '/form/advanced-form',
  61. name: 'AdvanceForm',
  62. component: () => import('@/views/form/advancedForm/AdvancedForm'),
  63. meta: { title: '高级表单', keepAlive: true, permission: [ 'form' ] }
  64. }
  65. ]
  66. },
  67. // list
  68. {
  69. path: '/list',
  70. name: 'list',
  71. component: PageView,
  72. redirect: '/list/table-list',
  73. meta: { title: '列表页', icon: 'table', permission: [ 'table' ] },
  74. children: [
  75. {
  76. path: '/list/table-list/:pageNo([1-9]\\d*)?',
  77. name: 'TableListWrapper',
  78. hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
  79. component: () => import('@/views/list/TableList'),
  80. meta: { title: '查询表格', keepAlive: true, permission: [ 'table' ] }
  81. },
  82. {
  83. path: '/list/basic-list',
  84. name: 'BasicList',
  85. component: () => import('@/views/list/StandardList'),
  86. meta: { title: '标准列表', keepAlive: true, permission: [ 'table' ] }
  87. },
  88. {
  89. path: '/list/card',
  90. name: 'CardList',
  91. component: () => import('@/views/list/CardList'),
  92. meta: { title: '卡片列表', keepAlive: true, permission: [ 'table' ] }
  93. },
  94. {
  95. path: '/list/search',
  96. name: 'SearchList',
  97. component: () => import('@/views/list/search/SearchLayout'),
  98. redirect: '/list/search/article',
  99. meta: { title: '搜索列表', keepAlive: true, permission: [ 'table' ] },
  100. children: [
  101. {
  102. path: '/list/search/article',
  103. name: 'SearchArticles',
  104. component: () => import('../views/list/search/Article'),
  105. meta: { title: '搜索列表(文章)', permission: [ 'table' ] }
  106. },
  107. {
  108. path: '/list/search/project',
  109. name: 'SearchProjects',
  110. component: () => import('../views/list/search/Projects'),
  111. meta: { title: '搜索列表(项目)', permission: [ 'table' ] }
  112. },
  113. {
  114. path: '/list/search/application',
  115. name: 'SearchApplications',
  116. component: () => import('../views/list/search/Applications'),
  117. meta: { title: '搜索列表(应用)', permission: [ 'table' ] }
  118. }
  119. ]
  120. }
  121. ]
  122. },
  123. // profile
  124. {
  125. path: '/profile',
  126. name: 'profile',
  127. component: RouteView,
  128. redirect: '/profile/basic',
  129. meta: { title: '详情页', icon: 'profile', permission: [ 'profile' ] },
  130. children: [
  131. {
  132. path: '/profile/basic',
  133. name: 'ProfileBasic',
  134. component: () => import('@/views/profile/basic/Index'),
  135. meta: { title: '基础详情页', permission: [ 'profile' ] }
  136. },
  137. {
  138. path: '/profile/advanced',
  139. name: 'ProfileAdvanced',
  140. component: () => import('@/views/profile/advanced/Advanced'),
  141. meta: { title: '高级详情页', permission: [ 'profile' ] }
  142. }
  143. ]
  144. },
  145. // result
  146. {
  147. path: '/result',
  148. name: 'result',
  149. component: PageView,
  150. redirect: '/result/success',
  151. meta: { title: '结果页', icon: 'check-circle-o', permission: [ 'result' ] },
  152. children: [
  153. {
  154. path: '/result/success',
  155. name: 'ResultSuccess',
  156. component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
  157. meta: { title: '成功', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
  158. },
  159. {
  160. path: '/result/fail',
  161. name: 'ResultFail',
  162. component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
  163. meta: { title: '失败', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
  164. }
  165. ]
  166. },
  167. // Exception
  168. {
  169. path: '/exception',
  170. name: 'exception',
  171. component: RouteView,
  172. redirect: '/exception/403',
  173. meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
  174. children: [
  175. {
  176. path: '/exception/403',
  177. name: 'Exception403',
  178. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
  179. meta: { title: '403', permission: [ 'exception' ] }
  180. },
  181. {
  182. path: '/exception/404',
  183. name: 'Exception404',
  184. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
  185. meta: { title: '404', permission: [ 'exception' ] }
  186. },
  187. {
  188. path: '/exception/500',
  189. name: 'Exception500',
  190. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
  191. meta: { title: '500', permission: [ 'exception' ] }
  192. }
  193. ]
  194. },
  195. // account
  196. {
  197. path: '/account',
  198. component: RouteView,
  199. redirect: '/account/center',
  200. name: 'account',
  201. meta: { title: '个人页', icon: 'user', keepAlive: true, permission: [ 'user' ] },
  202. children: [
  203. {
  204. path: '/account/center',
  205. name: 'center',
  206. component: () => import('@/views/account/center/Index'),
  207. meta: { title: '个人中心', keepAlive: true, permission: [ 'user' ] }
  208. },
  209. {
  210. path: '/account/settings',
  211. name: 'settings',
  212. component: () => import('@/views/account/settings/Index'),
  213. meta: { title: '个人设置', hideHeader: true, permission: [ 'user' ] },
  214. redirect: '/account/settings/base',
  215. hideChildrenInMenu: true,
  216. children: [
  217. {
  218. path: '/account/settings/base',
  219. name: 'BaseSettings',
  220. component: () => import('@/views/account/settings/BaseSetting'),
  221. meta: { title: '基本设置', hidden: true, permission: [ 'user' ] }
  222. },
  223. {
  224. path: '/account/settings/security',
  225. name: 'SecuritySettings',
  226. component: () => import('@/views/account/settings/Security'),
  227. meta: { title: '安全设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
  228. },
  229. {
  230. path: '/account/settings/custom',
  231. name: 'CustomSettings',
  232. component: () => import('@/views/account/settings/Custom'),
  233. meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
  234. },
  235. {
  236. path: '/account/settings/binding',
  237. name: 'BindingSettings',
  238. component: () => import('@/views/account/settings/Binding'),
  239. meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: [ 'user' ] }
  240. },
  241. {
  242. path: '/account/settings/notification',
  243. name: 'NotificationSettings',
  244. component: () => import('@/views/account/settings/Notification'),
  245. meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: [ 'user' ] }
  246. }
  247. ]
  248. }
  249. ]
  250. },
  251. // other
  252. {
  253. path: '/other',
  254. name: 'otherPage',
  255. component: PageView,
  256. meta: { title: '其他组件', icon: 'slack', permission: [ 'dashboard' ] },
  257. redirect: '/other/icon-selector',
  258. children: [
  259. {
  260. path: '/other/icon-selector',
  261. name: 'TestIconSelect',
  262. component: () => import('@/views/other/IconSelectorView'),
  263. meta: { title: 'IconSelector', icon: 'tool', keepAlive: true, permission: [ 'dashboard' ] }
  264. },
  265. {
  266. path: '/other/list',
  267. component: RouteView,
  268. meta: { title: '业务布局', icon: 'layout', permission: [ 'support' ] },
  269. redirect: '/other/list/tree-list',
  270. children: [
  271. {
  272. path: '/other/list/tree-list',
  273. name: 'TreeList',
  274. component: () => import('@/views/other/TreeList'),
  275. meta: { title: '树目录表格', keepAlive: true }
  276. },
  277. {
  278. path: '/other/list/edit-table',
  279. name: 'EditList',
  280. component: () => import('@/views/other/TableInnerEditList'),
  281. meta: { title: '内联编辑表格', keepAlive: true }
  282. },
  283. {
  284. path: '/other/list/user-list',
  285. name: 'UserList',
  286. component: () => import('@/views/other/UserList'),
  287. meta: { title: '用户列表', keepAlive: true }
  288. },
  289. {
  290. path: '/other/list/role-list',
  291. name: 'RoleList',
  292. component: () => import('@/views/other/RoleList'),
  293. meta: { title: '角色列表', keepAlive: true }
  294. },
  295. {
  296. path: '/other/list/system-role',
  297. name: 'SystemRole',
  298. component: () => import('@/views/role/RoleList'),
  299. meta: { title: '角色列表2', keepAlive: true }
  300. },
  301. {
  302. path: '/other/list/permission-list',
  303. name: 'PermissionList',
  304. component: () => import('@/views/other/PermissionList'),
  305. meta: { title: '权限列表', keepAlive: true }
  306. }
  307. ]
  308. }
  309. ]
  310. }
  311. ]
  312. },
  313. {
  314. path: '*', redirect: '/404', hidden: true
  315. }
  316. ]
  317. /**
  318. * 基础路由
  319. * @type { *[] }
  320. */
  321. export const constantRouterMap = [
  322. {
  323. path: '/user',
  324. component: UserLayout,
  325. redirect: '/user/login',
  326. hidden: true,
  327. children: [
  328. {
  329. path: 'login',
  330. name: 'login',
  331. component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
  332. },
  333. {
  334. path: 'register',
  335. name: 'register',
  336. component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
  337. },
  338. {
  339. path: 'register-result',
  340. name: 'registerResult',
  341. component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
  342. }
  343. ]
  344. },
  345. {
  346. path: '/test',
  347. component: BlankLayout,
  348. redirect: '/test/home',
  349. children: [
  350. {
  351. path: 'home',
  352. name: 'TestHome',
  353. component: () => import('@/views/Home')
  354. }
  355. ]
  356. },
  357. {
  358. path: '/404',
  359. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  360. }
  361. ]