import Vue from 'vue' import { USER_INFO, ENHANCE_PRE } from "@/store/mutation-types" const getters = { device: state => state.app.device, theme: state => state.app.theme, color: state => state.app.color, token: state => state.user.token, avatar: state => { state.user.avatar = Vue.ls.get(USER_INFO).avatar; return state.user.avatar }, username: state => state.user.username, nickname: state => { state.user.realname = Vue.ls.get(USER_INFO).realname; return state.user.realname }, welcome: state => state.user.welcome, permissionList: state => state.user.permissionList, userInfo: state => { state.user.info = Vue.ls.get(USER_INFO); return state.user.info }, addRouters: state => state.permission.addRouters, enhanceJs: (state) => (code) => { state.enhance.enhanceJs[code] = Vue.ls.get(ENHANCE_PRE + code); return state.enhance.enhanceJs[code] }, // audio元素 audioEle: state => state.audioEle, // 播放模式 mode: state => state.mode, // 播放状态 playing: state => state.playing, // 播放列表 playlist: state => state.playlist, // 顺序列表 orderList: state => state.orderList, // 当前音乐索引 currentIndex: state => state.currentIndex, // 当前音乐 currentMusic: state => { return state.playlist[state.currentIndex] || {} }, // 播放历史列表 historyList: state => state.historyList, // 网易云用户UID uid: state => state.uid } export default getters