优化切歌逻辑

pull/389/head
lyswhut 2020-11-10 08:33:07 +08:00
parent 1cee2febf4
commit b820adf0bf
1 changed files with 20 additions and 14 deletions

View File

@ -517,14 +517,17 @@ export default {
if (this.setting.player.togglePlayMethod == 'random' && this.playedList.length) {
let index = this.playedList.indexOf(this.targetSong)
index -= 1
if (index > -1) {
let listIndex = this.list.indexOf(this.playedList[index])
if (listIndex < 0) {
this.removePlayedList(index)
return this.handlePrev()
while (true) {
if (index > -1) {
let listIndex = this.list.indexOf(this.playedList[index])
if (listIndex < 0) {
this.removePlayedList(index)
continue
}
this.setPlayIndex(listIndex)
return
}
this.setPlayIndex(listIndex)
return
break
}
}
let list = await this.filterList()
@ -552,14 +555,17 @@ export default {
if (this.setting.player.togglePlayMethod == 'random' && this.playedList.length) {
let index = this.playedList.indexOf(this.targetSong)
index += 1
if (index < this.playedList.length) {
let listIndex = this.list.indexOf(this.playedList[index])
if (listIndex < 0) {
this.removePlayedList(index)
return this.handleNext()
while (true) {
if (index < this.playedList.length) {
let listIndex = this.list.indexOf(this.playedList[index])
if (listIndex < 0) {
this.removePlayedList(index)
continue
}
this.setPlayIndex(listIndex)
return
}
this.setPlayIndex(listIndex)
return
break
}
}
let list = await this.filterList()