fix: 定义锁屏类型
This commit is contained in:
@@ -6,18 +6,15 @@ import { defineStore } from 'pinia';
|
||||
|
||||
/**锁屏信息类型 */
|
||||
type Locked = {
|
||||
/**锁定状态 */
|
||||
isLocked: boolean;
|
||||
/**锁屏类型 */
|
||||
lockType: 'lock' | 'reload';
|
||||
/**超时锁屏时间,秒*/
|
||||
type: 'none' | 'lock' | 'reload' | string;
|
||||
/**lock 超时锁屏时间,秒*/
|
||||
lockTimeout: number;
|
||||
};
|
||||
|
||||
const useLockedStore = defineStore('locked', {
|
||||
state: (): Locked => ({
|
||||
isLocked: localGet(CACHE_LOCAL_LOCK) === 'true',
|
||||
lockType: 'lock',
|
||||
type: localGet(CACHE_LOCAL_LOCK) || 'none',
|
||||
lockTimeout: 0,
|
||||
}),
|
||||
getters: {},
|
||||
@@ -26,7 +23,8 @@ const useLockedStore = defineStore('locked', {
|
||||
async relaodWait() {
|
||||
const res = await getSysConf();
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
this.fnLock('lock', false);
|
||||
this.fnLock('none');
|
||||
window.location.reload();
|
||||
} else {
|
||||
// 延迟5秒
|
||||
setTimeout(() => {
|
||||
@@ -35,10 +33,9 @@ const useLockedStore = defineStore('locked', {
|
||||
}
|
||||
},
|
||||
// 设置锁定
|
||||
async fnLock(type: 'lock' | 'reload', v: boolean) {
|
||||
this.lockType = type;
|
||||
this.isLocked = v;
|
||||
localSet(CACHE_LOCAL_LOCK, `${v}`);
|
||||
async fnLock(type: 'none' | 'lock' | 'reload') {
|
||||
this.type = type;
|
||||
localSet(CACHE_LOCAL_LOCK, type);
|
||||
if (type === 'reload') {
|
||||
// 延迟5秒
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user