From 209d25f2046285badc381f228b030d2fe512b941 Mon Sep 17 00:00:00 2001 From: yige Date: Wed, 22 Jul 2020 22:48:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BE=AE=E4=BF=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/post/_id.vue | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 10586ba..0b93f14 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -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 })