fix: 锁屏重启判断
This commit is contained in:
@@ -61,19 +61,15 @@ onMounted(() => {
|
|||||||
timeoutDuration = res.data * 1000;
|
timeoutDuration = res.data * 1000;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.then(() => {
|
||||||
if (timeoutDuration !== 0) {
|
if (timeoutDuration !== 0) {
|
||||||
resetTimeout();
|
resetTimeout();
|
||||||
// 监听用户的操作,重置超时时间
|
// 监听用户的操作,重置超时时间
|
||||||
window.addEventListener('mousemove', resetTimeout);
|
window.addEventListener('mousemove', resetTimeout);
|
||||||
window.addEventListener('keydown', resetTimeout);
|
window.addEventListener('keydown', resetTimeout);
|
||||||
}
|
}
|
||||||
// 本地锁定同时是登录状态
|
// 本地锁定同时是登录状态
|
||||||
if (lockedStore.type === 'lock' && getToken()) {
|
lockedStore.fnLock(lockedStore.type);
|
||||||
lockedStore.fnLock('lock');
|
|
||||||
} else if (lockedStore.type === 'reload') {
|
|
||||||
lockedStore.relaodWait();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const useLockedStore = defineStore('locked', {
|
|||||||
this.fnLock('none');
|
this.fnLock('none');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (error) {
|
||||||
// 延迟5秒
|
// 延迟5秒
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.relaodWait();
|
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;
|
this.type = type;
|
||||||
localSet(CACHE_LOCAL_LOCK, type);
|
localSet(CACHE_LOCAL_LOCK, type);
|
||||||
if (type === 'reload') {
|
if (type === 'reload') {
|
||||||
|
|||||||
Reference in New Issue
Block a user