提交 d7b84c78 作者: 无木

fix(lock-screen): fix lock-screen can skip on new window

修复锁屏功能可以通过刷新页面或复制 URL 打开新的浏览器标签来跳过锁定状态的问题
上级 c99cf5e5
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
- **SvgIcon** 修复图标样式问题 - **SvgIcon** 修复图标样式问题
- **Table** 修复为 table 提供 rowSelection.onChange 时,无法手动变更 table 的选中项的问题 - **Table** 修复为 table 提供 rowSelection.onChange 时,无法手动变更 table 的选中项的问题
- **Icon** 修复 SvgIcon 缺少部分样式的问题 - **Icon** 修复 SvgIcon 缺少部分样式的问题
- **LockScreen** 修复锁屏功能可以通过刷新页面或复制 URL 打开新的浏览器标签来跳过锁定状态的问题
## 2.5.2(2021-06-27) ## 2.5.2(2021-06-27)
......
...@@ -23,10 +23,10 @@ export const useLockStore = defineStore({ ...@@ -23,10 +23,10 @@ export const useLockStore = defineStore({
actions: { actions: {
setLockInfo(info: LockInfo) { setLockInfo(info: LockInfo) {
this.lockInfo = Object.assign({}, this.lockInfo, info); this.lockInfo = Object.assign({}, this.lockInfo, info);
Persistent.setLocal(LOCK_INFO_KEY, this.lockInfo); Persistent.setLocal(LOCK_INFO_KEY, this.lockInfo, true);
}, },
resetLockInfo() { resetLockInfo() {
Persistent.removeLocal(LOCK_INFO_KEY); Persistent.removeLocal(LOCK_INFO_KEY, true);
this.lockInfo = null; this.lockInfo = null;
}, },
// Unlock // Unlock
......
...@@ -57,12 +57,14 @@ export class Persistent { ...@@ -57,12 +57,14 @@ export class Persistent {
immediate && ls.set(APP_LOCAL_CACHE_KEY, localMemory.getCache); immediate && ls.set(APP_LOCAL_CACHE_KEY, localMemory.getCache);
} }
static removeLocal(key: LocalKeys): void { static removeLocal(key: LocalKeys, immediate = false): void {
localMemory.remove(key); localMemory.remove(key);
immediate && ls.set(APP_LOCAL_CACHE_KEY, localMemory.getCache);
} }
static clearLocal(): void { static clearLocal(immediate = false): void {
localMemory.clear(); localMemory.clear();
immediate && ls.clear();
} }
static getSession<T>(key: SessionKeys) { static getSession<T>(key: SessionKeys) {
...@@ -74,16 +76,22 @@ export class Persistent { ...@@ -74,16 +76,22 @@ export class Persistent {
immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache); immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache);
} }
static removeSession(key: SessionKeys): void { static removeSession(key: SessionKeys, immediate = false): void {
sessionMemory.remove(key); sessionMemory.remove(key);
immediate && ss.set(APP_SESSION_CACHE_KEY, sessionMemory.getCache);
} }
static clearSession(): void { static clearSession(immediate = false): void {
sessionMemory.clear(); sessionMemory.clear();
immediate && ss.clear();
} }
static clearAll() { static clearAll(immediate = false) {
sessionMemory.clear(); sessionMemory.clear();
localMemory.clear(); localMemory.clear();
if (immediate) {
ls.clear();
ss.clear();
}
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论