123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- //引入pinia
- import { defineStore } from 'pinia'
- import { ref } from 'vue'
- const userInfoStore = defineStore(
- 'userInfo',
- () => {
- //定义正在进行中的计划
- const planCurrentNum = ref<number>(0)
- //定义已完成但是未读的测试记录
- const unreadNum = ref<number>(0)
- //定义token
- const token = ref<string>('')
- //定义用户信息
- const userInfo = ref<any>({
- account: ''
- })
- //信息--查看是否做过了练习测试
- //这个是形状知觉测试的练习测试通过标志
- const isPass = ref<boolean>(false)
- //这个是人脸测试通过的标志
- const isPassETB01 = ref<boolean>(false)
- //这是点探测的标志
- const isPassDot = ref<boolean>(false)
- //将通过状态改变为通过false
- const saveIspass = (flag: string) => {
- //这个是形状知觉的练习测试通过标志
- if (flag == '') {
- isPass.value = true;
- } else if (flag == 'ETB01') {
- isPassETB01.value = true;
- } else if (flag == 'FDOT') {
- isPassDot.value = true
- }
- }
- //保存正在进行中的计划的文本
- const savePlanCurrentNum = (val: number) => {
- planCurrentNum.value = val
- }
- //保存已完成的测试记录-但是未读的
- const saveUnreadNum = (val: number) => {
- unreadNum.value = val;
- }
- //保存token信息
- const saveToken = (val: string) => {
- token.value = val
- }
- //保存用户信息
- const saveUserInfo = (val: any) => {
- //重置用户信息
- userInfo.value = val
- }
- //清除用户信息
- const clearUserInfo = () => {
- userInfo.value = { account: '' }
- token.value = ''
- isPass.value = false
- isPassETB01.value = false
- isPassDot.value = false
- planCurrentNum.value = 0
- unreadNum.value = 0
- }
- return { planCurrentNum, clearUserInfo, savePlanCurrentNum, token, saveToken, userInfo, saveUserInfo, isPass, isPassETB01, isPassDot, saveIspass, unreadNum, saveUnreadNum }
- },
- { persist: true }
- )
- export { userInfoStore }
|