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