Skip to content

fix: 修复歌单拖拽排序问题 - #321

Open
yananZz wants to merge 2 commits into
maotoumao:masterfrom
yananZz:fix-drag-sort-issue
Open

fix: 修复歌单拖拽排序问题#321
yananZz wants to merge 2 commits into
maotoumao:masterfrom
yananZz:fix-drag-sort-issue

Conversation

@yananZz

@yananZz yananZz commented Nov 4, 2025

Copy link
Copy Markdown

问题描述

修复歌单拖拽排序功能的多个问题

修改内容

1. 优化 DragReceiver 组件

  • 增加拖放区域高度(12px → 20px)提高可操作性
  • 增加拖放指示线高度(2px → 3px)和阴影效果,提升视觉反馈
  • 添加 z-index 确保拖放区域在顶层
  • 在 onDragOver 事件中添加 preventDefault 和 stopPropagation,确保拖放事件正确触发

2. 修复音乐列表拖拽排序逻辑

  • 修复拖拽时未考虑当前排序状态的问题
  • 修复倒序排列时拖拽后顺序错误的问题
  • 现在拖拽操作会基于排序后的列表进行,并在倒序时自动反转结果

3. 优化添加音乐逻辑

  • 新添加的音乐现在显示在列表顶部(之前在底部)
  • 歌单封面使用第一首音乐的封面(之前使用最后一首)

4. 完善音乐顺序更新

  • 更新歌单音乐顺序时正确设置 sortIndex 和 timestamp 符号

测试说明

已测试以下场景:

  • ✅ 正序拖拽排序
  • ✅ 倒序拖拽排序
  • ✅ 添加新音乐到歌单
  • ✅ 拖放视觉反馈

相关Issue

(#249)

yananZz and others added 2 commits November 4, 2025 18:53
- 优化 DragReceiver 组件样式,增加可见性和视觉反馈
- 添加必要的 preventDefault 和 stopPropagation 以正确处理拖放事件
- 修复拖拽排序时未考虑当前排序状态的问题
- 修复倒序排列时拖拽顺序错误的问题
- 调整添加音乐逻辑,新添加的音乐现在显示在列表顶部
- 更新音乐顺序时正确设置 sortIndex 和 timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant