import Lockr from 'lockr'

/** 记录 侧边索引 */
const app = {
    state: {
        logo: '',
        name: '',
        currentNavs: 0
    },

    mutations: {
        SET_APPLOGO: (state, logo) => {
            state.logo = logo
        },
        SET_APPNAME: (state, name) => {
            state.name = name
        },
        SET_CURRENTNAVS: (state, nav) => {
            state.currentNavs = nav
        }
    },

    actions: {
        // 登录
        SystemLogoAndName({
            commit
        }, { GroupName, GroupLogo }) {
            commit('SET_APPNAME', GroupName)
            commit('SET_APPLOGO', GroupLogo)
            Lockr.set('systemLogo', GroupName)
            Lockr.set('systemName', GroupLogo)
        },
        SystemNavsChange({ commit }, nav) {
            commit('SET_CURRENTNAVS', nav)
        }
    }
}

export default app