交互优化
This commit is contained in:
		@@ -5,6 +5,8 @@ webrtc 实现的 p2p 信道
 | 
				
			|||||||
- [x] 音乐播放
 | 
					- [x] 音乐播放
 | 
				
			||||||
  - [x] 请求到单个目标防止接收到重复分片数据
 | 
					  - [x] 请求到单个目标防止接收到重复分片数据
 | 
				
			||||||
    - [x] 主机记录各自曲目列表以供查询
 | 
					    - [x] 主机记录各自曲目列表以供查询
 | 
				
			||||||
 | 
					  - [x] 播放时高亮显示
 | 
				
			||||||
 | 
					  - [x] 合并操作按钮
 | 
				
			||||||
- [ ] 集群分发
 | 
					- [ ] 集群分发
 | 
				
			||||||
- [ ] 下载加速
 | 
					- [ ] 下载加速
 | 
				
			||||||
- [ ] 即时通讯
 | 
					- [ ] 即时通讯
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,7 +56,11 @@ export default class MusicList {
 | 
				
			|||||||
            ul.music-list > li > button {
 | 
					            ul.music-list > li > button {
 | 
				
			||||||
                margin-left: 10px;
 | 
					                margin-left: 10px;
 | 
				
			||||||
                border: none;
 | 
					                border: none;
 | 
				
			||||||
 | 
					                border-radius: 1em;
 | 
				
			||||||
                cursor: pointer;
 | 
					                cursor: pointer;
 | 
				
			||||||
 | 
					                font-size: .5rem;
 | 
				
			||||||
 | 
					                padding: 0 .5rem;
 | 
				
			||||||
 | 
					                color: #555555;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            ul.music-list > li > button:hover {
 | 
					            ul.music-list > li > button:hover {
 | 
				
			||||||
                background-color: #ccc;
 | 
					                background-color: #ccc;
 | 
				
			||||||
@@ -83,31 +87,26 @@ export default class MusicList {
 | 
				
			|||||||
            id: item.id,
 | 
					            id: item.id,
 | 
				
			||||||
            classList: item.arrayBuffer ? ['cache'] : [],
 | 
					            classList: item.arrayBuffer ? ['cache'] : [],
 | 
				
			||||||
            innerText: `${item.name} - ${bytesToSize(item.size)}`,
 | 
					            innerText: `${item.name} - ${bytesToSize(item.size)}`,
 | 
				
			||||||
            children: [
 | 
					 | 
				
			||||||
                Button({
 | 
					 | 
				
			||||||
                    innerText: '播放',
 | 
					 | 
				
			||||||
            onclick: event => {
 | 
					            onclick: event => {
 | 
				
			||||||
                event.stopPropagation()
 | 
					                event.stopPropagation()
 | 
				
			||||||
                if (event.target.dataset.play === 'play') {
 | 
					                if (event.target.dataset.play === 'play') {
 | 
				
			||||||
                    event.target.dataset.play = 'stop'
 | 
					                    event.target.dataset.play = 'stop'
 | 
				
			||||||
                            event.target.innerText = '播放'
 | 
					                    event.target.classList.remove('play')
 | 
				
			||||||
                            this.ul.querySelector(`#${item.id}`).classList.remove('play')
 | 
					 | 
				
			||||||
                    this.stop()
 | 
					                    this.stop()
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    event.target.dataset.play = 'play'
 | 
					                    event.target.dataset.play = 'play'
 | 
				
			||||||
                            event.target.innerText = '停止'
 | 
					 | 
				
			||||||
                    this.ul.querySelectorAll('li.play').forEach(li => li.classList.remove('play'))
 | 
					                    this.ul.querySelectorAll('li.play').forEach(li => li.classList.remove('play'))
 | 
				
			||||||
                            this.ul.querySelector(`#${item.id}`).classList.add('play')
 | 
					                    event.target.classList.add('play')
 | 
				
			||||||
                    this.play(item)
 | 
					                    this.play(item)
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                    }
 | 
					            },
 | 
				
			||||||
                }),
 | 
					            children: [
 | 
				
			||||||
                Button({
 | 
					                Button({
 | 
				
			||||||
                    innerText: item.arrayBuffer ? '移除' : '喜欢',
 | 
					                    innerText: item.arrayBuffer ? '移除' : '缓存',
 | 
				
			||||||
                    onclick: event => {
 | 
					                    onclick: event => {
 | 
				
			||||||
                        event.stopPropagation()
 | 
					                        event.stopPropagation()
 | 
				
			||||||
                        if (item.arrayBuffer) {
 | 
					                        if (item.arrayBuffer) {
 | 
				
			||||||
                            event.target.innerText = '喜欢'
 | 
					                            event.target.innerText = '缓存'
 | 
				
			||||||
                            this.unlike(item)
 | 
					                            this.unlike(item)
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            event.target.innerText = '移除'
 | 
					                            event.target.innerText = '移除'
 | 
				
			||||||
@@ -115,20 +114,6 @@ export default class MusicList {
 | 
				
			|||||||
                            this.like(item)
 | 
					                            this.like(item)
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }),
 | 
					 | 
				
			||||||
                Button({
 | 
					 | 
				
			||||||
                    innerText: '禁止',
 | 
					 | 
				
			||||||
                    onclick: event => {
 | 
					 | 
				
			||||||
                        event.stopPropagation()
 | 
					 | 
				
			||||||
                        if (event.target.dataset.ban === 'ban') {
 | 
					 | 
				
			||||||
                            event.target.dataset.ban = 'unban'
 | 
					 | 
				
			||||||
                            event.target.innerText = '禁止'
 | 
					 | 
				
			||||||
                        } else {
 | 
					 | 
				
			||||||
                            event.target.dataset.ban = 'ban'
 | 
					 | 
				
			||||||
                            event.target.innerText = '解禁'
 | 
					 | 
				
			||||||
                            this.stop()
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
        }))
 | 
					        }))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user