index.js 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. import Layout from '../components/layout/LayoutView'
  4. import LayoutBase from '../components/layout/LayoutBaseView'
  5. Vue.use(Router)
  6. /**
  7. * 路由配置说明:
  8. * 建议:sider menu 请不要超过三级菜单,若超过三级菜单,则应该设计为顶部主菜单 配合左侧次级菜单
  9. *
  10. * hidden: true if `hidden:true` will not show in the sidebar(default is false)
  11. * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
  12. * if not set alwaysShow, only more than one route under the children
  13. * it will becomes nested mode, otherwise not show the root menu
  14. * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
  15. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  16. * meta : {
  17. title: 'title' the name show in submenu and breadcrumb (recommend set)
  18. icon: 'svg-name' the icon show in the sidebar,
  19. keepAlive: true keep alive component
  20. hiddenPageHeader: true if `hiddenPageHeader: true` will not show page-header(details)
  21. }
  22. **/
  23. export const constantRouterMap = [
  24. {
  25. path: '/login',
  26. component: () => import('../views/Login')
  27. },
  28. {
  29. path: '/404',
  30. component: () => import(/* webpackChunkName: "fail" */ '../views/exception/404')
  31. },
  32. {
  33. path: '/',
  34. component: Layout,
  35. redirect: '/login',
  36. name: '首页',
  37. hidden: true
  38. }
  39. ]
  40. export default new Router({
  41. mode: 'history',
  42. base: process.env.BASE_URL,
  43. scrollBehavior: () => ({ y: 0 }),
  44. routes: constantRouterMap
  45. })
  46. export const asyncRouterMap = [
  47. {
  48. path: '/dashboard',
  49. component: Layout,
  50. name: 'dashboard',
  51. redirect: '/dashboard/workplace',
  52. meta: { title: '仪表盘', icon: 'dashboard' },
  53. children: [
  54. {
  55. path: '/dashboard/analysis',
  56. name: 'Analysis',
  57. component: () => import('../views/dashboard/Analysis'),
  58. meta: { title: '分析页', hideHeader: true }
  59. },
  60. {
  61. path: '/dashboard/monitor',
  62. name: 'Monitor',
  63. hidden: true,
  64. component: () => import('../views/dashboard/Monitor'),
  65. meta: { title: '监控页', hideHeader: true }
  66. },
  67. {
  68. path: '/dashboard/workplace',
  69. name: 'Workplace',
  70. component: () => import('../views/dashboard/Workplace'),
  71. meta: { title: '工作台' }
  72. }
  73. ]
  74. },
  75. {
  76. path: '/form',
  77. component: LayoutBase,
  78. name: 'form',
  79. redirect: '/form/base-form',
  80. meta: { title: '表单页', icon: 'form' },
  81. children: [
  82. {
  83. path: '/form/base-form',
  84. name: 'BaseForm',
  85. component: () => import('../views/form/BasicForm'),
  86. meta: { title: '基础表单' }
  87. },
  88. {
  89. path: '/form/step-form',
  90. name: 'StepForm',
  91. component: () => import('../views/form/stepForm/StepForm'),
  92. meta: { title: '分步表单' }
  93. },
  94. {
  95. path: '/form/advanced-form',
  96. name: 'AdvanceForm',
  97. component: () => import('../views/form/advancedForm/AdvancedForm'),
  98. meta: { title: '高级表单' }
  99. }
  100. ]
  101. },
  102. {
  103. path: '/list',
  104. component: LayoutBase,
  105. name: 'list',
  106. redirect: '/list/query-list',
  107. meta: { title: '列表页', icon: 'table' },
  108. children: [
  109. {
  110. path: '/list/query-list',
  111. name: 'QueryList',
  112. component: () => import('@/views/list/TableList'),
  113. meta: { title: '查询表格' }
  114. },
  115. {
  116. path: '/list/edit-table',
  117. name: 'EditList',
  118. component: () => import('@/views/list/TableInnerEditList'),
  119. meta: { title: '内联编辑表格' }
  120. },
  121. {
  122. path: '/list/role-list',
  123. name: 'RoleList',
  124. component: () => import('@/views/list/RoleList'),
  125. meta: { title: '角色列表' }
  126. },
  127. {
  128. path: '/list/basic-list',
  129. name: 'BasicList',
  130. component: () => import('@/views/list/StandardList'),
  131. meta: { title: '标准列表' }
  132. },
  133. {
  134. path: '/list/card',
  135. name: 'CardList',
  136. component: () => import('@/views/list/CardList'),
  137. meta: { title: '卡片列表' }
  138. },
  139. {
  140. path: '/list/search',
  141. name: 'SearchList',
  142. component: () => import('@/views/list/search/SearchLayout'),
  143. redirect: '/list/search/article',
  144. meta: { title: '搜索列表' },
  145. children: [
  146. {
  147. path: '/list/search/article',
  148. name: 'SearchArticles',
  149. component: () => import('../views/list/TableList'),
  150. meta: { title: '搜索列表(文章)' }
  151. },
  152. {
  153. path: '/list/search/project',
  154. name: 'SearchProjects',
  155. component: () => import('../views/list/TableList'),
  156. meta: { title: '搜索列表(项目)' }
  157. },
  158. {
  159. path: '/list/search/application',
  160. name: 'SearchApplications',
  161. component: () => import('../views/list/TableList'),
  162. meta: { title: '搜索列表(应用)' }
  163. },
  164. ]
  165. },
  166. ]
  167. },
  168. {
  169. path: '/profile',
  170. component: Layout,
  171. name: 'profile',
  172. redirect: '/profile/basic',
  173. meta: { title: '详情页', icon: 'profile' },
  174. children: [
  175. {
  176. path: '/profile/basic',
  177. name: 'ProfileBasic',
  178. component: () => import('@/views/profile/basic/Index'),
  179. meta: { title: '基础详情页' }
  180. },
  181. {
  182. path: '/profile/advanced',
  183. name: 'ProfileAdvanced',
  184. component: () => import('@/views/profile/advanced/Advanced'),
  185. meta: { title: '高级详情页' }
  186. }
  187. ]
  188. },
  189. {
  190. path: '/result',
  191. component: LayoutBase,
  192. name: 'result',
  193. redirect: '/result/success',
  194. meta: { title: '结果页', icon: 'check-circle-o' },
  195. children: [
  196. {
  197. path: '/result/success',
  198. name: 'ResultSuccess',
  199. component: () => import(/* webpackChunkName: "result" */ '../views/result/Success'),
  200. meta: { title: '成功', hiddenPageHeader: true }
  201. },
  202. {
  203. path: '/result/fail',
  204. name: 'ResultFail',
  205. // route level code-splitting
  206. // this generates a separate chunk (about.[hash].js) for this route
  207. // which is lazy-loaded when the route is visited.
  208. component: () => import(/* webpackChunkName: "result" */ '../views/result/Error'),
  209. meta: { title: '失败', hiddenPageHeader: true }
  210. }
  211. ]
  212. },
  213. {
  214. path: '/exception',
  215. component: Layout,
  216. name: 'exception',
  217. redirect: '/exception/403',
  218. meta: { title: '异常页', icon: 'warning' },
  219. children: [
  220. {
  221. path: '/exception/403',
  222. name: 'Exception403',
  223. component: () => import(/* webpackChunkName: "fail" */ '../views/exception/403'),
  224. meta: { title: '403' }
  225. },
  226. {
  227. path: '/exception/404',
  228. name: 'Exception404',
  229. // route level code-splitting
  230. // this generates a separate chunk (about.[hash].js) for this route
  231. // which is lazy-loaded when the route is visited.
  232. component: () => import(/* webpackChunkName: "fail" */ '../views/exception/404'),
  233. meta: { title: '404' }
  234. },
  235. {
  236. path: '/exception/500',
  237. name: 'Exception500',
  238. // route level code-splitting
  239. // this generates a separate chunk (about.[hash].js) for this route
  240. // which is lazy-loaded when the route is visited.
  241. component: () => import(/* webpackChunkName: "fail" */ '../views/exception/500'),
  242. meta: { title: '500' }
  243. }
  244. ]
  245. },
  246. {
  247. path: '/account',
  248. component: Layout,
  249. name: 'account',
  250. meta: { title: '个人页', icon: 'user', keepAlive: true },
  251. children: [
  252. {
  253. path: '/account/center',
  254. name: 'center',
  255. component: () => import('@/views/account/center/Index'),
  256. meta: { title: '个人中心', keepAlive: true }
  257. },
  258. {
  259. path: '/account/settings',
  260. name: 'settings',
  261. component: () => import('@/views/account/settings/Index'),
  262. meta: { title: '个人设置', hideHeader: true, keepAlive: true },
  263. redirect: '/account/settings/base',
  264. alwaysShow: true,
  265. children: [
  266. {
  267. path: '/account/settings/base',
  268. name: 'BaseSettings',
  269. component: () => import('@/views/account/settings/BaseSetting'),
  270. meta: { title: '基本设置', hidden: true, keepAlive: true }
  271. },
  272. {
  273. path: '/account/settings/security',
  274. name: 'SecuritySettings',
  275. component: () => import('@/views/account/settings/Security'),
  276. meta: { title: '安全设置', hidden: true, keepAlive: true }
  277. },
  278. {
  279. path: '/account/settings/custom',
  280. name: 'CustomSettings',
  281. component: () => import('@/views/account/settings/Custom'),
  282. meta: { title: '个性化设置', hidden: true, keepAlive: true }
  283. },
  284. {
  285. path: '/account/settings/binding',
  286. name: 'BindingSettings',
  287. component: () => import('@/views/account/settings/Binding'),
  288. meta: { title: '账户绑定', hidden: true, keepAlive: true }
  289. },
  290. {
  291. path: '/account/settings/notification',
  292. name: 'NotificationSettings',
  293. component: () => import('@/views/account/settings/Notification'),
  294. meta: { title: '新消息通知', hidden: true, keepAlive: true }
  295. },
  296. ]
  297. },
  298. ]
  299. },
  300. {
  301. path: '*', redirect: '/404', hidden: true
  302. }
  303. ]