新增单个列表导入/导出功能

This commit is contained in:
lyswhut
2021-09-30 14:27:32 +08:00
parent 51be62bc29
commit ce7bca5b36
17 changed files with 411 additions and 116 deletions
+3 -3
View File
@@ -11,6 +11,7 @@ import {
getMusicUrl as getMusicUrlFormStorage,
setMusicUrl,
assertApiSupport,
filterFileName,
} from '../../utils'
import { NAMES, rendererInvoke } from '@common/ipc'
@@ -33,7 +34,6 @@ const dls = {}
const tryNum = {}
let isRuningActionTask = false
const filterFileName = /[\\/:*?#"<>|]/g
// getters
const getters = {
@@ -378,9 +378,9 @@ const actions = {
statusText: '待下载',
url: null,
// songmid: musicInfo.songmid,
fileName: `${rootState.setting.download.fileName
fileName: filterFileName(`${rootState.setting.download.fileName
.replace('歌名', musicInfo.name)
.replace('歌手', musicInfo.singer)}.${ext}`.replace(filterFileName, ''),
.replace('歌手', musicInfo.singer)}.${ext}`),
progress: {
downloaded: 0,
total: 0,
+7 -3
View File
@@ -293,11 +293,11 @@ const mutations = {
const targetMusicInfo = targetList.list.find(item => item.songmid == id)
if (targetMusicInfo) Object.assign(targetMusicInfo, data)
},
createUserList(state, { name, id = `userlist_${Date.now()}`, list = [], source, sourceListId, isSync }) {
createUserList(state, { name, id = `userlist_${Date.now()}`, list = [], source, sourceListId, position, isSync }) {
if (!isSync) {
window.eventHub.$emit(eventSyncName.send_action_list, {
action: 'create_user_list',
data: { name, id, list, source, sourceListId },
data: { name, id, list, source, sourceListId, position },
})
}
@@ -311,7 +311,11 @@ const mutations = {
source,
sourceListId,
}
state.userList.push(newList)
if (position == null) {
state.userList.push(newList)
} else {
state.userList.splice(position + 1, 0, newList)
}
allListUpdate(newList)
}
this.commit('list/listAddMultiple', { id, list, isSync: true })