/* * app基本信息 * */ const state = { user: {}, organization: {}, project: {}, codeNumber: 60, identity: {}, coordinates: '116.38,39.9', activeCity: { cityName: '北京市', cityCode: '110100' } } const mutations = { CHANGE_USER: (state, user) => { state.user = user; }, CHANGE_ORGANIZATION: (state, organization) => { state.organization = organization; }, CHANGE_PROJECT: (state, project) => { state.project = project; }, CHANGE_CODENUMBER: (state, num) => { state.codeNumber = num; }, CHANGE_IDENTITY: (state, identity) => { state.identity = identity; }, CHANGE_COORDINATES: (state, coordinates) => { state.coordinates = coordinates; }, CHANGE_ACTIVECITY: (state, activeCity) => { state.activeCity = activeCity; }, } const actions = { changeUser({ commit }, user) { commit('CHANGE_USER', user); }, changeOrganization({ commit }, organization) { commit('CHANGE_ORGANIZATION', organization); }, changeProject({ commit, }, project) { commit('CHANGE_PROJECT', project); }, changeCodeNumber({ commit, }, num) { commit('CHANGE_CODENUMBER', num < 0 ? 60 : num); }, changeIdentity({ commit, }, identity) { commit('CHANGE_IDENTITY', identity); }, changeCoordinates({ commit, }, coordinates) { commit('CHANGE_COORDINATES', coordinates); }, changeActiveCity({ commit, }, activeCity) { commit('CHANGE_ACTIVECITY', activeCity); }, } export default { namespaced: true, state, mutations, actions }