index.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Home from '../views/home/Index.vue'
  4. Vue.use(VueRouter)
  5. const routes = [
  6. {
  7. path: '/',
  8. redirect: '/login'
  9. },
  10. {
  11. path: '/home',
  12. redirect: '/home/cockpitManage',
  13. name: 'home',
  14. component: Home,
  15. children: [
  16. // 驾驶舱
  17. {
  18. path: 'cockpitManage',
  19. name: 'cockpitManage',
  20. component: () => import('../views/admin/cockpitManage/Index.vue')
  21. },
  22. // 电子地图
  23. {
  24. path: 'electronic-map',
  25. name: 'electronicMap',
  26. component: () =>
  27. import('../views/admin/cockpitManage/electronicMap.vue')
  28. },
  29. //数据操作
  30. {
  31. path: 'dataAdministration',
  32. name: 'dataAdministration',
  33. component: () =>
  34. import('../views/dataAdministration/index.vue')
  35. },
  36. //企业信息
  37. {
  38. path: 'enterprise',
  39. name: 'enterprise',
  40. component: () =>
  41. import('../views/ledger/enterprise.vue')
  42. },
  43. //风场信息
  44. {
  45. path: 'windsite',
  46. name: 'windsite',
  47. component: () =>
  48. import('../views/ledger/windsite.vue')
  49. },
  50. // 风机信息
  51. {
  52. path: 'draught',
  53. name: 'draught',
  54. component: () =>
  55. import('../views/ledger/draught.vue')
  56. },
  57. // 机型信息
  58. {
  59. path: 'milltype',
  60. name: 'milltype',
  61. component: () =>
  62. import('../views/ledger/milltype.vue')
  63. },
  64. // 测风塔信息
  65. {
  66. path: 'anemometer',
  67. name: 'anemometer',
  68. component: () =>
  69. import('../views/ledger/anemometer.vue')
  70. },
  71. ]
  72. },
  73. {
  74. path: '/login',
  75. name: 'login',
  76. component: () => import('../views/login/Index.vue')
  77. },
  78. {
  79. path: '/:pathMatch(.*)*',
  80. component: () => import('@/views/error/404.vue'),
  81. meta: { hidden: true }
  82. }
  83. // {
  84. // path: '*',
  85. // redirect: '/'
  86. // }
  87. ]
  88. const router = new VueRouter({
  89. mode: 'history',
  90. base: process.env.BASE_URL,
  91. scrollBehavior: () => ({
  92. y: 0
  93. }),
  94. routes
  95. })
  96. const originalPush = VueRouter.prototype.push
  97. VueRouter.prototype.push = function push(location) {
  98. return originalPush.call(this, location).catch((err) => err)
  99. }
  100. export default router