index.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. },
  35. {
  36. path: '/agentList',
  37. component: layout,
  38. redirect: '/agentList',
  39. children: [
  40. {
  41. path: '/agentList',
  42. name: 'agentList',
  43. component: () => import('@/views/agentList/index.vue'),
  44. meta: {
  45. title: '经销商拜访',
  46. },
  47. },
  48. {
  49. path: '/visitPage',
  50. name: 'visitPage',
  51. component: () => import('@/views/agentList/visitPage.vue'),
  52. meta: {
  53. title: '拜访详情',
  54. },
  55. },
  56. {
  57. path: '/visitTask',
  58. name: 'visitTask',
  59. component: () => import('@/views/agentList/visitTask.vue'),
  60. meta: {
  61. title: '拜访任务',
  62. },
  63. },
  64. {
  65. path: '/visitHistory',
  66. name: 'visitHistory',
  67. component: () => import('@/views/agentList/visitHistory.vue'),
  68. meta: {
  69. title: '拜访历史',
  70. },
  71. },
  72. {
  73. path: '/visitHistoryDetail',
  74. name: 'visitHistoryDetail',
  75. component: () => import('@/views/agentList/visitHistoryDetail.vue'),
  76. meta: {
  77. title: '拜访历史详情',
  78. },
  79. },
  80. {
  81. path: '/visitAbnormal',
  82. name: 'visitAbnormal',
  83. component: () => import('@/views/agentList/visitAbnormal.vue'),
  84. meta: {
  85. title: '拜访异常',
  86. },
  87. },
  88. {
  89. path: '/visitedTaskDetail',
  90. name: 'visitedTaskDetail',
  91. component: () => import('@/views/agentList/visitedTaskDetail.vue'),
  92. meta: {
  93. title: '拜访任务详情',
  94. },
  95. },
  96. ],
  97. },
  98. {
  99. path: '/info',
  100. component: layout,
  101. redirect: '/info',
  102. children: [
  103. {
  104. path: '/info',
  105. name: 'info',
  106. component: () => import('@/views/info/index.vue'),
  107. meta: {
  108. title: '我的',
  109. },
  110. },
  111. {
  112. path: '/infoHistorVisit',
  113. name: 'infoHistorVisit',
  114. component: () => import('@/views/info/infoHistorVisit.vue'),
  115. meta: {
  116. title: '历史拜访',
  117. },
  118. },
  119. ],
  120. },
  121. {
  122. path: '/err',
  123. name: 'err',
  124. component: () => import('@/views/err.vue'),
  125. meta: {
  126. title: '404',
  127. },
  128. },
  129. {
  130. path: '/login',
  131. name: 'login',
  132. component: () => import('@/views/login.vue'),
  133. meta: {
  134. title: '登录',
  135. },
  136. },
  137. ],
  138. });
  139. export default router;