1
0
Fork 0
5g-track/src/permission.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2022-05-26 08:53:53 +08:00
import router from './router'
import getPageTitle from 'utils/getPageTitle'
import { Checkrunner } from 'api/home'
import Vue from 'vue';
import { Toast } from 'vant';
Vue.use(Toast);
// 路由拦截
// router.beforeEach(async(to, from, next) => {
// document.title = getPageTitle(to.meta.title) // set page title
// if(to.name ==='Admin'){
// if(sessionStorage.loginStatus){
// next()
// }else{
// next('/login')
// Toast('请登录!')
// }
// }else if(to.name === 'Home'){
// let skipUrl = 'http://5gmalasong.hnabc.cn/app'
// let wechatUrl = 'http://5gmalasong.hnabc.cn'
// let routerUrl = escape('/#/home')
// Checkrunner().then(res =>{
// if(res.code === 0){
// sessionStorage.Code = res.data.Code
// next('/QRCode')
// }else if(res.code === 3009){
// location.href = wechatUrl + '/wechat/login/runner?returnurl=' + skipUrl + routerUrl
// // alert(baseUrl + 'wechat/login/runner?returnurl=' + baseUrl + '#/home')
// }else{
// next()
// }
// })
// }else{
// next()
// }
// })
//跳转完成后
router.afterEach(() => {
//to do something
})