index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // store/index.js
  2. import Vue from 'vue';
  3. import Vuex from 'vuex';
  4. Vue.use(Vuex);
  5. import {
  6. getConfigByKey
  7. } from '@/api/index.js'
  8. export default new Vuex.Store({
  9. state: {
  10. webviewUrl: '',
  11. wsDanmuUrl: 'wss://userapp.cqsft.vip', // 弹幕评论接口地址
  12. //红包领取规则:
  13. answerType: 1, //红包领取规则 0:完课且最后一分钟(第二次无需最后一分钟), 1:按完课百分比答题领红包
  14. isSpare:1, // 0,主要小程序,1:备选
  15. uploadFile: 'https://userapp.cqsft.vip',
  16. imgpath: 'https://zkzh-2025.oss-cn-beijing.aliyuncs.com',//中 康未来智慧药房图片请求地址
  17. // https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop 中康商城图片链接
  18. logoname:'易通科技DZ',
  19. // appid:'wx6e0e997b86ff39e2',//SX未来智慧药房
  20. // appid:'wx9bc794762a9960c7',//中康智慧药房
  21. // appid:'wx83024d042825b5d4',//未来智慧YF
  22. // appid:'wx946aa389952420f1',//中康与智慧大药房
  23. // appid:'wxf72a442877c3dab7',//中康药房
  24. // appid:'wx6fd00d804da74a1f',//中 康未来智慧YF
  25. // appid:'wx4df6c0cc2b2fdf87',//咿辰网络
  26. appid:'wx13c3b7a9cf190246',//易通科技DZ
  27. },
  28. mutations: {
  29. setCount(state, value) {
  30. state.count = value;
  31. },
  32. setUserInfo(state, info) {
  33. state.userInfo = info;
  34. },
  35. setWebviewUrl(state, value) {
  36. state.webviewUrl = value;
  37. }
  38. },
  39. actions: {
  40. fetchUser({ commit }) {
  41. // const res = await uni.request({ url: '/api/user' });
  42. commit('setUserInfo', 'noe');
  43. },
  44. getWebviewUrl({commit}) {
  45. var that = this;
  46. var data = {
  47. key: 'course.config'
  48. }
  49. return new Promise((resolve, reject) => {
  50. getConfigByKey(data).then(res => {
  51. if (res.code == 200) {
  52. console.log("getConfigByKey====", JSON.parse(res.data))
  53. let data = JSON.parse(res.data)
  54. commit('setWebviewUrl', data.userCourseAuthDomain);
  55. resolve()
  56. }
  57. }).catch(error => {
  58. reject(error)
  59. });
  60. })
  61. }
  62. }
  63. });