From 89bb04b51bd6377382986a14f7811c7d5d5aa4dc Mon Sep 17 00:00:00 2001
From: qier222 <68148142+qier222@users.noreply.github.com>
Date: Wed, 21 Oct 2020 15:50:56 +0800
Subject: [PATCH 1/5] style: remove mapTrackPlayableStatus from vue components
---
src/api/artist.js | 18 +++++++++++-------
src/api/playlist.js | 20 ++++++++++++--------
src/views/artist.vue | 2 --
src/views/library.vue | 5 ++---
src/views/playlist.vue | 3 ---
5 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/src/api/artist.js b/src/api/artist.js
index 0d0fedc..c7fcad5 100644
--- a/src/api/artist.js
+++ b/src/api/artist.js
@@ -1,12 +1,16 @@
import request from "@/utils/request";
+import { mapTrackPlayableStatus } from "@/utils/common";
export function getArtist(id) {
return request({
url: "/artists",
method: "get",
params: {
- id,
- },
+ id
+ }
+ }).then(data => {
+ data.hotSongs = mapTrackPlayableStatus(data.hotSongs);
+ return data;
});
}
@@ -17,7 +21,7 @@ export function getArtistAlbum(params) {
return request({
url: "/artist/album",
method: "get",
- params,
+ params
});
}
@@ -31,8 +35,8 @@ export function toplistOfArtists(type = null) {
url: "/toplist/artist",
method: "get",
params: {
- type,
- },
+ type
+ }
});
}
@@ -41,7 +45,7 @@ export function artistMv(id) {
url: "/artist/mv",
method: "get",
params: {
- id,
- },
+ id
+ }
});
}
diff --git a/src/api/playlist.js b/src/api/playlist.js
index 49c5450..b33cfce 100644
--- a/src/api/playlist.js
+++ b/src/api/playlist.js
@@ -1,11 +1,12 @@
import request from "@/utils/request";
+import { mapTrackPlayableStatus } from "@/utils/common";
export function recommendPlaylist(params) {
// limit: 取出数量 , 默认为 30
return request({
url: "/personalized",
method: "get",
- params,
+ params
});
}
export function dailyRecommendPlaylist(params) {
@@ -13,7 +14,7 @@ export function dailyRecommendPlaylist(params) {
return request({
url: "/recommend/resource",
method: "get",
- params,
+ params
});
}
@@ -23,7 +24,10 @@ export function getPlaylistDetail(id, noCache = false) {
return request({
url: "/playlist/detail",
method: "get",
- params,
+ params
+ }).then(data => {
+ data.playlist.tracks = mapTrackPlayableStatus(data.playlist.tracks);
+ return data;
});
}
@@ -34,7 +38,7 @@ export function highQualityPlaylist(params) {
return request({
url: "/top/playlist/highquality",
method: "get",
- params,
+ params
});
}
@@ -46,21 +50,21 @@ export function topPlaylist(params) {
return request({
url: "/top/playlist",
method: "get",
- params,
+ params
});
}
export function playlistCatlist() {
return request({
url: "/playlist/catlist",
- method: "get",
+ method: "get"
});
}
export function toplists() {
return request({
url: "/toplist",
- method: "get",
+ method: "get"
});
}
@@ -70,6 +74,6 @@ export function subscribePlaylist(params) {
return request({
url: "/playlist/subscribe",
method: "get",
- params,
+ params
});
}
diff --git a/src/views/artist.vue b/src/views/artist.vue
index c731a4a..44320cf 100644
--- a/src/views/artist.vue
+++ b/src/views/artist.vue
@@ -94,7 +94,6 @@
diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue
index 043bc37..62ce2c8 100644
--- a/src/components/TrackListItem.vue
+++ b/src/components/TrackListItem.vue
@@ -3,6 +3,7 @@
class="track"
:class="trackClass"
:style="trackStyle"
+ :title="track.reason"
@mouseover="focus = true"
@mouseleave="focus = false"
>
@@ -15,7 +16,7 @@
>