This commit is contained in:
2023-10-04 06:59:24 +08:00
parent 22ccb5b538
commit 71d47ebbb4
3 changed files with 6 additions and 2 deletions

View File

@ -13,6 +13,9 @@ webrtc 实现的 p2p 信道
- [x] 分片请求时立即播放 - [x] 分片请求时立即播放
- [ ] 上锁防止连续重复加载同一个造成分片混乱 - [ ] 上锁防止连续重复加载同一个造成分片混乱
- [x] 使用单独的状态标识音乐是否缓存 - [x] 使用单独的状态标识音乐是否缓存
- [x] 取消本地存储时不直接移除列表
- [ ] 取消本地存储时检查是否移除(其它成员可能有同一曲)
- [ ] 成员列表刷新时播放被重置BUG
- [ ] 集群分发 - [ ] 集群分发
- [ ] 下载加速 - [ ] 下载加速
- [ ] 即时通讯 - [ ] 即时通讯

View File

@ -72,7 +72,7 @@
onlike: (item, list) => { onlike: (item, list) => {
console.log('喜欢音乐', item.name) console.log('喜欢音乐', item.name)
if (item.arrayBuffer) { if (item.arrayBuffer) {
database.add({ save:true, ...item }) database.add(item)
clientList.send('base', JSON.stringify({ clientList.send('base', JSON.stringify({
type: 'set_music_list', type: 'set_music_list',
list: list.map(({ id, name, size, type }) => ({ id, name, size, type })) list: list.map(({ id, name, size, type }) => ({ id, name, size, type }))

View File

@ -115,8 +115,10 @@ export default class MusicList {
event.stopPropagation() event.stopPropagation()
if (item.save) { if (item.save) {
event.target.textContent = '缓存' event.target.textContent = '缓存'
this.ul.querySelector(`#${item.id}`).classList.remove('cache')
this.unlike(item) this.unlike(item)
} else { } else {
item.save = true
event.target.textContent = '移除' event.target.textContent = '移除'
this.ul.querySelector(`#${item.id}`).classList.add('cache') this.ul.querySelector(`#${item.id}`).classList.add('cache')
this.like(item) this.like(item)
@ -170,7 +172,6 @@ export default class MusicList {
this.event.onlike(item, this.list) this.event.onlike(item, this.list)
} }
async unlike(item) { async unlike(item) {
this.remove(item)
this.event.onunlike(item, this.list) this.event.onunlike(item, this.list)
} }
async ban(item) { async ban(item) {