feat: add the ability to lock the screen (#30)

* feat: 锁屏功能

* feat: 锁屏样式调整

* feat: complete the lock-screen screen and support shortcut keys and preference configuration

---------

Co-authored-by: vince <vince292007@gmail.com>
This commit is contained in:
Laychen
2024-07-12 12:14:09 +08:00
committed by GitHub
parent 61dbb05b5d
commit 06f5d5686d
27 changed files with 482 additions and 48 deletions

View File

@@ -4,19 +4,35 @@ import { defineStore } from 'pinia';
import { useAccessStore } from './access';
export const useAppStore = defineStore('app', () => {
const accessStore = useAccessStore();
const coreTabbarStore = useCoreTabbarStore();
interface AppState {
isLockScreen: boolean;
lockScreenPassword?: string;
}
/**
* 重置所有状态
*/
async function resetAppState() {
accessStore.reset();
coreTabbarStore.$reset();
}
export const useAppStore = defineStore('app', {
actions: {
lockScreen(password: string) {
this.isLockScreen = true;
this.lockScreenPassword = password;
},
return {
resetAppState,
};
resetAppState() {
const accessStore = useAccessStore();
const coreTabbarStore = useCoreTabbarStore();
accessStore.reset();
coreTabbarStore.$reset();
},
unlockScreen() {
this.isLockScreen = false;
this.lockScreenPassword = undefined;
},
},
persist: {
paths: ['isLockScreen', 'lockScreenPassword'],
},
state: (): AppState => ({
isLockScreen: false,
lockScreenPassword: undefined,
}),
});