From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/store/modules/lock.ts | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/store/modules/lock.ts b/src/store/modules/lock.ts
new file mode 100644
index 0000000..68ae1d7
--- /dev/null
+++ b/src/store/modules/lock.ts
@@ -0,0 +1,48 @@
+import { defineStore } from 'pinia'
+import { store } from '@/store'
+
+interface lockInfo {
+ isLock?: boolean
+ password?: string
+}
+
+interface LockState {
+ lockInfo: lockInfo
+}
+
+export const useLockStore = defineStore('lock', {
+ state: (): LockState => {
+ return {
+ lockInfo: {
+ // isLock: false, // 鏄惁閿佸畾灞忓箷
+ // password: '' // 閿佸睆瀵嗙爜
+ }
+ }
+ },
+ getters: {
+ getLockInfo(): lockInfo {
+ return this.lockInfo
+ }
+ },
+ actions: {
+ setLockInfo(lockInfo: lockInfo) {
+ this.lockInfo = lockInfo
+ },
+ resetLockInfo() {
+ this.lockInfo = {}
+ },
+ unLock(password: string) {
+ if (this.lockInfo?.password === password) {
+ this.resetLockInfo()
+ return true
+ } else {
+ return false
+ }
+ }
+ },
+ persist: true
+})
+
+export const useLockStoreWithOut = () => {
+ return useLockStore(store)
+}
--
Gitblit v1.8.0