123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- 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) {
- return originalPush.call(this, location).catch((err) => err);
- };
- Vue.use(VueRouter);
- const web = [
- {
- path: '/',
- name: 'index',
- meta: { title: '网站首页' },
- component: () => import('../views/index.vue'),
- },
- {
- path: '/website',
- name: 'website',
- component: () => import('../views/website.vue'),
- children: [
- {
- path: '/news/index',
- name: 'news_index',
- meta: { title: '新闻咨询' },
- component: () => import('../views/news/index.vue'),
- },
- {
- path: '/news/list',
- name: 'news_list',
- meta: { title: '新闻咨询-列表页' },
- component: () => import('../views/news/list.vue'),
- },
- {
- path: '/service/index',
- name: 'service_index',
- meta: { title: '科技服务' },
- component: () => import('../views/service/index.vue'),
- },
- {
- path: '/service/policy',
- name: 'service_policy',
- meta: { title: '科技服务-高企政策服务' },
- component: () => import('../views/service/policy.vue'),
- },
- {
- path: '/service/ticket',
- name: 'service_ticket',
- meta: { title: '科技服务-创新券服务' },
- component: () => import('../views/service/ticket.vue'),
- },
- {
- path: '/service/register',
- name: 'service_register',
- meta: { title: '用户注册' },
- component: () => import('../views/service/register.vue'),
- },
- {
- path: '/market/index',
- name: 'market_index',
- meta: { title: '技术超市' },
- component: () => import('../views/market/index.vue'),
- },
- {
- path: '/market/list',
- name: 'market_list',
- meta: { title: '技术超市-列表页' },
- component: () => import('../views/market/list.vue'),
- },
- {
- path: '/train/index',
- name: 'train_index',
- meta: { title: '宣传培训' },
- component: () => import('../views/train/index.vue'),
- },
- {
- path: '/dynamic/index',
- name: 'dynamic_index',
- meta: { title: '数据动态' },
- component: () => import('../views/dynamic/index.vue'),
- },
- ],
- },
- // 管理登录
- {
- path: '/login',
- name: 'login',
- meta: { title: '管理登录' },
- component: () => import('../views/login.vue'),
- },
- // 宣传培训详情页
- {
- path: '/train/detail',
- name: 'train_detail',
- meta: { title: '宣传培训-详情页' },
- component: () => import('../views/train/detail.vue'),
- },
- {
- path: '/adminCenter/homeIndex',
- name: 'adminCenter',
- component: () => import('../views/adminCenter/index.vue'),
- children: [
- {
- path: '/adminCenter/homeIndex',
- name: 'admin_homeIndex',
- meta: { title: '首页' },
- component: () => import('../views/adminCenter/homeIndex/index.vue'),
- },
- {
- path: '/adminCenter/test',
- name: 'admin_test',
- meta: { title: '测试页面' },
- component: () => import('../views/adminCenter/test/index.vue'),
- },
- {
- path: '/adminCenter/news',
- name: 'admin_news',
- meta: { title: '新闻管理' },
- component: () => import('../views/adminCenter/news/index.vue'),
- },
- {
- path: '/adminCenter/news/detail',
- name: 'admin_news_detail',
- meta: { title: '新闻管理' },
- component: () => import('../views/adminCenter/news/detail.vue'),
- },
- {
- path: '/adminCenter/openinfo',
- name: 'admin_openinfo',
- meta: { title: '信息公开管理' },
- component: () => import('../views/adminCenter/openinfo/index.vue'),
- },
- {
- path: '/adminCenter/openinfo/detail',
- name: 'admin_openinfo_detail',
- meta: { title: '信息公开信息管理' },
- component: () => import('../views/adminCenter/openinfo/detail.vue'),
- },
- {
- path: '/adminCenter/product',
- name: 'admin_product',
- meta: { title: '科技成果' },
- component: () => import('../views/adminCenter/product/index.vue'),
- },
- {
- path: '/adminCenter/product/detail',
- name: 'admin_product_detail',
- meta: { title: '科技成果' },
- component: () => import('../views/adminCenter/product/detail.vue'),
- },
- {
- path: '/adminCenter/patent',
- name: 'admin_patent',
- meta: { title: '专利管理' },
- component: () => import('../views/adminCenter/patent/index.vue'),
- },
- {
- path: '/adminCenter/patent/detail',
- name: 'admin_patent_detail',
- meta: { title: '专利管理' },
- component: () => import('../views/adminCenter/patent/detail.vue'),
- },
- {
- path: '/adminCenter/roadShow',
- name: 'admin_road_show',
- meta: { title: '路演管理' },
- component: () => import('../views/adminCenter/road_show/index.vue'),
- },
- {
- path: '/adminCenter/roadShow/detail',
- name: 'admin_road_show_detail',
- meta: { title: '路演管理' },
- component: () => import('../views/adminCenter/road_show/detail.vue'),
- },
- {
- path: '/adminCenter/expert',
- name: 'admin_expert',
- meta: { title: '专家管理' },
- component: () => import('../views/adminCenter/expert/index.vue'),
- },
- {
- path: '/adminCenter/expert/detail',
- name: 'admin_expert_detail',
- meta: { title: '专家管理' },
- component: () => import('../views/adminCenter/expert/detail.vue'),
- },
- {
- path: '/adminCenter/organization',
- name: 'admin_organization',
- meta: { title: '企业管理' },
- component: () => import('../views/adminCenter/organization/index.vue'),
- },
- {
- path: '/adminCenter/organization/detail',
- name: 'admin_organization_detail',
- meta: { title: '企业管理' },
- component: () => import('../views/adminCenter/organization/detail.vue'),
- },
- {
- path: '/adminCenter/mechanism',
- name: 'admin_mechanism',
- meta: { title: '机构管理' },
- component: () => import('../views/adminCenter/mechanism/index.vue'),
- },
- {
- path: '/adminCenter/mechanism/detail',
- name: 'admin_mechanism_detail',
- meta: { title: '机构管理' },
- component: () => import('../views/adminCenter/mechanism/detail.vue'),
- },
- {
- path: '/adminCenter/online',
- name: 'admin_online',
- meta: { title: '线上管理' },
- component: () => import('../views/adminCenter/online/index.vue'),
- },
- {
- path: '/adminCenter/online/detail',
- name: 'admin_online_detail',
- meta: { title: '线上管理' },
- component: () => import('../views/adminCenter/online/detail.vue'),
- },
- {
- path: '/adminCenter/online/file',
- name: 'admin_online_file',
- meta: { title: '线上管理' },
- component: () => import('../views/adminCenter/online/file.vue'),
- },
- {
- path: '/adminCenter/policy',
- name: 'admin_policy',
- meta: { title: '高企政策服务管理' },
- component: () => import('../views/adminCenter/policy/index.vue'),
- },
- {
- path: '/adminCenter/policy/detail',
- name: 'admin_online_detail',
- meta: { title: '高企政策服务管理' },
- component: () => import('../views/adminCenter/policy/detail.vue'),
- },
- {
- path: '/adminCenter/ticket',
- name: 'admin_ticket',
- meta: { title: '创新劵服务管理' },
- component: () => import('../views/adminCenter/ticket/index.vue'),
- },
- {
- path: '/adminCenter/ticket/detail',
- name: 'admin_ticket_detail',
- meta: { title: '创新劵服务-信息管理' },
- component: () => import('../views/adminCenter/ticket/detail.vue'),
- },
- {
- path: '/adminCenter/ticket/toGrant',
- name: 'admin_ticket_toGrant',
- meta: { title: '创新劵发放' },
- component: () => import('../views/adminCenter/ticket/toGrant.vue'),
- },
- // 企业信息
- {
- path: '/adminCenter/company/basic',
- name: 'company_basic_index',
- meta: { title: '企业基本信息' },
- component: () => import('../views/adminCenter/company/basic/index.vue'),
- },
- {
- path: '/adminCenter/company/product',
- name: 'company_product_index',
- meta: { title: '技术超市' },
- component: () => import('../views/adminCenter/company/product/index.vue'),
- },
- {
- path: '/adminCenter/company/product/detail',
- name: 'company_product_index',
- meta: { title: '技术超市-信息管理' },
- component: () => import('../views/adminCenter/company/product/detail.vue'),
- },
- {
- path: '/adminCenter/company/subsidy',
- name: 'company_subsidy_index',
- meta: { title: '研发补贴' },
- component: () => import('../views/adminCenter/company/subsidy/index.vue'),
- },
- {
- path: '/adminCenter/company/subsidy/detail',
- name: 'company_subsidy_detail',
- meta: { title: '研发补贴-信息管理' },
- component: () => import('../views/adminCenter/company/subsidy/detail.vue'),
- },
- {
- path: '/adminCenter/company/reward',
- name: 'company_reward_index',
- meta: { title: '奖励兑现' },
- component: () => import('../views/adminCenter/company/reward/index.vue'),
- },
- {
- path: '/adminCenter/company/reward/detail',
- name: 'company_reward_detail',
- meta: { title: '奖励兑现-信息管理' },
- component: () => import('../views/adminCenter/company/reward/detail.vue'),
- },
- {
- path: '/adminCenter/company/cognizance',
- name: 'company_cognizance_index',
- meta: { title: '高企认定' },
- component: () => import('../views/adminCenter/company/cognizance/index.vue'),
- },
- {
- path: '/adminCenter/company/cognizance/detail',
- name: 'company_cognizance_detail',
- meta: { title: '高企认定-信息管理' },
- component: () => import('../views/adminCenter/company/cognizance/detail.vue'),
- },
- {
- path: '/adminCenter/company/cognizance/info',
- name: 'company_cognizance_info',
- meta: { title: '高企认定-查看审核' },
- component: () => import('../views/adminCenter/company/cognizance/info.vue'),
- },
- // 中介机构
- {
- path: '/adminCenter/inter/basic',
- name: 'inter_basic_index',
- meta: { title: '机构基本信息' },
- component: () => import('../views/adminCenter/inter/basic/index.vue'),
- },
- {
- path: '/adminCenter/inter/ticket',
- name: 'inter_ticket_index',
- meta: { title: '高企认证审核管理' },
- component: () => import('../views/adminCenter/inter/ticket/index.vue'),
- },
- {
- path: '/adminCenter/inter/ticket/detail',
- name: 'inter_ticket_detail',
- meta: { title: '高企认证-信息审核管理' },
- component: () => import('../views/adminCenter/inter/ticket/detail.vue'),
- },
- // 专家用户
- {
- path: '/adminCenter/experts/basic',
- name: 'experts_basic_index',
- meta: { title: '专家基本信息' },
- component: () => import('../views/adminCenter/experts/basic/index.vue'),
- },
- {
- path: '/adminCenter/experts/product',
- name: 'experts_product_index',
- meta: { title: '技术超市' },
- component: () => import('../views/adminCenter/experts/product/index.vue'),
- },
- {
- path: '/adminCenter/experts/product/detail',
- name: 'experts_product_detail',
- meta: { title: '技术超市-信息管理' },
- component: () => import('../views/adminCenter/experts/product/detail.vue'),
- },
- ],
- },
- ];
- const routes = [...web];
- const router = new VueRouter({
- mode: 'history',
- base: process.env.VUE_APP_ROUTER,
- routes,
- });
- router.beforeEach((to, from, next) => {
- document.title = `${to.meta.title} `;
- const token = localStorage.getItem('token');
- if (to.path == '/adminCenter/homeIndex') {
- if (!token) {
- 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;
|