From ce667a9f9e8b5eacf14ed461f63c128c16aa1ede Mon Sep 17 00:00:00 2001 From: Xwen <929716663@qq.com> Date: Wed, 10 Jan 2024 22:01:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=87=8D=E5=A4=8D=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=8A=B6=E6=80=81=E7=A0=81=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=AA=97=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Bbs.Vue3/src/views/Auth/index.vue | 20 +++++++++++++------ Yi.Bbs.Vue3/src/views/login/index.vue | 10 ++++++++++ .../src/views/profile/AccountSetting.vue | 3 --- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Yi.Bbs.Vue3/src/views/Auth/index.vue b/Yi.Bbs.Vue3/src/views/Auth/index.vue index 82292cd6..7c134541 100644 --- a/Yi.Bbs.Vue3/src/views/Auth/index.vue +++ b/Yi.Bbs.Vue3/src/views/Auth/index.vue @@ -31,12 +31,20 @@ watch( scheme.value = "QQ"; break; } - if (type.value === "0") { - const { data } = await authOtherLogin({ code: val }, scheme.value); - authData.value = data; - } else if (type.value === "1") { - const { data } = await authOtherBind({ code: val }, scheme.value); - authData.value = data; + try { + if (type.value === "0") { + const { data } = await authOtherLogin({ code: val }, scheme.value); + authData.value = data; + } else if (type.value === "1") { + const { data } = await authOtherBind({ code: val }, scheme.value); + authData.value = data; + } + } catch (error) { + if (error.status === 403) { + setTimeout(() => { + window.close(); + }, 3000); + } } window.opener.postMessage({ authData: JSON.stringify(authData.value), diff --git a/Yi.Bbs.Vue3/src/views/login/index.vue b/Yi.Bbs.Vue3/src/views/login/index.vue index 09197fe2..9398df1f 100644 --- a/Yi.Bbs.Vue3/src/views/login/index.vue +++ b/Yi.Bbs.Vue3/src/views/login/index.vue @@ -318,6 +318,16 @@ const handleGiteeLogin = () => { "width=500,height=500,left=50,top=50" ); }; + +window.addEventListener("message", async (e) => { + const { authData, type } = e.data; + console.log("我是登录页", authData); + console.log("我是登录页", type); + if (e.data) { + await checkList(); + window.close(); + } +});