You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
985 B

1 week ago
1 week ago
1 week ago
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. import user from '@/store/modules/user'
  4. import getters from './getters'
  5. import { getConfigList } from '@/api/system/configList'
  6. Vue.use(Vuex)
  7. const store = new Vuex.Store({
  8. state : {
  9. configList : {},
  10. position : {},//用户选择的定位信息
  11. buyInfo : {
  12. teacher : null,//用户选择的购买老师
  13. },//用户选择的购买信息
  14. },
  15. mutations : {
  16. // 初始化配置
  17. initConfig(state) {
  18. getConfigList().then(res => {
  19. const configList = {
  20. ...state.configList,
  21. }
  22. if (res.code == 200) {
  23. res.result.forEach(n => {
  24. configList[n.keyName] = n.keyContent;
  25. configList[n.keyName + '_keyValue'] = n.keyValue;
  26. });
  27. }
  28. state.configList = configList
  29. uni.$emit('initConfig', state.configList)
  30. })
  31. },
  32. setPosition(state, position){
  33. state.position = position;
  34. },
  35. },
  36. modules: {
  37. user
  38. },
  39. getters
  40. })
  41. export default store