From b820adf0bfe93b6dcf9097c56427ad9e2953c9dd Mon Sep 17 00:00:00 2001 From: lyswhut Date: Tue, 10 Nov 2020 08:33:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=87=E6=AD=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/core/Player.vue | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index f7d2442b..3017c387 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -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()