提交 5b66bd6d authored 作者: lihuihui's avatar lihuihui

update

上级 c60861d4
...@@ -193,13 +193,13 @@ export default { ...@@ -193,13 +193,13 @@ export default {
return !!item.find(f => f.enable_edit === false) return !!item.find(f => f.enable_edit === false)
}, },
// 微信授权 // 微信授权
wxAuthorize() { wxAuthorize(call) {
if (!this.$route.query.code) { if (!this.$route.query.code) {
const url = encodeURIComponent(window.location.href) const url = encodeURIComponent(window.location.href)
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa41d0081d4889921&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect` window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa41d0081d4889921&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
} else { } else {
getOpenid({ code: this.$route.query.code, identity: 'road' }).then(res => { getOpenid({ code: this.$route.query.code, identity: 'road' }).then(res => {
window.sessionStorage.openId = res.openid call(res)
}) })
} }
}, },
...@@ -255,7 +255,10 @@ export default { ...@@ -255,7 +255,10 @@ export default {
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
} else { } else {
if (!window.sessionStorage.openId) { if (!window.sessionStorage.openId) {
this.wxAuthorize() this.wxAuthorize(res => {
window.sessionStorage.openId = res.openid
this.$emit('next', res.data)
})
} else { } else {
this.$emit('next', res.data) this.$emit('next', res.data)
} }
...@@ -266,7 +269,10 @@ export default { ...@@ -266,7 +269,10 @@ export default {
this.$router.push({ path: '/' }) this.$router.push({ path: '/' })
} else { } else {
if (!window.sessionStorage.openId) { if (!window.sessionStorage.openId) {
this.wxAuthorize() this.wxAuthorize(res => {
window.sessionStorage.openId = res.openid
this.$emit('next', res.data)
})
} else { } else {
this.$emit('next', res.data) this.$emit('next', res.data)
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论