diff --git a/src/renderer/components/MusicList.vue b/src/renderer/components/MusicList.vue
index 55dc1b7..3e76364 100644
--- a/src/renderer/components/MusicList.vue
+++ b/src/renderer/components/MusicList.vue
@@ -44,7 +44,7 @@
{
return props.songList.length;
});
+const getCoverImgUrl = computed(() => {
+ if (props.listInfo?.coverImgUrl) {
+ return props.listInfo.coverImgUrl;
+ }
+
+ const song = props.songList[0];
+ if (song?.picUrl) {
+ return song.picUrl;
+ }
+ if (song?.al?.picUrl) {
+ return song.al.picUrl;
+ }
+ if (song?.album?.picUrl) {
+ return song.album.picUrl;
+ }
+ return '';
+});
+
// 过滤歌曲列表
const filteredSongs = computed(() => {
if (!searchKeyword.value) {
@@ -203,6 +221,9 @@ const filteredSongs = computed(() => {
// 格式化歌曲数据
const formatSong = (item: any) => {
+ if (!item) {
+ return null;
+ }
return {
...item,
picUrl: item.al?.picUrl || item.picUrl,
diff --git a/src/renderer/components/home/RecommendAlbum.vue b/src/renderer/components/home/RecommendAlbum.vue
index a0ed779..513ce73 100644
--- a/src/renderer/components/home/RecommendAlbum.vue
+++ b/src/renderer/components/home/RecommendAlbum.vue
@@ -26,7 +26,7 @@
v-model:show="showMusic"
:name="albumName"
:song-list="songList"
- :cover="false"
+ :cover="true"
:loading="loadingList"
:list-info="albumInfo"
/>
@@ -62,17 +62,19 @@ const handleClick = async (item: any) => {
loadingList.value = true;
showMusic.value = true;
const res = await getAlbum(item.id);
- songList.value = res.data.songs.map((song: any) => {
- song.al.picUrl = song.al.picUrl || item.picUrl;
+ const { songs, album } = res.data;
+ songList.value = songs.map((song: any) => {
+ song.al.picUrl = song.al.picUrl || album.picUrl;
+ song.picUrl = song.al.picUrl || album.picUrl || song.picUrl;
return song;
});
albumInfo.value = {
- ...res.data.album,
+ ...album,
creator: {
- avatarUrl: res.data.album.artist.img1v1Url,
- nickname: `${res.data.album.artist.name} - ${res.data.album.company}`
+ avatarUrl: album.artist.img1v1Url,
+ nickname: `${album.artist.name} - ${album.company}`
},
- description: res.data.album.description
+ description: album.description
};
loadingList.value = false;
};