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