feat: 修改播放列表展示形式,优化播放逻辑,添加清空播放列表功能

This commit is contained in:
alger
2025-05-17 13:27:50 +08:00
parent 56b3ecfd25
commit 2e96161bd0
14 changed files with 382 additions and 166 deletions
+1 -19
View File
@@ -312,25 +312,7 @@ const handleNext = () => playerStore.nextPlay();
const playMusicEvent = async () => {
try {
if (!playerStore.playMusic?.id || !playerStore.playMusicUrl) {
console.warn('No valid music or URL available');
playerStore.setPlay(playerStore.playMusic);
return;
}
if (play.value) {
if (audioService.getCurrentSound()) {
audioService.pause();
playerStore.setPlayMusic(false);
}
} else {
if (audioService.getCurrentSound()) {
audioService.play();
} else {
await audioService.play(playerStore.playMusicUrl, playerStore.playMusic);
}
playerStore.setPlayMusic(true);
}
playerStore.setPlay(playerStore.playMusic);
} catch (error) {
console.error('播放出错:', error);
playerStore.nextPlay();