From 6bec250f6cfa68e02a7e08f806a944bdfd76e44f Mon Sep 17 00:00:00 2001 From: Xwen <929716663@qq.com> Date: Wed, 10 Jan 2024 22:07:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=8E=88=E6=9D=83=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E4=B9=9F=E5=85=B3=E9=97=AD=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Bbs.Vue3/src/views/Auth/index.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Yi.Bbs.Vue3/src/views/Auth/index.vue b/Yi.Bbs.Vue3/src/views/Auth/index.vue index 7c134541..808ea014 100644 --- a/Yi.Bbs.Vue3/src/views/Auth/index.vue +++ b/Yi.Bbs.Vue3/src/views/Auth/index.vue @@ -15,6 +15,11 @@ const type = ref(route.query.state); const message = ref(""); const scheme = ref(""); const authData = ref(""); +const closeWindow = () => { + setTimeout(() => { + window.close(); + }, 2000); +}; watch( () => code.value, async (val) => { @@ -41,17 +46,15 @@ watch( } } catch (error) { if (error.status === 403) { - setTimeout(() => { - window.close(); - }, 3000); + closeWindow(); } } window.opener.postMessage({ authData: JSON.stringify(authData.value), type: scheme.value, }); - console.log(authData.value, "我是打开的窗口页"); message.value = "授权成功"; + closeWindow(); } }, { immediate: true }