| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- import Vue from 'vue'
- import Router from 'vue-router'
- const routerPush = Router.prototype.push
- Router.prototype.push = function push(location) {
- // if(typeof(location)=="string"){
- // var Separator = "&";
- // if(location.indexOf('?')==-1) { Separator='?'; }
- // location = location + Separator + "random=" + Math.random();
- // }
- return routerPush.call(this, location).catch(error => error)
- }
- Vue.use(Router)
- let router = new Router({
- // mode: 'history',
- base: process.env.BASE_URL,
- routes: [{
- path: '/',
- redirect: '/home'
- },
- {
- path: '/login',
- name: 'login',
- component: () => import('./views/Login.vue'),
- meta: {
- title: '登录'
- }
- },
- {
- path: '/home',
- name: 'home',
- component: () => import('./views/Home.vue'),
- redirect: '/home/statistics',
- meta: {
- title: ''
- },
- children: [{
- path: 'regList',
- name: 'regList',
- component: () => import('./views/home/regList.vue'),
- meta: {
- title: 'Token列表'
- }
- },
- {
- path: 'buyReg',
- name: 'buyReg',
- component: () => import('./views/home/buyReg.vue'),
- meta: {
- title: '购买注册码'
- }
- },
- {
- path: 'abonementList',
- name: 'abonementList',
- component: () => import('./views/home/abonementList.vue'),
- meta: {
- title: '用户列表'
- }
- },
- {
- path: 'orderList',
- name: 'orderList',
- component: () => import('./views/home/orderList.vue'),
- meta: {
- title: '订单列表'
- }
- },
- {
- path: 'addOrder',
- name: 'addOrder',
- component: () => import('./views/home/addOrder.vue'),
- meta: {
- title: '添加订单'
- }
- },
- {
- path: 'addressList',
- name: 'addressList',
- component: () => import('./views/home/addressList.vue'),
- meta: {
- title: '地址列表'
- }
- },
- {
- path: 'rechangeList',
- name: 'rechangeList',
- component: () => import('./views/home/rechangeList.vue'),
- meta: {
- title: '充值记录'
- }
- },
- {
- path: 'rechange',
- name: 'rechange',
- component: () => import('./views/home/rechange.vue'),
- meta: {
- title: '充值'
- }
- },
- {
- path: 'taking',
- name: 'taking',
- component: () => import('./views/home/taking.vue'),
- meta: {
- title: '提现'
- }
- },
- {
- path: 'takingList',
- name: 'takingList',
- component: () => import('./views/home/takingList.vue'),
- meta: {
- title: '提现记录'
- }
- },
- {
- path: 'transferList',
- name: 'transferList',
- component: () => import('./views/home/transferList.vue'),
- meta: {
- title: '转账记录'
- }
- },
- {
- path: 'transfer',
- name: 'transferList',
- component: () => import('./views/home/transfer.vue'),
- meta: {
- title: '转账'
- }
- },
- {
- path: 'setAgent',
- name: 'setAgent',
- component: () => import('./views/home/setAgent.vue'),
- meta: {
- title: '设置下级代理'
- }
- },
- {
- path: 'statistics',
- name: 'statistics',
- component: () => import('./views/home/statistics.vue'),
- meta: {
- title: '统计'
- }
- },
- {
- path: 'dlstatistics',
- name: 'dlstatistics',
- component: () => import('./views/home/dlstatistics.vue'),
- meta: {
- title: '统计'
- }
- },
- {
- path: 'setPas',
- name: 'setPas',
- component: () => import('./views/home/setPas.vue'),
- meta: {
- title: '交易密码'
- }
- },
- {
- path: 'setUserinfo',
- name: 'setUserinfo',
- component: () => import('./views/home/setUserinfo.vue'),
- meta: {
- title: '修改个人信息'
- }
- },
- {
- path: 'money',
- name: 'money',
- component: () => import('./views/home/money.vue'),
- meta: {
- title: '资金流水'
- }
- },
- ]
- },
- {
- path: '*',
- redirect: '/home'
- }
- ]
- })
- // 路由导航守卫
- router.beforeEach((to, from, next) => {
- if (to.path === '/login') return next()
- const tokenStr = window.sessionStorage.getItem('token')
- if (!tokenStr) return next('/login')
- next()
- })
- export default router
|