| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // 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:0, // 0,主要小程序,1:备选
- uploadFile: 'https://userapp.cqsft.vip',
- imgpath: 'https://kuanyitang-1317640934.cos.ap-shanghai.myqcloud.com',//宽益堂商城图片请求地址
- // https://kuanyitang-1317640934.cos.ap-shanghai.myqcloud.com/shop 宽益堂商城图片链接
- logoname:'宽益堂',
- appid:'wx815ce2951d362097',//宽益堂
- },
- 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)
- });
- })
- }
- }
- });
|