| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- // 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: {
- coureLogin: uni.getStorageSync('coureLogin') || 0,
- webviewUrl: '',
- wsDanmuUrl: 'wss://userapp.ysya.top', // 弹幕评论接口地址
- //红包领取规则:
- answerType: 1, //红包领取规则 0:完课且最后一分钟(第二次无需最后一分钟), 1:按完课百分比答题领红包
- isSpare:1, // 0,主要小程序,1:备选
- uploadFile: 'https://userapp.ysya.top',
- imgpath: 'https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com',//益 寿缘图片请求地址
- logoname:'久运天天康 ',
- // appid:'wx0d1a3dd485268521',//益 寿缘
- // appid:'wx50bcb040b4963a7e',//营口市康安健康服务(益 寿缘)
- // appid:'wx6d21646ba042d66f',//久运健康线上服务(益 寿缘)
- appid:'wx77eb4fff8ea1384b',//营口市康安健康服务(益 寿缘)
- },
- 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;
- }
- },
- getters: {
- coureLogin: (state) => state.coureLogin,
- },
- 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)
- });
- })
- }
- }
- });
|