提交 dc99c134 authored 作者: lihuihui's avatar lihuihui
......@@ -13,14 +13,11 @@ export default class Before {
// 创建游客用户
// await store.dispatch('createGuestUser')
if (to.meta.requiredLogin) {
const isLogin = store.state.isLogin || (await store.dispatch('checkLogin'))
if (isLogin) {
wx.miniProgram.postMessage({ data: { token: store.state.token } })
next()
} else {
store.state.isWeapp ? wx.miniProgram.redirectTo({ url: '/pages/login/index' }) : next('/login')
}
const isLogin = store.state.isLogin || (await store.dispatch('checkLogin'))
isLogin && wx.miniProgram.postMessage({ data: { token: store.state.token } })
if (to.meta.requiredLogin && !isLogin) {
store.state.isWeapp ? wx.miniProgram.redirectTo({ url: '/pages/login/index' }) : next('/login')
return
}
next()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论