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(); + } +});