优化下载功能的添加、删除、暂停任务时的流畅度

This commit is contained in:
lyswhut
2021-10-31 21:50:57 +08:00
parent f0f92952d6
commit e382f0dba0
6 changed files with 358 additions and 199 deletions
+18 -8
View File
@@ -155,15 +155,23 @@ const getters = {
let listPlayIndex = Math.min(state.playIndex, state.listInfo.list.length - 1)
if (listId != '__temp__') {
const currentSongmid = state.playMusicInfo.musicInfo.songmid || state.playMusicInfo.musicInfo.musicInfo.songmid
if (isPlayList) {
playIndex = state.listInfo.list.findIndex(m => (m.songmid || m.musicInfo.songmid) == currentSongmid)
if (!isTempPlay) listPlayIndex = playIndex
} else if (listId == 'download') {
playIndex = window.downloadList.findIndex(m => m.musicInfo.songmid == currentSongmid)
if (state.playMusicInfo.musicInfo.key) {
const currentKey = state.playMusicInfo.musicInfo.key
if (isPlayList) {
playIndex = state.listInfo.list.findIndex(m => m.key == currentKey)
if (!isTempPlay) listPlayIndex = playIndex
} else if (listId == 'download') {
playIndex = window.downloadList.findIndex(m => m.key == currentKey)
}
} else {
let list = window.allList[listId]
if (list) playIndex = list.list.findIndex(m => m.songmid == currentSongmid)
const currentSongmid = state.playMusicInfo.musicInfo.songmid || state.playMusicInfo.musicInfo.musicInfo.songmid
if (isPlayList) {
playIndex = state.listInfo.list.findIndex(m => m.songmid == currentSongmid)
if (!isTempPlay) listPlayIndex = playIndex
} else {
let list = window.allList[listId]
if (list) playIndex = list.list.findIndex(m => m.songmid == currentSongmid)
}
}
}
if (listPlayIndex >= 0) prevListPlayIndex = listPlayIndex
@@ -186,6 +194,8 @@ const getters = {
// isTempPlay,
// // musicInfo: state.playMusicInfo.musicInfo,
// })
console.log(state.playMusicInfo)
return {
listId,
playIndex,