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

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        currentIndex: 0,
        riskPointDetail:null,//风险详情
        riskPointId: null,
        portUrl: {},
        changeMapList: {}
    },
    getters: {
        getRiskPointId(state){
          return state.riskPointId;
        },
        getRiskPointDetail(state){
          return state.riskPointDetail;
        },
        getChangeMapList(state){
          return state.changeMapList;
        }
    },
    mutations: {
        changeIndex(state, n) {
            // console.log(state.currentIndex)
            // console.log(n)

            sessionStorage.setItem('activeIndex', n);
            state.currentIndex = n
        },
        setPointDetail(state, data) {//风险点详情
          // console.log('风险点详情---------------__________-------------------')
          // console.log(data)
          state.riskPointDetail = data;
        },
        setRiskPointId(state, data){
          state.riskPointId = data
        },
        setPort(state, data){
          console.log(data)
          localStorage.setItem('portData', JSON.stringify(data)); // 保存路由URL数据
          state.portUrl = data
        },
        setChangeMapList(state, data){
          state.changeMapList = data
        }
    },
    actions: {

    }

})
