From 481ba6bce3a53c1ec0131a62821c3e2279961732 Mon Sep 17 00:00:00 2001 From: Younglina Date: Tue, 13 Aug 2024 18:20:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9B=B8=E4=BC=BC=E6=AD=8C=E6=89=8B?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E9=9C=80=E8=A6=81=E7=99=BB=E5=BD=95=EF=BC=9B?= =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E8=8E=B7=E5=8F=96=E8=89=BA=E4=BA=BA?= =?UTF-8?q?=E7=83=AD=E9=97=A8=E6=AD=8C=E6=9B=B2=E6=B2=A1=E6=9C=89=E5=9B=BE?= =?UTF-8?q?=E7=89=87=20(#2286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/artist.js | 10 +++++++++- src/views/artist.vue | 8 +++++--- src/views/explore.vue | 11 +++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/api/artist.js b/src/api/artist.js index 462f707..925df45 100644 --- a/src/api/artist.js +++ b/src/api/artist.js @@ -1,5 +1,7 @@ import request from '@/utils/request'; import { mapTrackPlayableStatus } from '@/utils/common'; +import { isAccountLoggedIn } from '@/utils/auth'; +import { getTrackDetail } from '@/api/track'; /** * 获取歌手单曲 @@ -14,7 +16,13 @@ export function getArtist(id) { id, timestamp: new Date().getTime(), }, - }).then(data => { + }).then(async data => { + if (!isAccountLoggedIn()) { + const trackIDs = data.hotSongs.map(t => t.id); + const tracks = await getTrackDetail(trackIDs.join(',')); + data.hotSongs = tracks.songs; + return data; + } data.hotSongs = mapTrackPlayableStatus(data.hotSongs); return data; }); diff --git a/src/views/artist.vue b/src/views/artist.vue index 3e08bb8..d825436 100644 --- a/src/views/artist.vue +++ b/src/views/artist.vue @@ -292,9 +292,11 @@ export default { this.mvs = data.mvs; this.hasMoreMV = data.hasMore; }); - similarArtists(id).then(data => { - this.similarArtists = data.artists; - }); + if (isAccountLoggedIn()) { + similarArtists(id).then(data => { + this.similarArtists = data.artists; + }); + } }, setPopularTracks(hotSongs) { const trackIDs = hotSongs.map(t => t.id); diff --git a/src/views/explore.vue b/src/views/explore.vue index ef190df..90624d0 100644 --- a/src/views/explore.vue +++ b/src/views/explore.vue @@ -120,10 +120,13 @@ export default { setTimeout(() => { if (!this.show) NProgress.start(); }, 1000); - this.activeCategory = - this.$route.query.category === undefined - ? '全部' - : this.$route.query.category; + const queryCategory = this.$route.query.category; + if (queryCategory === undefined) { + this.playlists = []; + this.activeCategory = '全部'; + } else { + this.activeCategory = queryCategory; + } this.getPlaylist(); }, goToCategory(Category) {