123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- import Vue from 'vue';
- import VueRouter from 'vue-router';
- import store from '@/store/index';
- const jwt = require('jsonwebtoken');
- const originalPush = VueRouter.prototype.push;
- VueRouter.prototype.push = function push(location, onResolve, onReject) {
- if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject);
- return originalPush.call(this, location).catch(err => err);
- };
- Vue.use(VueRouter);
- const onLive = [
- {
- path: '/live/onAchieve/index',
- meta: { title: '直播大厅-在线展会' },
- component: () => import('../views/live/onAchieve/index.vue'),
- },
- {
- path: '/live/onAchieve/detail',
- meta: { title: '在线展会-详细信息' },
- component: () => import('../views/live/onAchieve/detail.vue'),
- },
- {
- path: '/live/channel/index',
- meta: { title: '直播大厅-科技频道' },
- component: () => import('../views/live/channel/index.vue'),
- },
- {
- path: '/live/channel/detail',
- meta: { title: '科技频道-详细信息' },
- component: () => import('../views/live/channel/detail.vue'),
- },
- {
- path: '/live/trainInter/index',
- meta: { title: '直播大厅-培训访谈' },
- component: () => import('../views/live/trainInter/index.vue'),
- },
- {
- path: '/live/trainInter/oneDetail',
- meta: { title: '嘉宾访谈-详细信息' },
- component: () => import('../views/live/trainInter/oneDetail.vue'),
- },
- {
- path: '/live/trainInter/twoDetail',
- meta: { title: '技能培训-详细信息' },
- component: () => import('../views/live/trainInter/twoDetail.vue'),
- },
- {
- path: '/live/roadshow/index',
- meta: { title: '直播大厅-项目路演' },
- component: () => import('../views/live/roadshow/index.vue'),
- },
- {
- path: '/live/roadshow/detail',
- meta: { title: '项目路演-详细信息' },
- component: () => import('../views/live/roadshow/detail.vue'),
- },
- ];
- const market = [
- {
- path: '/market/achieve/index',
- meta: { title: '科技超市-技术成果' },
- component: () => import('../views/market/achieve/index.vue'),
- },
- {
- path: '/market/achieve/detail',
- meta: { title: '技术成果-详细信息' },
- component: () => import('../views/market/achieve/detail.vue'),
- },
- {
- path: '/market/patent/index',
- meta: { title: '科技超市-E-专利' },
- component: () => import('../views/market/patent/index.vue'),
- },
- {
- path: '/market/patent/detail',
- meta: { title: 'E-专利-详细信息' },
- component: () => import('../views/market/patent/detail.vue'),
- },
- {
- path: '/market/techol/index',
- meta: { title: '科技超市-科技需求' },
- component: () => import('../views/market/techol/index.vue'),
- },
- {
- path: '/market/techol/detail',
- meta: { title: '科技需求-详细信息' },
- component: () => import('../views/market/techol/detail.vue'),
- },
- {
- path: '/market/expert/index',
- meta: { title: '科技超市-专家智库' },
- component: () => import('../views/market/expert/index.vue'),
- },
- {
- path: '/market/expert/detail',
- meta: { title: '专家智库-详细信息' },
- component: () => import('../views/market/expert/detail.vue'),
- },
- {
- path: '/market/service/index',
- meta: { title: '科技超市-在线服务' },
- component: () => import('../views/market/service/index.vue'),
- },
- {
- path: '/market/service/detail',
- meta: { title: '在线服务-详细信息' },
- component: () => import('../views/market/service/detail.vue'),
- },
- ];
- const user = [
- {
- path: '/user/question/index',
- meta: { title: '个人中心-调查问卷' },
- component: () => import('../views/user/question/index.vue'),
- },
- {
- path: '/user/notice/index',
- meta: { title: '个人中心-通知通告' },
- component: () => import('../views/user/notice/index.vue'),
- },
- {
- path: '/user/notice/detail',
- meta: { title: '通知通告-详细信息' },
- component: () => import('../views/user/notice/detail.vue'),
- },
- {
- path: '/user/news/index',
- meta: { title: '个人中心-新闻资讯' },
- component: () => import('../views/user/news/index.vue'),
- },
- {
- path: '/user/news/detail',
- meta: { title: '新闻资讯-详细信息' },
- component: () => import('../views/user/news/detail.vue'),
- },
- {
- path: '/user/account/index',
- meta: { title: '个人中心-账号管理' },
- component: () => import('../views/user/account/index.vue'),
- },
- ];
- const routes = [
- {
- path: '/',
- meta: { title: '首页' },
- component: () => import('../views/index.vue'),
- },
- ...onLive,
- ...market,
- ...user,
- ];
- const router = new VueRouter({
- mode: 'history',
- base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
- routes,
- });
- // router.beforeEach((to, from, next) => {
- // document.title = `${to.meta.title} `;
- // let token = localStorage.getItem('token');
- // console.log(token);
- // if (to.path == '/account/index') {
- // if (token == null) {
- // next('/login');
- // } else {
- // let user = jwt.decode(token);
- // store.commit('setUser', user, { root: true });
- // next();
- // }
- // } else {
- // let user = jwt.decode(token);
- // store.commit('setUser', user, { root: true });
- // next();
- // }
- // });
- export default router;
|