mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 13:52:09 +08:00
同步功能新增对列表位置调整的支持
This commit is contained in:
parent
a9a5a4c2e0
commit
3151e1fe67
@ -1,6 +1,11 @@
|
||||
### 新增
|
||||
|
||||
- 同步功能新增对列表位置调整的支持(若你使用同步功能,请务必升级到此版本以上,不然会有问题)
|
||||
|
||||
### 优化
|
||||
|
||||
- 修改对播放模块的调用,杜绝应用显示正在播放的歌曲与实际播放歌曲不一致的问题(这是播放模块歌曲队列与应用内歌曲队列在某些情况下出现不一致时导致的)
|
||||
- 支持PC端同步功能添加对列表顺序调整的控制,确保手动调整位置后的列表与不同的电脑同步时,列表位置不会被还原
|
||||
|
||||
### 修复
|
||||
|
||||
|
@ -15,9 +15,7 @@ import {
|
||||
removeUserList,
|
||||
setUserListName,
|
||||
setMusicPosition,
|
||||
// moveupUserList,
|
||||
// movedownUserList,
|
||||
// setUserListPosition,
|
||||
setUserListPosition,
|
||||
} from '@/store/modules/list/action'
|
||||
|
||||
const store = getStore()
|
||||
@ -70,6 +68,9 @@ const handleListAction = enMsg => {
|
||||
case 'set_user_list_name':
|
||||
store.dispatch(setUserListName(data))
|
||||
break
|
||||
case 'set_user_list_position':
|
||||
store.dispatch(setUserListPosition(data))
|
||||
break
|
||||
case 'set_music_position':
|
||||
store.dispatch(setMusicPosition(data))
|
||||
break
|
||||
|
@ -328,7 +328,11 @@ export const setUserListName = ({ id, name, isSync }) => async(dispatch, getStat
|
||||
const targetList = global.allList[id]
|
||||
await saveList(targetList)
|
||||
}
|
||||
export const setUserListPosition = ({ id, position }) => async(dispatch, getState) => {
|
||||
export const setUserListPosition = ({ id, position, isSync }) => async(dispatch, getState) => {
|
||||
if (!isSync) {
|
||||
listSync.sendListAction('set_user_list_position', { id, position })
|
||||
}
|
||||
|
||||
dispatch({
|
||||
type: TYPES.setUserListPosition,
|
||||
payload: { id, position },
|
||||
|
@ -253,6 +253,7 @@ const mutations = {
|
||||
if (position == null) {
|
||||
userList.push(newList)
|
||||
} else {
|
||||
newList.locationUpdateTime = Date.now()
|
||||
userList.splice(position + 1, 0, newList)
|
||||
}
|
||||
newState.userList = userList
|
||||
@ -279,7 +280,7 @@ const mutations = {
|
||||
const index = state.userList.findIndex(targetList)
|
||||
if (index < 0) return state
|
||||
state.userList.splice(index, 1)
|
||||
state.userList.splice(index, position, targetList)
|
||||
state.userList.splice(Math.max(Math.min(position, state.userList.length - 1), 0), 0, targetList)
|
||||
return updateStateList({ ...state }, [id])
|
||||
},
|
||||
[TYPES.setMusicPosition](state, { id, position, list }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user