一键登录模块
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RouterMount, createRouter } from 'uni-simple-router';
|
||||
// import store from '../store/index'
|
||||
import store from '../store/index'
|
||||
|
||||
const router = createRouter({
|
||||
platform: process.env.VUE_APP_PLATFORM,
|
||||
@@ -15,23 +15,21 @@ const router = createRouter({
|
||||
|
||||
// 全局路由前置守卫
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log(to)
|
||||
console.log(from)
|
||||
// const token = store.getters.getToken || uni.getStorageSync('token')
|
||||
// if(to.meta.auth && token === ''){
|
||||
// next({
|
||||
// name: 'Login',
|
||||
// NAVTYPE: 'replaceAll'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// if(to.name === 'Welcome'){
|
||||
// next({
|
||||
// name: 'ChainIndex',
|
||||
// NAVTYPE: 'replaceAll'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
const token = store.getters.getToken || uni.getStorageSync('token')
|
||||
if(to.meta.auth && token === ''){
|
||||
next({
|
||||
name: 'Login',
|
||||
NAVTYPE: 'replaceAll'
|
||||
})
|
||||
return
|
||||
}
|
||||
if(to.name === 'Welcome'){
|
||||
next({
|
||||
name: 'ChainIndex',
|
||||
NAVTYPE: 'replaceAll'
|
||||
})
|
||||
return
|
||||
}
|
||||
next();
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user