const state = {
    aId: '',
    cId: '',
    gId: '',
    tabBarIndex: null,    // 标签栏下标记录
}

const mutations = {
    SET_AID: (state, aId) => {
        state.aId = aId
    },
    SET_CID: (state, cId) => {
        state.cId = cId
    },
    SET_GID: (state, gId) => {
        state.gId = gId
    },
    SET_TABBARINDEX: (state, index) => {
        state.tabBarIndex = index
    },
}

const actions = {
    /**
     * @Author: NanKeYang
     * @Description: 设置请求参数
     * @Data: 2020/1/9 10:14
     */
    setReqConfig({commit}, reqConfig) {
        const {aId, cId, gId} = reqConfig
        commit('SET_AID', aId)
        commit('SET_CID', cId)
        commit('SET_GID', gId)
    },
    /**
     * @Author: NanKeYang
     * @Description: 更新标签下标
     * @Data: 2020/1/9 10:14
     */
    updateTabBarIndex({commit}, index) {
        commit('SET_TABBARINDEX', index)
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
