jiuyiUniapp/jiuyi2/store/index.js

88 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-12-31 17:07:01 +08:00
import {
createStore
} from 'vuex'
2024-12-18 15:46:27 +08:00
export default createStore({
state: {
// 用户信息
userinfo: {},
// tabbar当前的模式 default视频端 shop商城端
tabbarMode: 'default',
// 闹钟时间
alarmTime: '',
2024-12-31 17:07:01 +08:00
// 资产
2025-01-02 01:01:23 +08:00
purse: {
balance: 0,
fruit: 0,
score: 0,
seed: 0,
},
2025-01-02 23:36:48 +08:00
// 任务
task: {
//任务类型 0.任务读秒 1.流量点(种子)读秒
taskType: 0,
//有效时长
viewingDuration: 0,
},
2025-01-05 15:43:14 +08:00
// 各种变量配置
config: {
"DAY_POINTS_RELEASE": 0.3, //每日积分释放
"TASK_READING_SECOND": 300, //任务读秒
"EFFECTIVE_SECONDS": 300, //有效读秒
"EFFECTIVE_VIDEO_TIME": 20, //有效视频时间
2025-01-25 21:43:01 +08:00
"UNLOCK_FLOW_STATISTICS": 30, //解锁流量统计
2025-01-05 15:43:14 +08:00
},
// 云端最新版本信息
versionCloud: {
"status": "0",
"versionCode": 100,
"versionName": "1.0.0",
"downloadUrl": "",
"updateContent": "",
"isForce": 0
},
2024-12-18 15:46:27 +08:00
},
mutations: {
// 获取内容
setState(state, option) {
// 键值
const key = option.key
// 包
const value = option.value
// 修改对应内容
state[key] = value
},
// 设置用户信息
2024-12-31 17:07:01 +08:00
setUserInfo(state, value) {
state.userinfo = value
2024-12-18 15:46:27 +08:00
},
// 设置 tabbar 模式
setTabbarMode(state, mode) {
state.tabbarMode = mode
},
},
getters: {
getUserInfo(state) {
return state.userinfo
},
getTabbarMode(state) {
return state.tabbarMode
},
},
actions: {
2024-12-31 17:07:01 +08:00
updateUserInfo({
commit
}, payload) {
2024-12-18 15:46:27 +08:00
commit('setUserInfo', payload)
},
2024-12-31 17:07:01 +08:00
changeTabbarMode({
commit
}, mode) {
2024-12-18 15:46:27 +08:00
commit('setTabbarMode', mode)
},
}
})