From 3f8396a254a3b668c2a2bd05eafb4f2b76b79077 Mon Sep 17 00:00:00 2001 From: yige Date: Wed, 15 Jul 2020 01:22:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0github=E7=99=BB=E9=99=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/auth.vue | 12 ++++++------ pages/post/_id.vue | 7 +------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pages/auth.vue b/pages/auth.vue index 2310228..d131b06 100644 --- a/pages/auth.vue +++ b/pages/auth.vue @@ -13,20 +13,20 @@ export default { async mounted () { const code = this.$route.query.code - if (!code) { this.notice = '

非法访问,缺少授权参数"code"。



返回首页' } + if (!code) { this.notice = '

非法访问,缺少授权参数"code"。



返回首页'; this.$finishLoad(); return } - const { data } = await this.$axios.post('/visitor/user/auth', { + const { data } = await this.$axios.post('http://127.0.0.1:65534/visitor/user/auth', { type: 'github', code }) if (data.status !== 1) { - this.notice = '

授权失败,请再试一次。



返回首页' + this.notice = '

授权失败,请关闭页面从登陆入口再试一次。



返回首页' + this.$finishLoad() + return } - console.log(data) - - window.opener.localStorage.visitorToken = data.token + window.opener.localStorage.visitorToken = data.result window.opener.authSuccess(data) window.close() diff --git a/pages/post/_id.vue b/pages/post/_id.vue index 6f2b438..2b89678 100644 --- a/pages/post/_id.vue +++ b/pages/post/_id.vue @@ -437,12 +437,7 @@ export default { } }, login () { - const newWindow = 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') - - newWindow.onload = function () { - // newWindow.location - // newWindow.close() - } + 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') } }, head () {