From fa69d02bc6f9d83ba8e65740ca362e603597b3e3 Mon Sep 17 00:00:00 2001 From: yi-ge Date: Wed, 22 Jul 2020 18:02:37 +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/.DS_Store | Bin 0 -> 6148 bytes pages/post/_id.vue | 156 ++++++++++++++++++++++++++++++--------------- 2 files changed, 103 insertions(+), 53 deletions(-) create mode 100644 pages/.DS_Store diff --git a/pages/.DS_Store b/pages/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4fb8d414b6b79815ed7e4198201a80eb8283789b GIT binary patch literal 6148 zcmeHK%}T>S5ZE2QMBf{^2dupOc^%(StuVA;AVhwj^nLD23ny_yBtK z=RMSi@I|~kv%3|gdJ|EZf!S|%c4oHwZQ0E-#(1q2EHGv<#tcxzk_pWxg5#(IQqmqo zjy3#F*7RfHL;qzUnjF880o=PXYcjzymcQRWzZpkaUada!(olJLWYjRnDrRN8VxG7S z(Q$JxZ)G(vty?p06okH)9!5dl*bkGPP*;oVS0qY`$EJJplr`Sh{8_Ynp_u2 z?nOzM%6h8C@nMt%qEi#CB*pfWp*%XE!Ouq=FC(IWjc*A=Tce|~ zPzWO+T%`i4RIZ;GT&08G)^U!;LZM1$T+R%2^vqnpP`I2O{I(2d+)+p^F+dD_WMD{j zExi9XzkdIJOrjn!Kn(mV26%bH-KfEm^xZnJIJ|3Z&@)gJj4KqrrGO!?Vu;17cnVYs Z_-!-*9gT%T@PN>VfTV#MV&F#^cm;9BVD|t3 literal 0 HcmV?d00001 diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 92f4b0a..10586ba 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -52,16 +52,10 @@ p(v-if="!comments.length", style="color: #cecece; text-align: center; margin-top: 40px") 暂无内容 .comment-default-commit .login(v-if="!visitorToken") - img(v-show="!useWeixinLogin" class="login-img", src="https://cdn.wyr.me/imgs/GitHub-Login.png", @click="login('github')", style="margin-left: -140px;") - img(v-show="!useWeixinLogin", class="login-img", src="https://cdn.wyr.me/imgs/Weixin-Login.png", @click="login('weixin')") - .comment-loading(v-show="commentLoading") - .allSpinner - .spinner - .bounce1 - .bounce2 - .bounce3 - img(v-show="!commentLoading && useWeixinLogin", class="weixin-qrcode", :src="weixinLoginQrcode") - p(v-show="!commentLoading && useWeixinLogin") 请使用微信扫码登录 + .item(v-for="(item, index) in loginPlatform", :key="index") + transition(name="qrcode") + img(v-show="!commentLoading && useWeixinLogin && currentLoginType === item.type", class="qrcode", :src="weixinLoginQrcode") + img(class="logo", :class="{active: currentLoginType === item.type && useWeixinLogin && !commentLoading, loading: commentLoading && currentLoginType === item.type}", :src="item.logo", @click.stop="login(item.type)") #editor .comment-toolbar .comment-no-userinfo(v-if="!visitorToken") 尚未登陆 @@ -75,6 +69,7 @@ .login(v-show="!visitorToken") img(v-show="!useWeixinLogin" class="login-img", src="https://cdn.wyr.me/imgs/GitHub-Login.png", @click="login('github')", style="margin-left: -140px;") img(v-show="!useWeixinLogin", class="login-img", src="https://cdn.wyr.me/imgs/Weixin-Login.png", @click="login('weixin')") + img(v-show="!useWeixinLogin", class="login-img", src="https://cdn.wyr.me/imgs/QQ-Login.png", @click="login('qq')") .comment-loading(v-show="commentLoading") .allSpinner .spinner @@ -171,7 +166,26 @@ export default { editorReplyObj: null, commentLoading: false, useWeixinLogin: false, - weixinLoginQrcode: null + weixinLoginQrcode: null, + currentLoginType: null, + loginPlatform: [ + { + type: 'github', + logo: 'https://cdn.wyr.me/imgs/GitHub-Login.png' + }, + { + type: 'weixin', + logo: 'https://cdn.wyr.me/imgs/Weixin-Login.png' + }, + { + type: 'qq', + logo: 'https://cdn.wyr.me/imgs/QQ-Login.png' + }, + { + type: 'weibo', + logo: 'https://cdn.wyr.me/imgs/Weibo-Login.png' + } + ] } }, mounted () { @@ -623,15 +637,13 @@ export default { url: 'https://weixin.openapi.site/check?uuid=' + uuid + (last ? '&last=' + last : ''), timeout: 6e4 }).then((res) => { - if (res.status === 405) { - alert(res.data.code) - } else if (res.status === 404) { - console.log(res) - this.getCode(uuid, res.data.wxErrCode) - } else if (res.status === 403) { - console.log(res) - this.getCode(uuid, res.data.wxErrCode) - } else if (res.status === 500) { + if (res.data.status === 405) { + alert(res.data.result.code) + } else if (res.data.status === 404) { + this.getCode(uuid, res.data.result.wxErrCode) + } else if (res.data.status === 403) { + this.getCode(uuid, res.data.result.wxErrCode) + } else if (res.data.status === 500) { this.login('weixin') } else { setTimeout(() => { @@ -646,6 +658,8 @@ export default { } }, async login (type) { + this.currentLoginType = type + this.useWeixinLogin = false if (type === 'github') { window.open('https://github.com/login/oauth/authorize?client_id=ce1673a37333e47e482d&redirect_uri=https://www.wyr.me/auth', 'Github授权', 'scrollbars=yes,resizable=yes,status=no,location=yes,toolbar=no,menubar=no,width=800,height=600,left=0,top=0') } else if (type === 'weixin') { @@ -661,6 +675,7 @@ export default { this.commentLoading = false } else { this.commentLoading = false + this.currentLoginType = null this.$toasted.show('获取微信登录所需参数错误,请暂时换用其它登录方式或重试。', { position: 'top-center', duration: 5000 @@ -668,6 +683,7 @@ export default { } } catch (err) { this.commentLoading = false + this.currentLoginType = null this.useWeixinLogin = false this.$toasted.show('暂时无法使用Github登录,请尝试其它登录方式或重试。', { position: 'top-center', @@ -721,6 +737,10 @@ export default {