提交 83ab8bb4 编写于 作者: Z Zachary

feat: add album method of api

上级 c2b3371f
import { requset } from "./base";
export const albumAreas = {
ALL: { name: "全部", dataId: "ALL" },
ZH: { name: "华语", dataId: "ZH" },
EA: { name: "欧美", dataId: "EA" },
KR: { name: "韩国", dataId: "KR" },
JP: { name: "日本", dataId: "JP" }
};
// 获得专辑内容
export const getAlbum = id => require.get(`/album?id=${id}`);
// 获得专辑动态信息,如是否收藏,收藏数,评论数,分享数
export const getAlbumDetail = id => require.get(`/album/detail?id=${id}`);
export const getTopAlbum = params =>
requset.get("/top/album", { params: params });
......@@ -6,6 +6,7 @@ export * from "./playlist";
export * from "./song";
export * from "./songer";
export * from "./mv";
export * from "./album";
export * from "./search";
export const getBanner = () => requset.get("/banner?type=0");
......
......@@ -41,6 +41,19 @@ export function createSong(song) {
};
}
export function createAlbum(album) {
const { id, name, img, artists, publishTime, ...rest } = album;
return {
id,
name,
img,
artists,
publishTime: formatDate(publishTime, "yyyy-MM-dd"),
...rest
};
}
export function genSongPlayUrl(id) {
return `https://music.163.com/song/media/outer/url?id=${id}.mp3`;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册