index.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import layout from '@/layout/index.vue';
  4. const originalPush = VueRouter.prototype.push;
  5. VueRouter.prototype.push = function push(location) {
  6. return originalPush.call(this, location).catch((err) => err);
  7. };
  8. Vue.use(VueRouter);
  9. const router = new VueRouter({
  10. mode: 'history',
  11. // scrollBehavior(to, from, savedPosition) {
  12. // if (savedPosition) {
  13. // return savedPosition;
  14. // } else {
  15. // return { x: 0, y: 0 };
  16. // }
  17. // },
  18. base: '/agent/',
  19. routes: [
  20. {
  21. path: '/',
  22. component: layout,
  23. redirect: '/home',
  24. children: [
  25. {
  26. path: '/home',
  27. name: 'home',
  28. component: () => import('@/views/home/index.vue'),
  29. meta: {
  30. title: '经销商拜访',
  31. },
  32. },
  33. {
  34. path: '/visitPage',
  35. name: 'visitPage',
  36. component: () => import('@/views/home/visitPage.vue'),
  37. meta: {
  38. title: '拜访详情',
  39. },
  40. },
  41. {
  42. path: '/visitTask',
  43. name: 'visitTask',
  44. component: () => import('@/views/home/visitTask.vue'),
  45. meta: {
  46. title: '拜访任务',
  47. },
  48. },
  49. {
  50. path: '/visitHistory',
  51. name: 'visitHistory',
  52. component: () => import('@/views/home/visitHistory.vue'),
  53. meta: {
  54. title: '拜访历史',
  55. },
  56. },
  57. {
  58. path: '/visitHistoryDetail',
  59. name: 'visitHistoryDetail',
  60. component: () => import('@/views/home/visitHistoryDetail.vue'),
  61. meta: {
  62. title: '拜访历史详情',
  63. },
  64. },
  65. {
  66. path: '/visitAbnormal',
  67. name: 'visitAbnormal',
  68. component: () => import('@/views/home/visitAbnormal.vue'),
  69. meta: {
  70. title: '拜访异常',
  71. },
  72. },
  73. {
  74. path: '/visitedTaskDetail',
  75. name: 'visitedTaskDetail',
  76. component: () => import('@/views/home/visitedTaskDetail.vue'),
  77. meta: {
  78. title: '拜访任务详情',
  79. },
  80. },
  81. ],
  82. },
  83. {
  84. path: '/err',
  85. name: 'err',
  86. component: () => import('@/views/err.vue'),
  87. meta: {
  88. title: '404',
  89. },
  90. },
  91. {
  92. path: '/login',
  93. name: 'login',
  94. component: () => import('@/views/login.vue'),
  95. meta: {
  96. title: '登录',
  97. },
  98. },
  99. ],
  100. });
  101. export default router;