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

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
		wholeSituationBackStageIp:'192.168.0.91',//117.78.18.24
		wholeSituationBackStagePort:'9988',
		
		GlobalLocalIp:'192.168.0.91',//192.168.1.102
		GlobalLocalPort:'9987',
		
		windpowerstationNameToId:{},
		
		default_wpid:'0',	
		default_wpname:'宁夏新能源公司',
		default_weather_wpid:'CL_FDC',	
		default_tourist:'2',
		default_tourist_wpid:'CL_FDC',
		default_tourist_wpname:'麻黄山风电场',
        memberData:'',
        initName:''
    },
    mutations: {
        copy(state,cont){
            //单一的改变某一个变量
            console.log(state)
            console.log(cont)
            state.memberData = cont;
        },
        change(state,contObj){
            //通过传入的变量去改变对应的全局变量
            let str = contObj.str;
            let cont = contObj.cont;
            state[str] = cont;
        },
    },
    actions:{
        copeFun:function(context,mData){
            context.commit('copy',mData)
        },
        changeFun:function(context,obj){
            context.commit('change',obj)
        }
    }
})

export default store