Files
super_video/src/stores/modules/vlog.ts
T

55 lines
1.2 KiB
TypeScript

import { defineStore } from 'pinia'
import { ref } from 'vue'
/**
* Vlog store - manages Vlog information
*/
export const useVlogStore = defineStore(
'vlog',
() => {
//State
//vlog-任务取景框引导
const isGuideVlogTask = ref<boolean>(true)
//vlog-是否解锁完成前置(观看视频)
const isVlogUnlock = ref<boolean>(false)
//vlog-发现与记录解锁进度
const vlogUnlockProgress = ref<number>(0)
//Actions
function setIsGuideVlogTask(value: boolean): void {
isGuideVlogTask.value = value
}
function setIsVlogUnlock(value: boolean): void {
isVlogUnlock.value = value
}
function setVlogUnlockProgress(value: number): void {
vlogUnlockProgress.value = value
}
// Reset all Vlog-related persistent state
function resetVlogState(): void {
isGuideVlogTask.value = true
isVlogUnlock.value = false
vlogUnlockProgress.value = 0
}
return {
//State
setIsGuideVlogTask,
setIsVlogUnlock,
setVlogUnlockProgress,
resetVlogState,
//Actions
isGuideVlogTask,
isVlogUnlock,
vlogUnlockProgress
}
},
{
persist: true
}
)