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.

37 lines
728 B

1 month ago
1 month ago
1 month 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. },
  11. mutations : {
  12. // 初始化配置
  13. initConfig(state) {
  14. getConfigList().then(res => {
  15. const configList = {
  16. ...state.configList,
  17. }
  18. if (res.code == 200) {
  19. res.result.forEach(n => {
  20. configList[n.keyName] = n.keyContent;
  21. configList[n.keyName + '_keyValue'] = n.keyValue;
  22. });
  23. }
  24. state.configList = configList
  25. uni.$emit('initConfig', state.configList)
  26. })
  27. },
  28. },
  29. modules: {
  30. user
  31. },
  32. getters
  33. })
  34. export default store