From 817712029b804c694837d3b654e29445a2584a30 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 18 Jan 2024 10:11:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9A=E4=B9=89=E9=94=81=E5=B1=8F?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/LockScreen/index.vue | 19 +++++++++++-------- src/plugins/auth-token.ts | 2 +- src/store/modules/locked.ts | 19 ++++++++----------- .../configManage/softwareManage/index.vue | 3 +-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/components/LockScreen/index.vue b/src/components/LockScreen/index.vue index 77dcb96d..1e97b8ee 100644 --- a/src/components/LockScreen/index.vue +++ b/src/components/LockScreen/index.vue @@ -8,6 +8,7 @@ import useLockedStore from '@/store/modules/locked'; import { getConfigKey } from '@/api/system/config'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { useRouter } from 'vue-router'; +import { computed } from 'vue'; const lockedStore = useLockedStore(); const userStore = useUserStore(); const router = useRouter(); @@ -24,7 +25,7 @@ function resetTimeout() { clearTimeout(timeoutId); } timeoutId = setTimeout(() => { - lockedStore.fnLock('lock', true); + lockedStore.fnLock('lock'); }, timeoutDuration); } @@ -37,7 +38,7 @@ function handleUnlock() { if (res.code === RESULT_CODE_SUCCESS) { message.success(t('components.LockScreen.validSucc'), 3); password.value = ''; - lockedStore.fnLock('lock', false); + lockedStore.fnLock('none'); } else { message.error(t('components.LockScreen.validError'), 3); } @@ -46,10 +47,12 @@ function handleUnlock() { /**返回登录界面 */ function backLogin() { - lockedStore.fnLock('lock', false); + lockedStore.fnLock('none'); userStore.fnLogOut().finally(() => router.push({ name: 'Login' })); } +const isLocked = computed(() => lockedStore.type !== 'none'); + onMounted(() => { getConfigKey('sys.lockTime') .then(res => { @@ -66,8 +69,8 @@ onMounted(() => { window.addEventListener('keydown', resetTimeout); } // 本地锁定同时是登录状态 - if (lockedStore.isLocked && getToken()) { - lockedStore.fnLock('lock', true); + if (lockedStore.type === 'lock' && getToken()) { + lockedStore.fnLock('lock'); } }); }); @@ -81,7 +84,7 @@ onUnmounted(() => {