下载列表的歌曲下载、播放将随设置中的保存路径改变而改变

This commit is contained in:
lyswhut
2020-04-12 12:32:44 +08:00
parent cf42e1846e
commit c318856534
5 changed files with 46 additions and 13 deletions
+10 -3
View File
@@ -208,6 +208,10 @@ const actions = {
let result = getStartTask(state.list, state.downloadStatus, rootState.setting.download.maxDownloadNum)
if (!result) return
if (!downloadInfo) downloadInfo = result
commit('updateFilePath', {
downloadInfo,
filePath: path.join(rootState.setting.download.savePath, downloadInfo.fileName),
})
// 开始任务
commit('onStart', downloadInfo)
@@ -228,10 +232,9 @@ const actions = {
// }
commit('onCompleted', downloadInfo)
_this.dispatch('download/startTask')
const filePath = path.join(options.path, options.fileName)
saveMeta(downloadInfo, filePath, rootState.setting.download.isEmbedPic)
if (rootState.setting.download.isDownloadLrc) downloadLyric(downloadInfo, filePath)
saveMeta(downloadInfo, downloadInfo.filePath, rootState.setting.download.isEmbedPic)
if (rootState.setting.download.isDownloadLrc) downloadLyric(downloadInfo, downloadInfo.filePath)
console.log('on complate')
},
onError(err) {
@@ -405,6 +408,10 @@ const mutations = {
updateUrl(state, { downloadInfo, url }) {
downloadInfo.url = url
},
updateFilePath(state, { downloadInfo, filePath }) {
if (downloadInfo.filePath === filePath) return
downloadInfo.filePath = filePath
},
}
export default {