添加微信登录

This commit is contained in:
yi-ge 2020-07-22 23:53:37 +08:00
parent 209d25f204
commit 0b02bf7838

View File

@ -678,26 +678,33 @@ export default {
this.useWeixinLogin = true
this.commentLoading = true
try {
const { data } = await this.$axios.get('https://weixin.openapi.site/img?appid=wx2d1d6aa2f86768d7&redirect_uri=https://wyr.me')
if (data.status === 1) {
const uuid = data.result.wxUUID
this.weixinLoginQrcode = data.result.imgData
this.getCode(uuid)
this.commentLoading = false
} else {
if (navigator.userAgent.toLowerCase().includes('micromessenger')) { //
this.commentLoading = false
this.currentLoginType = null
this.$toasted.show('获取微信登录所需参数错误,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})
this.useWeixinLogin = false
window.location.href = `https://open.weixin.qq.com/connect/authorize?appid=wx9d5e677f533d1e84&redirect_uri=${encodeURIComponent('https://tool.sercretcore.com/auth.php')}&response_type=code&scope=snsapi_userinfo&state=blog-${this.postID}#wechat_redirect`
} else {
const { data } = await this.$axios.get('https://weixin.openapi.site/img?appid=wx2d1d6aa2f86768d7&redirect_uri=https://wyr.me')
if (data.status === 1) {
const uuid = data.result.wxUUID
this.weixinLoginQrcode = data.result.imgData
this.getCode(uuid)
this.commentLoading = false
} else {
this.commentLoading = false
this.currentLoginType = null
this.$toasted.show('获取微信登录所需参数错误,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})
}
}
} catch (err) {
this.commentLoading = false
this.currentLoginType = null
this.useWeixinLogin = false
this.$toasted.show('暂时无法使用Github登录请重试或换用其它登录方式。', {
this.$toasted.show('暂时无法使用微信登录,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})