diff --git a/publish/changeLog.md b/publish/changeLog.md index cd504d7e..12ea6166 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -2,6 +2,7 @@ - 优化我的列表、下载列表等列表的滚动流畅度 - 优化下载功能的批量添加、删除、暂停任务时的流畅度,现在进行这些操作应该不会再觉得卡顿了 +- 支持启动软件时恢复播放下载列表里的歌曲 ### 修复 diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 789acd1f..6ee8bd50 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -404,10 +404,17 @@ export default { if (!info) return if (info.index < 0) return if (info.listId) { - const list = window.allList[info.listId] - // console.log(list) - if (!list || !list.list[info.index]) return - info.list = list.list + if (info.listId == 'download') { + const list = this.downloadList + // console.log(list) + if (!list || !list[info.index]) return + info.list = list + } else { + const list = window.allList[info.listId] + // console.log(list) + if (!list || !list.list[info.index]) return + info.list = list.list + } } if (!info.list || !info.list[info.index]) return window.restorePlayInfo = info diff --git a/src/renderer/components/core/Player.vue b/src/renderer/components/core/Player.vue index dc45fd30..611e6c14 100644 --- a/src/renderer/components/core/Player.vue +++ b/src/renderer/components/core/Player.vue @@ -64,7 +64,7 @@ div(:class="$style.player") //- transition(enter-active-class="animated lightSpeedIn" transition(enter-active-class="animated lightSpeedIn" leave-active-class="animated slideOutDown") - core-player-detail(v-show="isShowPlayerDetail" :visible.sync="isShowPlayerDetail" :musicInfo="currentMusicInfo" + core-player-detail(v-if="isShowPlayerDetail" :visible.sync="isShowPlayerDetail" :musicInfo="currentMusicInfo" :lyric="lyric" :list="list" :listId="listId" :playInfo="{ nowPlayTimeStr, maxPlayTimeStr, progress, nowPlayTime, status }" :isPlay="isPlay" @action="handlePlayDetailAction" @@ -505,8 +505,6 @@ export default { this.musicInfo.album = targetSong.albumName audio.src = filePath // console.log(filePath) - this.setImg(targetSong) - this.setLrc(targetSong) } else { // if (!this.assertApiSupport(targetSong.source)) return this.playNext() this.currentMusicInfo = targetSong @@ -515,9 +513,9 @@ export default { this.musicInfo.name = targetSong.name this.musicInfo.album = targetSong.albumName this.setUrl(targetSong) - this.setImg(targetSong) - this.setLrc(targetSong) } + this.setImg(targetSong) + this.setLrc(targetSong) this.handleUpdateWinLyricInfo('music_info', { songmid: this.musicInfo.songmid, singer: this.musicInfo.singer, @@ -595,11 +593,25 @@ export default { window.getComputedStyle(this.$refs.dom_progress, null).width, ) }, - togglePlay() { + async togglePlay() { if (!audio.src) { if (this.restorePlayTime != null) { - // if (!this.assertApiSupport(this.targetSong.source)) return this.playNext() - this.setUrl(this.targetSong) + if (this.listId == 'download') { + const filePath = path.join(this.setting.download.savePath, this.targetSong.fileName) + // console.log(filePath) + if (!await checkPath(filePath) || !this.targetSong.isComplate || /\.ape$/.test(filePath)) { + if (this.list.length == 1) { + this.handleRemoveMusic() + } else { + this.playNext() + } + return + } + audio.src = filePath + } else { + // if (!this.assertApiSupport(this.targetSong.source)) return this.playNext() + this.setUrl(this.targetSong) + } } return } @@ -919,8 +931,18 @@ export default { if (!this.musicInfo.songmid) return this.isShowAddMusicTo = true }, - handleRestorePlay(restorePlayInfo) { - let musicInfo = this.list[restorePlayInfo.index] + async handleRestorePlay(restorePlayInfo) { + let musicInfo + + if (this.listId == 'download') { + this.currentMusicInfo = musicInfo = window.downloadListFullMap.get(this.list[restorePlayInfo.index].key).musicInfo + // console.log(filePath) + } else { + // if (!this.assertApiSupport(targetSong.source)) return this.playNext() + musicInfo = this.list[restorePlayInfo.index] + this.currentMusicInfo = musicInfo + } + this.musicInfo.songmid = musicInfo.songmid this.musicInfo.singer = musicInfo.singer this.musicInfo.name = musicInfo.name diff --git a/src/renderer/store/modules/player.js b/src/renderer/store/modules/player.js index d1116871..72f4f1a4 100644 --- a/src/renderer/store/modules/player.js +++ b/src/renderer/store/modules/player.js @@ -195,7 +195,7 @@ const getters = { // // musicInfo: state.playMusicInfo.musicInfo, // }) - console.log(state.playMusicInfo) + // console.log(state.playMusicInfo) return { listId, playIndex,