From 4d7d31f78444324b7d65cce37729cc07c6a25d7a Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 18 Jan 2024 11:42:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=94=81=E5=B1=8F=E9=87=8D=E5=90=AF?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LockScreen/index.vue | 10 +++------- src/store/modules/locked.ts | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/LockScreen/index.vue b/src/components/LockScreen/index.vue index ca085457..5e7f9339 100644 --- a/src/components/LockScreen/index.vue +++ b/src/components/LockScreen/index.vue @@ -61,19 +61,15 @@ onMounted(() => { timeoutDuration = res.data * 1000; } }) - .finally(() => { + .then(() => { if (timeoutDuration !== 0) { resetTimeout(); // 监听用户的操作,重置超时时间 window.addEventListener('mousemove', resetTimeout); window.addEventListener('keydown', resetTimeout); } - // 本地锁定同时是登录状态 - if (lockedStore.type === 'lock' && getToken()) { - lockedStore.fnLock('lock'); - } else if (lockedStore.type === 'reload') { - lockedStore.relaodWait(); - } + // 本地锁定同时是登录状态 + lockedStore.fnLock(lockedStore.type); }); }); diff --git a/src/store/modules/locked.ts b/src/store/modules/locked.ts index 3e0cdde7..25f87cb9 100644 --- a/src/store/modules/locked.ts +++ b/src/store/modules/locked.ts @@ -27,7 +27,7 @@ const useLockedStore = defineStore('locked', { this.fnLock('none'); window.location.reload(); } - } catch (e) { + } catch (error) { // 延迟5秒 setTimeout(() => { this.relaodWait(); @@ -35,7 +35,7 @@ const useLockedStore = defineStore('locked', { } }, // 设置锁定 - async fnLock(type: 'none' | 'lock' | 'reload') { + async fnLock(type: 'none' | 'lock' | 'reload' | string) { this.type = type; localSet(CACHE_LOCAL_LOCK, type); if (type === 'reload') {