// store/index.js import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); export default new Vuex.Store({ state: { coureLogin: uni.getStorageSync('coureLogin') || 0, webviewUrl: '', wsDanmuUrl: 'wss://userapp.moonxiang.com', // 弹幕评论接口地址 //红包领取规则: answerType: 1, //红包领取规则 0:完课且最后一分钟(第二次无需最后一分钟), 1:按完课百分比答题领红包 isSpare:0, // 0,主要小程序,1:备选 uploadFile: 'https://userapp.moonxiang.com', imgpath: 'https://czwh.obs.cn-southwest-2.myhuaweicloud.com',//北京存在文化 logoname:'红蚂蚁一', // appid:'wx1c32ab023bfd109e',//松间食养记(存梦清香养身心)大号 // appid:'wxcebb0a6606f3fbcf',//食养顺节气(存梦茶韵食养岁服务) // appid:'wxc791ecb9e57393a7',//轻食养日常(存梦食生养服务C) // appid:'wx621a877efa724b11',//食养轻指南(存梦食养服务) // appid:'wxd678793558f49b51',//新食养元气 // appid:'wx43cd5ff4bda5fbda',//慧谷食养坊(夏伟) // appid:'wx47a94955a5033eb8',//慧谷轻食养(夏伟) // appid:'wxfe0c13a96401bdda',//慧谷本草养(夏伟) // appid:'wxa5ca1c35d6a1e5ea',//慧谷食补家(夏伟) // appid:'wx19d8cd13192e3aa5',//谷间食养集(夏伟) // appid:'wxb5591fec9dc626bc',//生活食养记(二十一) // appid:'wxe5b408e5a1040226',//三餐润养记(二十一) // appid:'wx1954dddf77b2dca8',//轻食润养时光(二十一) // appid:'wx51b601b53573f20e',//轻养家食记(二十一) // appid:'wxdc5bc47484f1959f',//生活养食记(二十一) appid:'wx32467b1d3db7e085',//其他(夏伟) }, getters: { coureLogin: (state) => state.coureLogin, }, mutations: { setCount(state, value) { state.count = value; }, setUserInfo(state, info) { state.userInfo = info; }, setWebviewUrl(state, value) { state.webviewUrl = value; }, setCoureLogin(state, payload) { uni.setStorageSync('coureLogin', payload); state.coureLogin = payload; } }, actions: { fetchUser({ commit }) { // const res = await uni.request({ url: '/api/user' }); commit('setUserInfo', 'noe'); }, getWebviewUrl({commit}) { var that = this; var data = { key: 'course.config' } return new Promise((resolve, reject) => { getConfigByKey(data).then(res => { if (res.code == 200) { console.log("getConfigByKey====", JSON.parse(res.data)) let data = JSON.parse(res.data) commit('setWebviewUrl', data.userCourseAuthDomain); resolve() } }).catch(error => { reject(error) }); }) } } });