
// 状态管理
import Vue from 'vue';//这里为固定格式照抄
import Vuex from 'vuex';//这里为固定格式照抄
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        user_id:'',//项目id，也是用户id
        allo_equip_user_id:'',//分配设备传的用户id
        allo_equip_usename:'',//分配设备传的用户名称
        cbd_photo_id:'',//测报灯查看图片设备id
        cbd_photo_did:'',//测报灯查看图片设备did
        cbd_pest_id:'',//测报灯害虫统计设备id
        cbd_pest_did:'',//测报灯害虫统计设备did
        
    },
    mutations: {
      setUserId (state,val) {
        state.user_id = val;
      },
      setAlloEquipUserId (state,val) {
        state.allo_equip_user_id = val;
      },
      setAlloEquipUsename (state,val) {
        state.allo_equip_usename = val;
      },
      setCbdPhotoId (state,val) {
        state.cbd_photo_id = val;
      },
      setCbdPhotoDid (state,val) {
        state.cbd_photo_did = val;
      },
      setCbdPestId (state,val) {
        state.cbd_pest_id = val;
      },
      setCbdPestDid (state,val) {
        state.cbd_pest_did = val;
      },
    },
    plugins: [createPersistedState({ storage: window.sessionStorage })]
})

export default store 