import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	/* 状态对象 */
  state:{
		result: false,    //获取信息是否成功
    	code: '',     
		msg: '',         //获取成功失败时返回的错误信息
		data: {},   //{userId,userName,userCode}
		token:{},   //令牌
	
	},
	mutations: {
		setResult(state, result){
			state.result=result;
		},
		setCode(state, code){
			state.code=code;
		},
		setMsg(state, msg){
			state.msg = msg;
		},
		setData(state, data){
			state.data.ownerid=data.ownerid;
            state.data.ownername=data.ownername;
            state.data.hcode=data.hcode;
			state.data.hname=data.hname;
            state.data.bcode=data.bcode;
            state.data.bname=data.bname;
			state.data.tel=data.tel;
		},
		setToken(state,token){
			state.token=token;
		},
  },
  getters:{
      
  },
  actions: {
    // lazy loading openid
  }
})

export default store
