fix: 相似歌手接口需要登录;未登录获取艺人热门歌曲没有图片 (#2286)
This commit is contained in:
parent
df82c7cd22
commit
481ba6bce3
|
@ -1,5 +1,7 @@
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import { mapTrackPlayableStatus } from '@/utils/common';
|
import { mapTrackPlayableStatus } from '@/utils/common';
|
||||||
|
import { isAccountLoggedIn } from '@/utils/auth';
|
||||||
|
import { getTrackDetail } from '@/api/track';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取歌手单曲
|
* 获取歌手单曲
|
||||||
|
@ -14,7 +16,13 @@ export function getArtist(id) {
|
||||||
id,
|
id,
|
||||||
timestamp: new Date().getTime(),
|
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);
|
data.hotSongs = mapTrackPlayableStatus(data.hotSongs);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
|
@ -292,9 +292,11 @@ export default {
|
||||||
this.mvs = data.mvs;
|
this.mvs = data.mvs;
|
||||||
this.hasMoreMV = data.hasMore;
|
this.hasMoreMV = data.hasMore;
|
||||||
});
|
});
|
||||||
similarArtists(id).then(data => {
|
if (isAccountLoggedIn()) {
|
||||||
this.similarArtists = data.artists;
|
similarArtists(id).then(data => {
|
||||||
});
|
this.similarArtists = data.artists;
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setPopularTracks(hotSongs) {
|
setPopularTracks(hotSongs) {
|
||||||
const trackIDs = hotSongs.map(t => t.id);
|
const trackIDs = hotSongs.map(t => t.id);
|
||||||
|
|
|
@ -120,10 +120,13 @@ export default {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!this.show) NProgress.start();
|
if (!this.show) NProgress.start();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
this.activeCategory =
|
const queryCategory = this.$route.query.category;
|
||||||
this.$route.query.category === undefined
|
if (queryCategory === undefined) {
|
||||||
? '全部'
|
this.playlists = [];
|
||||||
: this.$route.query.category;
|
this.activeCategory = '全部';
|
||||||
|
} else {
|
||||||
|
this.activeCategory = queryCategory;
|
||||||
|
}
|
||||||
this.getPlaylist();
|
this.getPlaylist();
|
||||||
},
|
},
|
||||||
goToCategory(Category) {
|
goToCategory(Category) {
|
||||||
|
|
Loading…
Reference in New Issue