Skip to content
代码片段 群组 项目
未验证 提交 481ba6bc 编辑于 作者: Younglina's avatar Younglina 提交者: GitHub
浏览文件

fix: 相似歌手接口需要登录;未登录获取艺人热门歌曲没有图片 (#2286)

上级 df82c7cd
No related branches found
No related tags found
无相关合并请求
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;
});
......
......@@ -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);
......
......@@ -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) {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册