直接从歌单详情收藏的列表新增同步功能

This commit is contained in:
lyswhut
2020-12-10 12:57:48 +08:00
parent 2056bdb43d
commit f1049169b5
9 changed files with 86 additions and 10 deletions
+6 -2
View File
@@ -60,7 +60,7 @@ const mutations = {
allListInit(state.defaultList, state.loveList, state.userList)
state.isInitedList = true
},
setList(state, { id, list, name, location }) {
setList(state, { id, list, name, location, source, sourceListId }) {
const targetList = allList[id]
if (targetList) {
if (name && targetList.name === name) {
@@ -76,6 +76,8 @@ const mutations = {
id,
list,
location,
source,
sourceListId,
}
state.userList.push(newList)
allListUpdate(newList)
@@ -145,7 +147,7 @@ const mutations = {
if (!targetList) return
Object.assign(targetList.list[index], data)
},
createUserList(state, { name, id = `userlist_${Date.now()}`, list = [] }) {
createUserList(state, { name, id = `userlist_${Date.now()}`, list = [], source, sourceListId }) {
let newList = state.userList.find(item => item.id === id)
if (!newList) {
newList = {
@@ -153,6 +155,8 @@ const mutations = {
id,
list: [],
location: 0,
source,
sourceListId,
}
state.userList.push(newList)
allListUpdate(newList)
+2 -2
View File
@@ -81,8 +81,8 @@ const actions = {
: music[source].songList.getListDetail(id, page)
).then(result => commit('setListDetail', { result, key, source, id, page }))
},
getListDetailAll({ state, rootState }, id) {
let source = rootState.setting.songList.source
getListDetailAll({ state, rootState }, { source, id }) {
// console.log(source, id)
const loadData = (id, page) => {
let key = `sdetail__${source}__${id}__${page}`
return cache.has(key)