feat: 项目初始化

This commit is contained in:
tianyongbao
2025-10-11 22:48:19 +08:00
parent 3a51eed514
commit 7e10c62cf9
87 changed files with 46791 additions and 36 deletions

59
src/store/index.ts Normal file
View File

@@ -0,0 +1,59 @@
import { defineStore } from 'pinia';
import Taro from '@tarojs/taro';
export const useRootUserStore = defineStore('rootUser', {
state: () => ({
rootUserId: Taro.getStorageSync('RootUserId') || null,
userId: Taro.getStorageSync('UserId') || null,
rootUserName: Taro.getStorageSync('RootUserName') || "鱼测云",
loginStatus: Taro.getStorageSync('LoginStatus') || 0,
unLogin: Taro.getStorageSync('UnLogin') || 1,
noticeRead: Taro.getStorageSync('NoticeRead') || 0,
}),
getters: {
getRootUserId(): string {
return this.rootUserId;
},
getUserId(): string {
return this.userId;
},
getRootUserName(): string {
return this.rootUserName;
},
getLoginStatus(): string {
return this.loginStatus;
},
getUnLogin(): string {
return this.unLogin;
},
getNoticeRead(): string {
return this.noticeRead;
},
},
actions: {
updateRootUserId(newId: string) {
this.rootUserId = newId;
Taro.setStorageSync('RootUserId', newId);
},
updateUserId(newId: string) {
this.userId = newId;
Taro.setStorageSync('UserId', newId);
},
updateRootUserName(name: string) {
this.rootUserName = name;
Taro.setStorageSync('RootUserName', name);
},
updateLoginStatus(status: number) {
this.loginStatus = status;
Taro.setStorageSync('LoginStatus', status);
},
updateUnLogin(status: number) {
this.unLogin = status;
Taro.setStorageSync('UnLogin', status);
},
updateNoticeRead(status: number) {
this.noticeRead = status;
Taro.setStorageSync('NoticeRead', status);
}
}
});