提交 c5c64d39 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 3a290c63
...@@ -6,31 +6,16 @@ export default class Before { ...@@ -6,31 +6,16 @@ export default class Before {
async update(to, from, next) { async update(to, from, next) {
if (to.meta.requiredLogin) { if (to.meta.requiredLogin) {
// 所有登录页 不进行登录校验
const isLogin = await store.dispatch('checkLogin') const isLogin = await store.dispatch('checkLogin')
if (isLogin) { if (isLogin) {
next() next()
} else { } else {
store.state.isWeapp ? this.wechatLogin() : next('/login') store.state.isWeapp
? wx.miniProgram.redirectTo({ url: '/pages/login/index' })
: next('/login')
} }
return return
} }
next() next()
} }
wechatLogin() {
const appId = 'wxc6044475caf2805a'
const wechatRedirectURL =
webConf.isDev === 'production'
? 'https://passport.ezijing.com'
: 'https://passport2.ezijing.com'
// 回调地址
const redirectURI = `${wechatRedirectURL}/rest/wechat/oauth-callback?needCheck=false&identity=transport&redirectUrl=${window.location.href}`
// 微信的地址
const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
redirectURI
)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// 打开地址
window.location.href = wechatUrl
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论