index.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // store/index.js
  2. import Vue from 'vue';
  3. import Vuex from 'vuex';
  4. Vue.use(Vuex);
  5. export default new Vuex.Store({
  6. state: {
  7. coureLogin: uni.getStorageSync('coureLogin') || 0,
  8. webviewUrl: '',
  9. wsDanmuUrl: 'wss://userapp.moonxiang.com', // 弹幕评论接口地址
  10. //红包领取规则:
  11. answerType: 1, //红包领取规则 0:完课且最后一分钟(第二次无需最后一分钟), 1:按完课百分比答题领红包
  12. isSpare:0, // 0,主要小程序,1:备选
  13. uploadFile: 'https://userapp.moonxiang.com',
  14. imgpath: 'https://czwh.obs.cn-southwest-2.myhuaweicloud.com',//北京存在文化
  15. logoname:'红蚂蚁一',
  16. // appid:'wx1c32ab023bfd109e',//松间食养记(存梦清香养身心)大号
  17. // appid:'wxcebb0a6606f3fbcf',//食养顺节气(存梦茶韵食养岁服务)
  18. // appid:'wxc791ecb9e57393a7',//轻食养日常(存梦食生养服务C)
  19. // appid:'wx621a877efa724b11',//食养轻指南(存梦食养服务)
  20. // appid:'wxd678793558f49b51',//新食养元气
  21. // appid:'wx43cd5ff4bda5fbda',//慧谷食养坊(夏伟)
  22. // appid:'wx47a94955a5033eb8',//慧谷轻食养(夏伟)
  23. // appid:'wxfe0c13a96401bdda',//慧谷本草养(夏伟)
  24. // appid:'wxa5ca1c35d6a1e5ea',//慧谷食补家(夏伟)
  25. // appid:'wx19d8cd13192e3aa5',//谷间食养集(夏伟)
  26. // appid:'wxb5591fec9dc626bc',//生活食养记(二十一)
  27. // appid:'wxe5b408e5a1040226',//三餐润养记(二十一)
  28. // appid:'wx1954dddf77b2dca8',//轻食润养时光(二十一)
  29. // appid:'wx51b601b53573f20e',//轻养家食记(二十一)
  30. // appid:'wxdc5bc47484f1959f',//生活养食记(二十一)
  31. appid:'wx32467b1d3db7e085',//其他(夏伟)
  32. },
  33. getters: {
  34. coureLogin: (state) => state.coureLogin,
  35. },
  36. mutations: {
  37. setCount(state, value) {
  38. state.count = value;
  39. },
  40. setUserInfo(state, info) {
  41. state.userInfo = info;
  42. },
  43. setWebviewUrl(state, value) {
  44. state.webviewUrl = value;
  45. },
  46. setCoureLogin(state, payload) {
  47. uni.setStorageSync('coureLogin', payload);
  48. state.coureLogin = payload;
  49. }
  50. },
  51. actions: {
  52. fetchUser({ commit }) {
  53. // const res = await uni.request({ url: '/api/user' });
  54. commit('setUserInfo', 'noe');
  55. },
  56. getWebviewUrl({commit}) {
  57. var that = this;
  58. var data = {
  59. key: 'course.config'
  60. }
  61. return new Promise((resolve, reject) => {
  62. getConfigByKey(data).then(res => {
  63. if (res.code == 200) {
  64. console.log("getConfigByKey====", JSON.parse(res.data))
  65. let data = JSON.parse(res.data)
  66. commit('setWebviewUrl', data.userCourseAuthDomain);
  67. resolve()
  68. }
  69. }).catch(error => {
  70. reject(error)
  71. });
  72. })
  73. }
  74. }
  75. });