当前播放开发中...
This commit is contained in:
@@ -7,6 +7,8 @@ export default createStore({
|
||||
settings: {
|
||||
currentRoute: "/discover/recommend", //当前路由
|
||||
songId: 0, //歌曲id
|
||||
playing: false, //是否播放
|
||||
playMode: 0, //播放模式:0-3,顺序,循环,单曲,随机。
|
||||
lastPlayed: [], //最近播放
|
||||
playingList: [], //当前播放
|
||||
},
|
||||
@@ -53,7 +55,7 @@ export default createStore({
|
||||
//载入settings设置
|
||||
loadSettings(state) {
|
||||
const l = localStorage.getItem("zmusic.settings");
|
||||
if (l) state.settings = JSON.parse(l);
|
||||
if (l) state.settings ={...state.settings, ...JSON.parse(l)};
|
||||
},
|
||||
//保存settings设置
|
||||
saveSettings(state, settings) {
|
||||
@@ -64,7 +66,7 @@ export default createStore({
|
||||
//载入caches设置
|
||||
loadCaches(state) {
|
||||
const l = localStorage.getItem("zmusic.caches");
|
||||
if (l) state.caches = JSON.parse(l);
|
||||
if (l) state.caches = {...state.caches, ...JSON.parse(l)}
|
||||
},
|
||||
//保存caches设置
|
||||
saveCaches(state, caches) {
|
||||
@@ -81,7 +83,7 @@ export default createStore({
|
||||
//载入theme设置
|
||||
loadTheme(state) {
|
||||
const l = localStorage.getItem("zmusic.theme");
|
||||
if (l) state.theme = JSON.parse(l);
|
||||
if (l) state.theme = {...state.theme, ...JSON.parse(l)};
|
||||
},
|
||||
//保存theme设置
|
||||
saveTheme(state, theme) {
|
||||
@@ -98,6 +100,20 @@ export default createStore({
|
||||
state.settings.lastPlayed = p;
|
||||
saveLoaclSettings(state.settings);
|
||||
},
|
||||
addToPlayingList(state, song) {
|
||||
//如果没有,设置为[]
|
||||
if (!state.settings.playingList)
|
||||
state.settings.playingList = [];
|
||||
|
||||
let f = state.settings.playingList.find((item) => {
|
||||
return item.id === song.id;
|
||||
});
|
||||
if (!f) {
|
||||
// console.log("add to playingList");
|
||||
state.settings.playingList.unshift(song)
|
||||
saveLoaclSettings(state.settings);
|
||||
}
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
modules: {},
|
||||
|
||||
Reference in New Issue
Block a user