From bada4ad49440f4483e58055ec1b65d2b615f8cf9 Mon Sep 17 00:00:00 2001 From: qier222 <68148142+qier222@users.noreply.github.com> Date: Wed, 28 Oct 2020 12:49:51 +0800 Subject: [PATCH] feat: save mv to your library --- src/api/mv.js | 22 +++++++++++++++++++++- src/components/MvRow.vue | 2 +- src/views/mv.vue | 35 +++++++++++++++++++++++++++++++++-- 3 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/api/mv.js b/src/api/mv.js index d00b095..f294785 100644 --- a/src/api/mv.js +++ b/src/api/mv.js @@ -13,6 +13,7 @@ export function mvDetail(mvid) { method: "get", params: { mvid, + timestamp: new Date().getTime(), }, }); } @@ -27,7 +28,6 @@ export function mvDetail(mvid) { * @param {number} params.id * @param {number=} params.r */ - export function mvUrl(params) { return request({ url: "/mv/url", @@ -35,6 +35,7 @@ export function mvUrl(params) { params, }); } + /** * 相似 mv * 说明 : 调用此接口 , 传入 mvid 可获取相似 mv @@ -47,3 +48,22 @@ export function simiMv(mvid) { params: { mvid }, }); } + +/** + * 收藏/取消收藏 MV + * 说明 : 调用此接口,可收藏/取消收藏 MV + * - mvid: mv id + * - t: 1 为收藏,其他为取消收藏 + * @param {Object} params + * @param {number} params.mvid + * @param {number=} params.t + */ + +export function likeAMV(params) { + params.timestamp = new Date().getTime(); + return request({ + url: "/mv/sub", + method: "post", + params, + }); +} diff --git a/src/components/MvRow.vue b/src/components/MvRow.vue index d26c50a..477ca9c 100644 --- a/src/components/MvRow.vue +++ b/src/components/MvRow.vue @@ -74,7 +74,7 @@ export default { artistName = mv.creator[0].userName; artistID = mv.creator[0].userId; } - return `${artistName}`; + return `${artistName}`; } else if (this.subtitle === "publishTime") { return mv.publishTime; } diff --git a/src/views/mv.vue b/src/views/mv.vue index ffd3e55..93ae17e 100644 --- a/src/views/mv.vue +++ b/src/views/mv.vue @@ -11,6 +11,12 @@ }} - {{ mv.data.name }} +
+ + + + +
{{ mv.data.playCount | formatPlayCount }} Views · @@ -26,17 +32,20 @@