- import Vue from 'vue'
- import Vuex from 'vuex'
- import user from '@/store/modules/user'
- import getters from './getters'
-
- import { getConfigList } from '@/api/system/configList'
-
- Vue.use(Vuex)
-
- const store = new Vuex.Store({
- state : {
- configList : {},
- },
- mutations : {
- // 初始化配置
- initConfig(state) {
- getConfigList().then(res => {
- const configList = {
- ...state.configList,
- }
- if (res.code == 200) {
- res.result.forEach(n => {
- configList[n.keyName] = n.keyContent;
- configList[n.keyName + '_keyValue'] = n.keyValue;
- });
- }
- state.configList = configList
- uni.$emit('initConfig', state.configList)
- })
- },
- },
- modules: {
- user
- },
- getters
- })
-
- export default store
|