fanzhen1219

This commit is contained in:
fanzhen123
2019-12-19 18:33:31 +08:00
parent 84e10c524e
commit 607c4e792c
20 changed files with 2354 additions and 375 deletions

View File

@@ -30,7 +30,7 @@ import cs from '@/views/cs.vue'
Vue.use(Router)
export default new Router({
let RouterObj = new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [{
@@ -105,3 +105,23 @@ export default new Router({
}
]
})
RouterObj.beforeEach((to, from, next) => {
console.log(to, 'to')
if (to.name === 'personalCenter' || to.name === 'datasweb') {
console.log(localStorage.getItem('token'), 'localStorage.getItem()')
if (!localStorage.getItem('token')) {
alert('您没有该账号的登陆权限,请重新登录后再次操作!')
// 权限通过时赋值
console.log(Vue.prototype.$auth, 'Vue.prototype.$auth')
Vue.prototype.$auth.auth = true
console.log(Vue.prototype.$auth, 'Vue.prototype.$auth')
// localStorage.clear()
// window.location.reload()
} else {
next()
}
} else {
next()
}
})
export default RouterObj