修复切换音乐来源可能无法切歌的问题
parent
023cd15cd0
commit
041bfdaf3c
|
@ -5,7 +5,7 @@
|
||||||
"main": "./dist/electron/main.js",
|
"main": "./dist/electron/main.js",
|
||||||
"productName": "lx-music-desktop",
|
"productName": "lx-music-desktop",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pack": "npm run pack:win",
|
"pack": "node build-config/pack.js && npm run pack:win:setup:x64",
|
||||||
"pack:win": "node build-config/pack.js && npm run pack:win:setup:x86_64 && npm run pack:win:7z",
|
"pack:win": "node build-config/pack.js && npm run pack:win:setup:x86_64 && npm run pack:win:7z",
|
||||||
"pack:win:setup:x86_64": "cross-env TARGET=win_安装版 ARCH=x86_64 electron-builder -w=nsis --x64 --ia32",
|
"pack:win:setup:x86_64": "cross-env TARGET=win_安装版 ARCH=x86_64 electron-builder -w=nsis --x64 --ia32",
|
||||||
"pack:win:setup:x64": "cross-env TARGET=win_安装版 ARCH=x64 electron-builder -w=nsis --x64",
|
"pack:win:setup:x64": "cross-env TARGET=win_安装版 ARCH=x64 electron-builder -w=nsis --x64",
|
||||||
|
|
|
@ -184,24 +184,25 @@ const actions = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let list = await filterList({
|
let filteredList = await filterList({
|
||||||
listInfo: state.listInfo,
|
listInfo: state.listInfo,
|
||||||
playedList: state.playedList,
|
playedList: state.playedList,
|
||||||
savePath: rootState.setting.download.savePath,
|
savePath: rootState.setting.download.savePath,
|
||||||
commit,
|
commit,
|
||||||
})
|
})
|
||||||
if (!list.length) return commit('setPlayMusicInfo', null)
|
if (!filteredList.length) return commit('setPlayMusicInfo', null)
|
||||||
const playInfo = getters.playInfo
|
const playInfo = getters.playInfo
|
||||||
const currentIndex = playInfo.listPlayIndex
|
let currentIndex = filteredList.indexOf(currentList[playInfo.listPlayIndex])
|
||||||
|
if (currentIndex == -1) currentIndex = 0
|
||||||
let nextIndex = currentIndex
|
let nextIndex = currentIndex
|
||||||
if (!playInfo.isTempPlay) {
|
if (!playInfo.isTempPlay) {
|
||||||
switch (rootState.setting.player.togglePlayMethod) {
|
switch (rootState.setting.player.togglePlayMethod) {
|
||||||
case 'random':
|
case 'random':
|
||||||
nextIndex = getRandom(0, list.length)
|
nextIndex = getRandom(0, filteredList.length)
|
||||||
break
|
break
|
||||||
case 'listLoop':
|
case 'listLoop':
|
||||||
case 'list':
|
case 'list':
|
||||||
nextIndex = currentIndex === 0 ? list.length - 1 : currentIndex - 1
|
nextIndex = currentIndex === 0 ? filteredList.length - 1 : currentIndex - 1
|
||||||
break
|
break
|
||||||
case 'singleLoop':
|
case 'singleLoop':
|
||||||
break
|
break
|
||||||
|
@ -213,7 +214,7 @@ const actions = {
|
||||||
}
|
}
|
||||||
|
|
||||||
commit('setPlayMusicInfo', {
|
commit('setPlayMusicInfo', {
|
||||||
musicInfo: list[nextIndex],
|
musicInfo: filteredList[nextIndex],
|
||||||
listId: currentListId,
|
listId: currentListId,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -243,27 +244,26 @@ const actions = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let list = await filterList({
|
let filteredList = await filterList({
|
||||||
listInfo: state.listInfo,
|
listInfo: state.listInfo,
|
||||||
playedList: state.playedList,
|
playedList: state.playedList,
|
||||||
savePath: rootState.setting.download.savePath,
|
savePath: rootState.setting.download.savePath,
|
||||||
commit,
|
commit,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!list.length) return commit('setPlayMusicInfo', null)
|
if (!filteredList.length) return commit('setPlayMusicInfo', null)
|
||||||
const playInfo = getters.playInfo
|
const playInfo = getters.playInfo
|
||||||
const currentIndex = playInfo.listPlayIndex
|
const currentIndex = filteredList.indexOf(currentList[playInfo.listPlayIndex])
|
||||||
let nextIndex = currentIndex
|
let nextIndex = currentIndex
|
||||||
// if (!playInfo.isTempPlay) {
|
|
||||||
switch (rootState.setting.player.togglePlayMethod) {
|
switch (rootState.setting.player.togglePlayMethod) {
|
||||||
case 'listLoop':
|
case 'listLoop':
|
||||||
nextIndex = currentIndex === list.length - 1 ? 0 : currentIndex + 1
|
nextIndex = currentIndex === filteredList.length - 1 ? 0 : currentIndex + 1
|
||||||
break
|
break
|
||||||
case 'random':
|
case 'random':
|
||||||
nextIndex = getRandom(0, list.length)
|
nextIndex = getRandom(0, filteredList.length)
|
||||||
break
|
break
|
||||||
case 'list':
|
case 'list':
|
||||||
nextIndex = currentIndex === list.length - 1 ? -1 : currentIndex + 1
|
nextIndex = currentIndex === filteredList.length - 1 ? -1 : currentIndex + 1
|
||||||
break
|
break
|
||||||
case 'singleLoop':
|
case 'singleLoop':
|
||||||
break
|
break
|
||||||
|
@ -272,10 +272,9 @@ const actions = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (nextIndex < 0) return
|
if (nextIndex < 0) return
|
||||||
// }
|
|
||||||
|
|
||||||
commit('setPlayMusicInfo', {
|
commit('setPlayMusicInfo', {
|
||||||
musicInfo: list[nextIndex],
|
musicInfo: filteredList[nextIndex],
|
||||||
listId: currentListId,
|
listId: currentListId,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue