refactor: remove unused files, bug fixes and name changes

This commit is contained in:
Hansen Wang
2023-04-24 02:09:39 +08:00
parent e1528823f7
commit 5d891c1f44
32 changed files with 352 additions and 417 deletions

View File

@@ -0,0 +1,31 @@
import { defineStore } from 'pinia';
import { IS_SCREENLOCKED } from '@/store/mutation-types';
import { storage } from '@/utils/Storage';
// 长时间不操作默认锁屏时间
const initTime = 60 * 60;
const isLocked = storage.get(IS_SCREENLOCKED, false);
export type IScreenLockState = {
isLocked: boolean; // 是否锁屏
lockTime: number;
};
export const useScreenLockStore = defineStore({
id: 'app-screen-lock',
state: (): IScreenLockState => ({
isLocked: isLocked === true, // 是否锁屏
lockTime: isLocked == 'true' ? initTime : 0,
}),
getters: {},
actions: {
setLock(payload: boolean) {
this.isLocked = payload;
storage.set(IS_SCREENLOCKED, this.isLocked);
},
setLockTime(payload = initTime) {
this.lockTime = payload;
},
},
});