同步功能添加对列表顺序调整的控制
This commit is contained in:
@@ -51,7 +51,7 @@ export const tempList = reactive({
|
||||
name: '临时列表',
|
||||
})
|
||||
|
||||
export const userLists = reactive([])
|
||||
export const userLists = window.userLists = reactive([])
|
||||
|
||||
export const addUserList = ({
|
||||
name,
|
||||
@@ -60,6 +60,7 @@ export const addUserList = ({
|
||||
source,
|
||||
sourceListId,
|
||||
position,
|
||||
locationUpdateTime,
|
||||
}) => {
|
||||
if (position == null) {
|
||||
userLists.push({
|
||||
@@ -67,6 +68,7 @@ export const addUserList = ({
|
||||
id,
|
||||
source,
|
||||
sourceListId,
|
||||
locationUpdateTime,
|
||||
})
|
||||
} else {
|
||||
userLists.splice(position + 1, 0, {
|
||||
@@ -74,6 +76,7 @@ export const addUserList = ({
|
||||
id,
|
||||
source,
|
||||
sourceListId,
|
||||
locationUpdateTime,
|
||||
})
|
||||
}
|
||||
allListUpdate(id, list)
|
||||
@@ -85,6 +88,7 @@ export const updateList = ({
|
||||
list,
|
||||
source,
|
||||
sourceListId,
|
||||
locationUpdateTime,
|
||||
}) => {
|
||||
let targetList
|
||||
switch (id) {
|
||||
@@ -97,6 +101,7 @@ export const updateList = ({
|
||||
targetList.name = name
|
||||
targetList.source = source
|
||||
targetList.sourceListId = sourceListId
|
||||
if (locationUpdateTime) targetList.locationUpdateTime = locationUpdateTime
|
||||
break
|
||||
}
|
||||
allListUpdate(id, list)
|
||||
|
||||
@@ -320,6 +320,7 @@ const mutations = {
|
||||
position,
|
||||
sourceListId,
|
||||
}
|
||||
if (position) newList.locationUpdateTime = Date.now()
|
||||
addUserList(newList)
|
||||
}
|
||||
this.commit('list/listAddMultiple', { id, list, isSync: true })
|
||||
@@ -364,6 +365,7 @@ const mutations = {
|
||||
let targetList = userLists[index]
|
||||
userLists.splice(index, 1)
|
||||
userLists.splice(index - 1, 0, targetList)
|
||||
targetList.locationUpdateTime = Date.now()
|
||||
window.eventHub.emit(eventListNames.listChange, [id])
|
||||
},
|
||||
movedownUserList(state, { id, isSync }) {
|
||||
@@ -378,6 +380,7 @@ const mutations = {
|
||||
let targetList = userLists[index]
|
||||
userLists.splice(index, 1)
|
||||
userLists.splice(index + 1, 0, targetList)
|
||||
targetList.locationUpdateTime = Date.now()
|
||||
window.eventHub.emit(eventListNames.listChange, [id])
|
||||
},
|
||||
setMusicPosition(state, { id, position, list, isSync }) {
|
||||
|
||||
Reference in New Issue
Block a user