|
@@ -1,136 +1,154 @@
|
|
|
import Vue from 'vue';
|
|
|
-import Router from 'vue-router';
|
|
|
-Vue.use(Router);
|
|
|
+import VueRouter from 'vue-router';
|
|
|
+import store from '@/store/index';
|
|
|
|
|
|
-export default new Router({
|
|
|
- mode: 'history',
|
|
|
- base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
|
|
|
- routes: [
|
|
|
- {
|
|
|
- path: '/home',
|
|
|
- component: () => import('../views/home/index.vue'),
|
|
|
- },
|
|
|
- // 金融数字超市-债权产品
|
|
|
- {
|
|
|
- path: '/supermarket/debt',
|
|
|
- component: () => import('../views/supermarket/debt.vue'),
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/supermarket/debtdetail',
|
|
|
- component: () => import('../views/supermarket/debtdetail.vue'),
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/supermarket/debtdetails',
|
|
|
- component: () => import('../views/supermarket/debtdetails.vue'),
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/finance/index',
|
|
|
- component: () => import('../views/finance/index.vue'),
|
|
|
- },
|
|
|
- //新闻中心
|
|
|
- {
|
|
|
- path: '/news/index',
|
|
|
- component: () => import('../views/news/index.vue'),
|
|
|
- },
|
|
|
- //新闻中心详情
|
|
|
- {
|
|
|
- path: '/news/detail',
|
|
|
- component: () => import('../views/news/detail.vue'),
|
|
|
- },
|
|
|
- // 金融数字超市 - 股权产品
|
|
|
- {
|
|
|
- path: '/supermarket/stock',
|
|
|
- component: () => import('../views/supermarket/stock.vue'),
|
|
|
- },
|
|
|
- // 金融机构
|
|
|
- {
|
|
|
- path: '/institution/index/:status',
|
|
|
- component: () => import('../views/institution/index.vue'),
|
|
|
- },
|
|
|
- // 金融机构添加
|
|
|
- {
|
|
|
- path: '/institution/detail',
|
|
|
- component: () => import('../views/institution/detail.vue'),
|
|
|
- },
|
|
|
- // 其他用户管理-列表
|
|
|
- {
|
|
|
- path: '/otheruser/index',
|
|
|
- component: () => import('../views/otheruser/index.vue'),
|
|
|
- },
|
|
|
- // 其他用户管理-添加
|
|
|
- {
|
|
|
- path: '/otheruser/detail',
|
|
|
- component: () => import('../views/otheruser/detail.vue'),
|
|
|
- },
|
|
|
- // 企业用户管理-详情
|
|
|
- {
|
|
|
- path: '/companyuser/index',
|
|
|
- component: () => import('../views/companyuser/index.vue'),
|
|
|
- },
|
|
|
- //指导单位
|
|
|
- {
|
|
|
- path: '/zhidao/index',
|
|
|
- component: () => import('../views/zhidao/index.vue'),
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/zhidao/detail',
|
|
|
- component: () => import('../views/zhidao/detail.vue'),
|
|
|
- },
|
|
|
+Vue.use(VueRouter);
|
|
|
+const routes = [
|
|
|
+ {
|
|
|
+ path: '/home',
|
|
|
+ component: () => import('../views/home/index.vue'),
|
|
|
+ },
|
|
|
+ // 金融数字超市-债权产品
|
|
|
+ {
|
|
|
+ path: '/supermarket/debt',
|
|
|
+ component: () => import('../views/supermarket/debt.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/supermarket/debtdetail',
|
|
|
+ component: () => import('../views/supermarket/debtdetail.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/supermarket/debtdetails',
|
|
|
+ component: () => import('../views/supermarket/debtdetails.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/finance/index',
|
|
|
+ component: () => import('../views/finance/index.vue'),
|
|
|
+ },
|
|
|
+ //新闻中心
|
|
|
+ {
|
|
|
+ path: '/news/index',
|
|
|
+ component: () => import('../views/news/index.vue'),
|
|
|
+ },
|
|
|
+ //新闻中心详情
|
|
|
+ {
|
|
|
+ path: '/news/detail',
|
|
|
+ component: () => import('../views/news/detail.vue'),
|
|
|
+ },
|
|
|
+ // 金融数字超市 - 股权产品
|
|
|
+ {
|
|
|
+ path: '/supermarket/stock',
|
|
|
+ component: () => import('../views/supermarket/stock.vue'),
|
|
|
+ },
|
|
|
+ // 金融机构
|
|
|
+ {
|
|
|
+ path: '/institution/index/:status',
|
|
|
+ component: () => import('../views/institution/index.vue'),
|
|
|
+ },
|
|
|
+ // 金融机构添加
|
|
|
+ {
|
|
|
+ path: '/institution/detail',
|
|
|
+ component: () => import('../views/institution/detail.vue'),
|
|
|
+ },
|
|
|
+ // 其他用户管理-列表
|
|
|
+ {
|
|
|
+ path: '/otheruser/index',
|
|
|
+ component: () => import('../views/otheruser/index.vue'),
|
|
|
+ },
|
|
|
+ // 其他用户管理-添加
|
|
|
+ {
|
|
|
+ path: '/otheruser/detail',
|
|
|
+ component: () => import('../views/otheruser/detail.vue'),
|
|
|
+ },
|
|
|
+ // 企业用户管理-详情
|
|
|
+ {
|
|
|
+ path: '/companyuser/index',
|
|
|
+ component: () => import('../views/companyuser/index.vue'),
|
|
|
+ },
|
|
|
+ //指导单位
|
|
|
+ {
|
|
|
+ path: '/zhidao/index',
|
|
|
+ component: () => import('../views/zhidao/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/zhidao/detail',
|
|
|
+ component: () => import('../views/zhidao/detail.vue'),
|
|
|
+ },
|
|
|
|
|
|
- // 企业信息管理-列表
|
|
|
- {
|
|
|
- path: '/companyup/index',
|
|
|
- component: () => import('../views/companyup/index.vue'),
|
|
|
- },
|
|
|
- // 企业信息管理-详情
|
|
|
- {
|
|
|
- path: '/companyup/detail',
|
|
|
- component: () => import('../views/companyup/detail.vue'),
|
|
|
- },
|
|
|
- // 企业认证管理
|
|
|
- {
|
|
|
- path: '/companyidentify/index',
|
|
|
- component: () => import('../views/companyidentify/index.vue'),
|
|
|
- },
|
|
|
- // 企业认证管理-审核
|
|
|
- {
|
|
|
- path: '/companyidentify/detail',
|
|
|
- component: () => import('../views/companyidentify/detail.vue'),
|
|
|
- },
|
|
|
- // 角色管理-列表
|
|
|
- {
|
|
|
- path: '/character/index',
|
|
|
- component: () => import('../views/character/index.vue'),
|
|
|
- },
|
|
|
- // 角色管理-详情
|
|
|
- {
|
|
|
- path: '/character/detail',
|
|
|
- component: () => import('../views/character/detail.vue'),
|
|
|
- },
|
|
|
- // 地区管理-列表
|
|
|
- {
|
|
|
- path: '/region/index',
|
|
|
- component: () => import('../views/region/index.vue'),
|
|
|
- },
|
|
|
- // 地区管理-详情
|
|
|
- {
|
|
|
- path: '/region/detail',
|
|
|
- component: () => import('../views/region/detail.vue'),
|
|
|
- },
|
|
|
+ // 企业信息管理-列表
|
|
|
+ {
|
|
|
+ path: '/companyup/index',
|
|
|
+ component: () => import('../views/companyup/index.vue'),
|
|
|
+ },
|
|
|
+ // 企业信息管理-详情
|
|
|
+ {
|
|
|
+ path: '/companyup/detail',
|
|
|
+ component: () => import('../views/companyup/detail.vue'),
|
|
|
+ },
|
|
|
+ // 企业认证管理
|
|
|
+ {
|
|
|
+ path: '/companyidentify/index',
|
|
|
+ component: () => import('../views/companyidentify/index.vue'),
|
|
|
+ },
|
|
|
+ // 企业认证管理-审核
|
|
|
+ {
|
|
|
+ path: '/companyidentify/detail',
|
|
|
+ component: () => import('../views/companyidentify/detail.vue'),
|
|
|
+ },
|
|
|
+ // 角色管理-列表
|
|
|
+ {
|
|
|
+ path: '/character/index',
|
|
|
+ component: () => import('../views/character/index.vue'),
|
|
|
+ },
|
|
|
+ // 角色管理-详情
|
|
|
+ {
|
|
|
+ path: '/character/detail',
|
|
|
+ component: () => import('../views/character/detail.vue'),
|
|
|
+ },
|
|
|
+ // 地区管理-列表
|
|
|
+ {
|
|
|
+ path: '/region/index',
|
|
|
+ component: () => import('../views/region/index.vue'),
|
|
|
+ },
|
|
|
+ // 地区管理-详情
|
|
|
+ {
|
|
|
+ path: '/region/detail',
|
|
|
+ component: () => import('../views/region/detail.vue'),
|
|
|
+ },
|
|
|
|
|
|
- //融资专家
|
|
|
- {
|
|
|
- path: '/specialist/index',
|
|
|
- component: () => import('../views/specialist/index.vue'),
|
|
|
- },
|
|
|
- {
|
|
|
- path: '/specialist/detail',
|
|
|
- component: () => import('../views/specialist/detail.vue'),
|
|
|
- },
|
|
|
+ //融资专家
|
|
|
+ {
|
|
|
+ path: '/specialist/index',
|
|
|
+ component: () => import('../views/specialist/index.vue'),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ path: '/specialist/detail',
|
|
|
+ component: () => import('../views/specialist/detail.vue'),
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- path: '/login',
|
|
|
- component: () => import('../views/login.vue'),
|
|
|
- },
|
|
|
- ],
|
|
|
+ {
|
|
|
+ path: '/login',
|
|
|
+ name: 'login',
|
|
|
+ component: () => import('../views/login.vue'),
|
|
|
+ },
|
|
|
+];
|
|
|
+const router = new VueRouter({
|
|
|
+ mode: 'history',
|
|
|
+ base: process.env.NODE_ENV === 'development' ? '' : '',
|
|
|
+ routes,
|
|
|
});
|
|
|
+router.beforeEach((to, form, next) => {
|
|
|
+ store.commit('setUser');
|
|
|
+ if (to.name === 'login') {
|
|
|
+ next();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let user = store.state.user;
|
|
|
+ if (user) {
|
|
|
+ next();
|
|
|
+ }
|
|
|
+ //下面是没登录的情况,需要跳转页面到用户未登录页
|
|
|
+ else next({ name: 'login' });
|
|
|
+});
|
|
|
+
|
|
|
+export default router;
|