router.config.js 13 KB

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