公众号登录完成

This commit is contained in:
aixianling
2022-12-29 15:39:15 +08:00
parent 0c51695264
commit affae930e0
2 changed files with 6 additions and 1 deletions

View File

@@ -205,6 +205,7 @@ let timer = {}
const oauth2Weixin = params => { const oauth2Weixin = params => {
const redirect = qs.parseUrl(location.href) const redirect = qs.parseUrl(location.href)
delete redirect.query.code delete redirect.query.code
delete redirect.query.state
return qs.stringifyUrl({ return qs.stringifyUrl({
url: "https://open.weixin.qq.com/connect/oauth2/authorize", url: "https://open.weixin.qq.com/connect/oauth2/authorize",
query: { query: {

View File

@@ -18,6 +18,7 @@ export default {
appName: "投票详情", appName: "投票详情",
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
wxCode: v => v.$route.query.code
}, },
data() { data() {
return { return {
@@ -42,12 +43,15 @@ export default {
} }
}) })
} else {//已登录,直接投票 } else {//已登录,直接投票
console.log("投票")
} }
}, },
}, },
onShow() { onShow() {
this.getDetail() this.getDetail()
if (!!this.wxCode) {
this.getWechatToken({module: "AppVote", code: this.wxCode}).then(this.handleVote)
}
} }
} }
</script> </script>