import * as types from './mutation-types'
import {
	setOpenId,
	setToken,
	setPersonData,
	setPersonPopedom,
	setMenuList,
	setCommonMenuList,
	setPersonTemp,
	setFunList,
	setRegisterFormData,
	setAppVersion,
	setPersionHomeModel,
	setOldRelationFormData,
	setWxPayBackUrl,
	setWdMessageNum
} from '../utils/storage'

var storage_prefix = process.env.VUE_APP_LOCAL_STORAGE_PREFIX;

const mutations = {
	[types.SET_WEIXIN_OPENID](state, openid) {
		setOpenId(openid)
		state.weixin_openid = openid
	},

	[types.SET_TOKEN](state, data) {
		setToken(data)
		state.token = data
	},

	[types.SET_PERSON_DATA](state, data) {
		setPersonData(storage_prefix, data)
		state.person_data = data
	},

	[types.SET_PERSON_POPEDOM](state, data) {
		setPersonPopedom(storage_prefix, data)
		state.person_popedom = data
	},

	[types.SET_ADD_PERSON_DATA](state, data) {
		state.add_person_data = data
	},
	setControlAbnormalStatisticsStartTime(state, data) {
		state.control_abnormal_statistics_startTime = data
	},
	setControlAbnormalStatisticsEndTime(state, data) {
		state.control_abnormal_statistics_endTime = data
	},

	[types.SET_MENI_LIST](state, data) {
		setMenuList(storage_prefix, data)
		state.menu_list = data
	},

	[types.SET_COMMON_MENU_LIST](state, data) {
		setCommonMenuList(storage_prefix, data)
		state.common_menu_list = data
	},

	[types.SET_PERSON_TEMP](state, data) {
		setPersonTemp(storage_prefix, data)
		state.person_temp = data
	},

	[types.SET_FUN_LIST](state, data) {
		setFunList(storage_prefix, data)
		state.fun_list = data
	},

	[types.SET_REGISTER_FORM_DATA](state, data) {
		setRegisterFormData(storage_prefix, data)
		state.register_form_data = data
	},

	[types.SET_APP_VERSION](state, data) {
		setAppVersion(storage_prefix, data)
		state.app_version = data
	},

	[types.SET_PERSION_HOME_MODEL](state, data) {
		setPersionHomeModel(storage_prefix, data)
		state.persion_home_model = data
	},

	[types.SET_OLD_RELATION_FORM_DATA](state, data) {
		setOldRelationFormData(storage_prefix, data)
		state.old_relation_form_data = data
	},

	[types.SET_WX_PAY_BACK_URL](state, data) {
		setWxPayBackUrl(storage_prefix, data)
		state.wx_pay_back_url = data
	},

	[types.SET_REGISTER_EXAMINE_FORM](state, data) {
		state.register_examine_form = data
	},

	[types.SET_WD_MESSAGE_NUM](state, data) {
		setWdMessageNum(storage_prefix, data)
		state.wd_message_num = data
	},
}

export default mutations
