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) {