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}
		projectId:'',   //项目id
		projectName:''   //项目名
	},
	mutations: {
		setResult(state, result){
			state.result=result;
		},
		setCode(state, code){
			state.code=code;
		},
		setMsg(state, msg){
			state.msg = msg;
		},
		setData(state, data){
			state.data.userId=data.userId;
            state.data.userCode=data.userCode;
            state.data.userName=data.userName;
		},
		setProjectId(state,projectId){
			state.projectId=projectId;
		},
		setProjectName(state,projectname){    //项目名
			state.projectName=projectname;
		},
  },
  getters:{
      
  },
  actions: {
    // lazy loading openid
  }
})

export default store
