diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index 386c1a1e..748dcc5f 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -11,6 +11,7 @@ - **SvgIcon** 修复图标样式问题 - **Table** 修复为 table 提供 rowSelection.onChange 时,无法手动变更 table 的选中项的问题 - **Icon** 修复 SvgIcon 缺少部分样式的问题 +- **LockScreen** 修复锁屏功能可以通过刷新页面或复制 URL 打开新的浏览器标签来跳过锁定状态的问题 ## 2.5.2(2021-06-27) diff --git a/src/store/modules/lock.ts b/src/store/modules/lock.ts index f76dffed..6c22dbd1 100644 --- a/src/store/modules/lock.ts +++ b/src/store/modules/lock.ts @@ -23,10 +23,10 @@ export const useLockStore = defineStore({ actions: { setLockInfo(info: LockInfo) { this.lockInfo = Object.assign({}, this.lockInfo, info); - Persistent.setLocal(LOCK_INFO_KEY, this.lockInfo); + Persistent.setLocal(LOCK_INFO_KEY, this.lockInfo, true); }, resetLockInfo() { - Persistent.removeLocal(LOCK_INFO_KEY); + Persistent.removeLocal(LOCK_INFO_KEY, true); this.lockInfo = null; }, // Unlock diff --git a/src/utils/cache/persistent.ts b/src/utils/cache/persistent.ts index 9fc7425d..4ef5f7dc 100644 --- a/src/utils/cache/persistent.ts +++ b/src/utils/cache/persistent.ts @@ -57,12 +57,14 @@ export class Persistent { immediate && ls.set(APP_LOCAL_CACHE_KEY, localMemory.getCache); } - static removeLocal(key: LocalKeys): void { + static removeLocal(key: LocalKeys, immediate = false): void { localMemory.remove(key); + immediate && ls.set(APP_LOCAL_CACHE_KEY, localMemory.getCache); } - static clearLocal(): void { + static clearLocal(immediate = false): void { localMemory.clear(); + immediate && ls.clear(); } static getSession(key: SessionKeys) { @@ -74,16 +76,22 @@ export class Persistent { immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache); } - static removeSession(key: SessionKeys): void { + static removeSession(key: SessionKeys, immediate = false): void { sessionMemory.remove(key); + immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache); } - static clearSession(): void { + static clearSession(immediate = false): void { sessionMemory.clear(); + immediate && ss.clear(); } - static clearAll() { + static clearAll(immediate = false) { sessionMemory.clear(); localMemory.clear(); + if (immediate) { + ls.clear(); + ss.clear(); + } } }