|
|
@@ -2,60 +2,125 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router' |
|
|
|
import Cookies from 'js-cookie' |
|
|
|
|
|
|
|
const routes: RouteRecordRaw[] = [ |
|
|
|
{ |
|
|
|
path: '/', |
|
|
|
name: 'Login', |
|
|
|
component: () => import('@/views/system/login/Login.vue'), |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/layout/index', |
|
|
|
name: 'Layout', |
|
|
|
component: () => import('@/layout/index.vue'), |
|
|
|
redirect: '/views/home', |
|
|
|
children: [ |
|
|
|
{ |
|
|
|
path: '/views/home', |
|
|
|
name: 'home', |
|
|
|
meta: { title: '主页', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/system/home/Home.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/views/system/menu', |
|
|
|
name: 'menu', |
|
|
|
meta: { title: '菜单模块', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/system/menu/index.vue'), |
|
|
|
}, |
|
|
|
},{ |
|
|
|
path: '/views/dengmingcong/index', |
|
|
|
name: 'home1', |
|
|
|
meta: { title: '菜单模块', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/dengmingcong/index.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
} |
|
|
|
{ |
|
|
|
path: '/', |
|
|
|
name: 'Login', |
|
|
|
component: () => import('@/views/system/login/Login.vue'), |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/layout/index', |
|
|
|
name: 'Layout', |
|
|
|
component: () => import('@/layout/index.vue'), |
|
|
|
redirect: '/views/home', |
|
|
|
children: [ |
|
|
|
{ |
|
|
|
path: '/views/home', |
|
|
|
name: 'home', |
|
|
|
meta: { title: '主页', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/system/home/Home.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/views/system/menu', |
|
|
|
name: 'menu', |
|
|
|
meta: { title: '菜单模块', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/system/menu/index.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/views/dengmingcong/index', |
|
|
|
name: 'home1', |
|
|
|
meta: { title: '菜单模块', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/dengmingcong/index.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
path: '/views/fancongcong/advancepaymentaccount', |
|
|
|
name: 'home1', |
|
|
|
meta: { title: '对公账户打款充值服务', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/advancepaymentaccount/advancepaymentaccount.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/addsupplyCardBalance', |
|
|
|
name: 'addsupplyCardBalance', |
|
|
|
meta: { title: '储值卡-补交服务 ', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/addsupplyCardBalance/addsupplyCardBalance.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/cardrechargefix', |
|
|
|
name: 'cardrechargefix', |
|
|
|
meta: { title: '储值卡充值修复服务(圈存修复服务)', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/cardrechargefix/cardrechargefix.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/cardrefundcost', |
|
|
|
name: 'cardrefundcost ', |
|
|
|
meta: { title: '注销退费服务', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/cardrefundcost/cardrefundcost.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/supplyCardBalance', |
|
|
|
name: 'supplyCardBalance', |
|
|
|
meta: { title: '储值卡-补卡额服务', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/supplyCardBalance/supplyCardBalance.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/customerservice', |
|
|
|
name: 'customerservice', |
|
|
|
meta: { title: '储值卡充值服务(圈存)', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/customerservice/customerservice.vue'), |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
path: '/views/fancongcong/corporateaccount/corporateaccountManage', |
|
|
|
name: 'corporateaccountManage', |
|
|
|
meta: { title: '储值卡充值服务(圈存)', isAuth: true }, //用户自定内容 |
|
|
|
components: { |
|
|
|
key: () => import('@/views/fancongcong/corporateaccountManage/corporateaccountManage.vue'), |
|
|
|
}, |
|
|
|
} |
|
|
|
], |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
const router = createRouter({ |
|
|
|
history: createWebHashHistory(), //createWebHistory createWebHashHistory(带#号) 路由模式 |
|
|
|
routes, |
|
|
|
history: createWebHashHistory(), //createWebHistory createWebHashHistory(带#号) 路由模式 |
|
|
|
routes, |
|
|
|
}) |
|
|
|
|
|
|
|
//新增前置路由首位 |
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
if (to.meta.isAuth) { //是否需要验证权限 |
|
|
|
if (Cookies.get('token')) { |
|
|
|
next() //继续往下 |
|
|
|
} else { |
|
|
|
next({ name: 'Login' }); //没登录,跳转到login页 |
|
|
|
} |
|
|
|
} else { |
|
|
|
next() //继续往下 |
|
|
|
} |
|
|
|
if (to.meta.isAuth) { //是否需要验证权限 |
|
|
|
if (Cookies.get('token')) { |
|
|
|
next() //继续往下 |
|
|
|
} else { |
|
|
|
next({ name: 'Login' }); //没登录,跳转到login页 |
|
|
|
} |
|
|
|
} else { |
|
|
|
next() //继续往下 |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
export default router |