// store/index.js import Vue from 'vue'; import Vuex from 'vuex'; Vue.use(Vuex); import { getConfigByKey } from '@/api/index.js' export default new Vuex.Store({ state: { webviewUrl: '', wsDanmuUrl: 'wss://userapp.cqsft.vip', // 弹幕评论接口地址 //红包领取规则: answerType: 1, //红包领取规则 0:完课且最后一分钟(第二次无需最后一分钟), 1:按完课百分比答题领红包 isSpare:1, // 0,主要小程序,1:备选 uploadFile: 'https://userapp.cqsft.vip', imgpath: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com',//中 康未来智慧药房图片请求地址 // https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop 中康商城图片链接 logoname:'易通科技DZ', // appid:'wx6e0e997b86ff39e2',//SX未来智慧药房 // appid:'wx9bc794762a9960c7',//中康智慧药房 // appid:'wx83024d042825b5d4',//未来智慧YF // appid:'wx946aa389952420f1',//中康与智慧大药房 // appid:'wxf72a442877c3dab7',//中康药房 // appid:'wx6fd00d804da74a1f',//中 康未来智慧YF // appid:'wx4df6c0cc2b2fdf87',//咿辰网络 appid:'wx13c3b7a9cf190246',//易通科技DZ }, mutations: { setCount(state, value) { state.count = value; }, setUserInfo(state, info) { state.userInfo = info; }, setWebviewUrl(state, value) { state.webviewUrl = value; } }, 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) }); }) } } });