添加微信登录

This commit is contained in:
yi-ge 2020-07-22 22:48:29 +08:00
parent 687f5c5c68
commit 209d25f204

View File

@ -636,9 +636,21 @@ export default {
type: 'get',
url: 'https://weixin.openapi.site/check?uuid=' + uuid + (last ? '&last=' + last : ''),
timeout: 6e4
}).then((res) => {
}).then(async (res) => {
if (res.data.status === 405) {
alert(res.data.result.code)
const { data } = await this.$axios.post(`${process.env.baseURL}/visitor/user/weixin`, {
code: res.data.result.code
})
if (data.status !== 1) {
this.$toasted.show('微信登录失败,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})
return
}
window.authSuccess(data)
} else if (res.data.status === 404) {
this.getCode(uuid, res.data.result.wxErrCode)
} else if (res.data.status === 403) {
@ -676,7 +688,7 @@ export default {
} else {
this.commentLoading = false
this.currentLoginType = null
this.$toasted.show('获取微信登录所需参数错误,请暂时换用其它登录方式或重试。', {
this.$toasted.show('获取微信登录所需参数错误,请重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})
@ -685,7 +697,7 @@ export default {
this.commentLoading = false
this.currentLoginType = null
this.useWeixinLogin = false
this.$toasted.show('暂时无法使用Github登录尝试其它登录方式或重试。', {
this.$toasted.show('暂时无法使用Github登录重试或换用其它登录方式。', {
position: 'top-center',
duration: 5000
})