import Vue from 'vue'; import VueRouter from 'vue-router'; import store from '@/store/index'; Vue.use(VueRouter); const routes = [ { path: '/home', component: () => import('../views/home/index.vue'), }, // 修改密码 { path: '/uppasswd/index', component: () => import('../views/uppasswd/index.vue'), }, // 个人信息管理 { path: '/userInfo/index', component: () => import('../views/userInfo/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: '/companyuser/detail', component: () => import('../views/companyuser/detail.vue'), }, //指导单位 { path: '/zhidao/index', component: () => import('../views/zhidao/index.vue'), }, { path: '/zhidao/detail', component: () => import('../views/zhidao/detail.vue'), }, //合作机构 { path: '/tCooperativeOrganization/index', component: () => import('../views/tCooperativeOrganization/index.vue'), }, { path: '/tCooperativeOrganization/detail', component: () => import('../views/tCooperativeOrganization/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: '/financialService/index', component: () => import('../views/financialService/index.vue'), }, { path: '/financialService/detail', component: () => import('../views/financialService/detail.vue'), }, { path: '/digitalService/index', component: () => import('../views/digitalService/index.vue'), }, { path: '/digitalService/detail', component: () => import('../views/digitalService/detail.vue'), }, { path: '/legalService/index', component: () => import('../views/legalService/index.vue'), }, { path: '/legalService/detail', component: () => import('../views/legalService/detail.vue'), }, { path: '/technicalService/index', component: () => import('../views/technicalService/index.vue'), }, { path: '/technicalService/detail', component: () => import('../views/technicalService/detail.vue'), }, { path: '/marketService/index', component: () => import('../views/marketService/index.vue'), }, { path: '/marketService/detail', component: () => import('../views/marketService/detail.vue'), }, { path: '/specialist/index', component: () => import('../views/specialist/index.vue'), }, { path: '/specialist/detail', component: () => import('../views/specialist/detail.vue'), }, //政策服务管理 { path: '/tInformationDelivery/index', component: () => import('../views/tInformationDelivery/index.vue'), }, { path: '/tInformationDelivery/detail', component: () => import('../views/tInformationDelivery/detail.vue'), }, { path: '/tPolicyInterpretation/index', component: () => import('../views/tPolicyInterpretation/index.vue'), }, { path: '/tPolicyInterpretation/detail', component: () => import('../views/tPolicyInterpretation/detail.vue'), }, { path: '/tDeclarationApproval/index', component: () => import('../views/tDeclarationApproval/index.vue'), }, { path: '/tDeclarationApproval/detail', component: () => import('../views/tDeclarationApproval/detail.vue'), }, // 债权产品列表 { path: '/financeclaims/financeClaimIndex', component: () => import('../views/financeclaims/financeClaimIndex.vue'), }, // 债权产品信息详情 { path: '/financeclaims/financeLookClaimDetail', component: () => import('../views/financeclaims/financeLookClaimDetail.vue'), }, // 数贷产品列表 { path: '/financeclaims/loanProIndex', component: () => import('../views/financeclaims/loanProIndex.vue'), }, // 数贷产品信息修改(添加) { path: '/financeclaims/loanProDetail', component: () => import('../views/financeclaims/loanProDetail.vue'), }, // 数贷产品信息详情 { path: '/financeclaims/loanProLookDetail', component: () => import('../views/financeclaims/loanProLookDetail.vue'), }, // 数贷产品授信页面 { path: '/financeclaims/loanFollowndex', component: () => import('../views/financeclaims/loanFollowndex.vue'), }, // 数贷产品授信详情页面 { path: '/financeclaims/loanfollowDetail', component: () => import('../views/financeclaims/loanfollowDetail.vue'), }, { path: '/login', name: 'login', component: () => import('../views/login.vue'), }, // 理财产品列表 { path: '/financeclaims/manageMoneyIndex', component: () => import('../views/financeclaims/manageMoneyIndex.vue'), }, // 理财产品信息详情 { path: '/financeclaims/manageMoneyLookDetail', component: () => import('../views/financeclaims/manageMoneyLookDetail.vue'), }, // 首页轮播管理-列表 { path: '/banner/index', component: () => import('../views/banner/index.vue'), }, // 首页轮播管理-详情 { path: '/banner/detail', component: () => import('../views/banner/detail.vue'), }, ]; const router = new VueRouter({ mode: 'history', base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROOT_URL, 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;