index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import Vue from 'vue';
  2. import VueRouter from 'vue-router';
  3. import store from '@/store/index';
  4. Vue.use(VueRouter);
  5. const routes = [
  6. // 首页
  7. {
  8. path: '/',
  9. name: '',
  10. meta: { title: '首页', isleftarrow: false },
  11. component: () => import('../views/home/index.vue'),
  12. },
  13. // 直播大厅
  14. {
  15. path: '/live/index',
  16. name: 'live_index',
  17. meta: { title: '直播大厅', isleftarrow: true },
  18. component: () => import('../views/live/index.vue'),
  19. },
  20. // 科技超市
  21. {
  22. path: '/market/index',
  23. name: 'market_index',
  24. meta: { title: '科技超市', isleftarrow: true },
  25. component: () => import('../views/market/index.vue'),
  26. },
  27. // 科技超市-技术-产品-服务详情
  28. {
  29. path: '/market/prodDetail',
  30. name: 'market_prodDetail',
  31. meta: { title: '产品详情', isleftarrow: true },
  32. component: () => import('../views/market/prodDetail.vue'),
  33. },
  34. // 科技超市-专家详情
  35. {
  36. path: '/market/exportDetail',
  37. name: 'market_exportDetail',
  38. meta: { title: '专家详情', isleftarrow: true },
  39. component: () => import('../views/market/exportDetail.vue'),
  40. },
  41. // 科技超市-发布产品
  42. {
  43. path: '/market/detail',
  44. name: 'market_detail',
  45. meta: { title: '发布产品', isleftarrow: true },
  46. component: () => import('../views/market/detail.vue'),
  47. },
  48. // 我的发布
  49. {
  50. path: '/userCenter/myProduct/index',
  51. name: 'myProduct_index',
  52. meta: { title: '我的发布', isleftarrow: true },
  53. component: () => import('../views/userCenter/myProduct/index.vue'),
  54. },
  55. // 发布产品
  56. {
  57. path: '/detail',
  58. name: 'myfabu_detail',
  59. meta: { title: '我的发布', isleftarrow: true },
  60. component: () => import('../views/myfabu/detail.vue'),
  61. },
  62. // 事项管理
  63. // 用户-事项管理
  64. {
  65. path: '/userCenter/matter/index',
  66. name: 'matter_index',
  67. meta: { title: '事项管理', isleftarrow: true },
  68. component: () => import('../views/userCenter/matter/index.vue'),
  69. },
  70. // 用户-展会管理
  71. {
  72. path: '/userCenter/dock/index',
  73. name: 'dock_index',
  74. meta: { title: '事项管理', isleftarrow: true },
  75. component: () => import('../views/userCenter/dock/index.vue'),
  76. },
  77. // 用户-个人中心
  78. {
  79. path: '/userCenter/user/index',
  80. name: 'user_index',
  81. meta: { title: '个人中心', isleftarrow: true },
  82. component: () => import('../views/userCenter/user/index.vue'),
  83. },
  84. // // 个人中心
  85. // {
  86. // path: '/user/index',
  87. // name: 'user_index',
  88. // meta: { title: '个人中心', isleftarrow: true },
  89. // component: () => import('../views/user/index.vue'),
  90. // },
  91. ,
  92. ];
  93. const router = new VueRouter({
  94. mode: 'history',
  95. base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
  96. routes,
  97. });
  98. // router.beforeEach((to, form, next) => {
  99. // if (to.name === 'pcenter_center') {
  100. // store.commit('setUser');
  101. // if (to.name === 'login') {
  102. // next();
  103. // return;
  104. // }
  105. // let user = store.state.user;
  106. // if (user) {
  107. // next();
  108. // }
  109. // //下面是没登录的情况,需要跳转页面到用户未登录页
  110. // else next({ name: 'login' });
  111. // } else {
  112. // store.commit('setUser');
  113. // next();
  114. // }
  115. // });
  116. export default router;