File tree 3 files changed +21
-8
lines changed
3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change 1
1
import request from '@/utils/request' ;
2
2
import { mapTrackPlayableStatus } from '@/utils/common' ;
3
+ import { isAccountLoggedIn } from '@/utils/auth' ;
4
+ import { getTrackDetail } from '@/api/track' ;
3
5
4
6
/**
5
7
* 获取歌手单曲
@@ -14,7 +16,13 @@ export function getArtist(id) {
14
16
id,
15
17
timestamp : new Date ( ) . getTime ( ) ,
16
18
} ,
17
- } ) . then ( data => {
19
+ } ) . then ( async data => {
20
+ if ( ! isAccountLoggedIn ( ) ) {
21
+ const trackIDs = data . hotSongs . map ( t => t . id ) ;
22
+ const tracks = await getTrackDetail ( trackIDs . join ( ',' ) ) ;
23
+ data . hotSongs = tracks . songs ;
24
+ return data ;
25
+ }
18
26
data . hotSongs = mapTrackPlayableStatus ( data . hotSongs ) ;
19
27
return data ;
20
28
} ) ;
Original file line number Diff line number Diff line change @@ -292,9 +292,11 @@ export default {
292
292
this .mvs = data .mvs ;
293
293
this .hasMoreMV = data .hasMore ;
294
294
});
295
- similarArtists (id).then (data => {
296
- this .similarArtists = data .artists ;
297
- });
295
+ if (isAccountLoggedIn ()) {
296
+ similarArtists (id).then (data => {
297
+ this .similarArtists = data .artists ;
298
+ });
299
+ }
298
300
},
299
301
setPopularTracks (hotSongs ) {
300
302
const trackIDs = hotSongs .map (t => t .id );
Original file line number Diff line number Diff line change @@ -120,10 +120,13 @@ export default {
120
120
setTimeout (() => {
121
121
if (! this .show ) NProgress .start ();
122
122
}, 1000 );
123
- this .activeCategory =
124
- this .$route .query .category === undefined
125
- ? ' 全部'
126
- : this .$route .query .category ;
123
+ const queryCategory = this .$route .query .category ;
124
+ if (queryCategory === undefined ) {
125
+ this .playlists = [];
126
+ this .activeCategory = ' 全部' ;
127
+ } else {
128
+ this .activeCategory = queryCategory;
129
+ }
127
130
this .getPlaylist ();
128
131
},
129
132
goToCategory (Category ) {
You can’t perform that action at this time.
0 commit comments