import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import * as api from '@/api'
|
|
|
|
Vue.use(Vuex)
|
|
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
// 存放状态
|
|
configList: [],
|
|
careerList: [],
|
|
qualificationList: []
|
|
},
|
|
mutations: {
|
|
setConfigList(state, data) {
|
|
state.configList = data
|
|
},
|
|
setCareerList(state, data) {
|
|
state.careerList = data
|
|
},
|
|
setQualificationList(state, data) {
|
|
state.qualificationList = data
|
|
}
|
|
},
|
|
actions: {
|
|
// 查询配置列表
|
|
async getConfig({ commit }) {
|
|
const res = await api.config.queryConfigList()
|
|
// if (res.code === 0) {
|
|
commit('setConfigList', res.result.records)
|
|
// } else {
|
|
// uni.showToast({ title: res.msg, icon: 'error' })
|
|
// }
|
|
},
|
|
|
|
// 查询职业列表
|
|
async getCareer({ commit }) {
|
|
const res = await api.config.queryCareerList()
|
|
// if (res.code === 0) {
|
|
commit('setCareerList', res.result.records)
|
|
// } else {
|
|
// uni.showToast({ title: res.msg, icon: 'error' })
|
|
// }
|
|
},
|
|
|
|
// 查询学历列表
|
|
async getQualification({ commit }) {
|
|
const res = await api.config.queryQualificationList()
|
|
// if (res.code === 0) {
|
|
commit('setQualificationList', res.result.records)
|
|
// } else {
|
|
// uni.showToast({ title: res.msg, icon: 'error' })
|
|
// }
|
|
}
|
|
}
|
|
})
|
|
|
|
export default store
|