mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-02-02 06:05:49 +08:00
style: remove mapTrackPlayableStatus from vue components
This commit is contained in:
parent
c3d0aeff23
commit
89bb04b51b
|
@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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
|
||||
});
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
<script>
|
||||
import { mapMutations, mapActions, mapState } from "vuex";
|
||||
import { getArtist, getArtistAlbum, artistMv } from "@/api/artist";
|
||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||
import { playAList } from "@/utils/play";
|
||||
import NProgress from "nprogress";
|
||||
|
||||
|
@ -146,7 +145,6 @@ export default {
|
|||
getArtist(id).then(data => {
|
||||
this.artist = data.artist;
|
||||
this.popularTracks = data.hotSongs;
|
||||
this.popularTracks = mapTrackPlayableStatus(this.popularTracks);
|
||||
if (next !== undefined) next();
|
||||
NProgress.done();
|
||||
this.show = true;
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
import { mapState } from "vuex";
|
||||
import { getTrackDetail, getLyric } from "@/api/track";
|
||||
import { userDetail, userPlaylist } from "@/api/user";
|
||||
import { mapTrackPlayableStatus, randomNum } from "@/utils/common";
|
||||
import { randomNum } from "@/utils/common";
|
||||
import { getPlaylistDetail } from "@/api/playlist";
|
||||
import { playPlaylistByID } from "@/utils/play";
|
||||
import NProgress from "nprogress";
|
||||
|
@ -149,17 +149,16 @@ export default {
|
|||
this.playlists.push(...data.playlist);
|
||||
}
|
||||
this.hasMorePlaylists = data.more;
|
||||
this.likedSongsPlaylist = data.playlist[0];
|
||||
});
|
||||
},
|
||||
getLikedSongs(getLyric = true) {
|
||||
getPlaylistDetail(this.settings.user.likedSongPlaylistID, true).then(
|
||||
data => {
|
||||
this.likedSongsPlaylist = data.playlist;
|
||||
let TrackIDs = data.playlist.trackIds.slice(0, 20).map(t => t.id);
|
||||
this.likedSongIDs = TrackIDs;
|
||||
getTrackDetail(this.likedSongIDs.join(",")).then(data => {
|
||||
this.likedSongs = data.songs;
|
||||
this.likedSongs = mapTrackPlayableStatus(this.likedSongs);
|
||||
NProgress.done();
|
||||
this.show = true;
|
||||
});
|
||||
|
|
|
@ -92,7 +92,6 @@ import NProgress from "nprogress";
|
|||
import { getPlaylistDetail, subscribePlaylist } from "@/api/playlist";
|
||||
import { playAList } from "@/utils/play";
|
||||
import { getTrackDetail } from "@/api/track";
|
||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||
import { isLoggedIn } from "@/utils/auth";
|
||||
|
||||
import ButtonTwoTone from "@/components/ButtonTwoTone.vue";
|
||||
|
@ -166,7 +165,6 @@ export default {
|
|||
.then(data => {
|
||||
this.playlist = data.playlist;
|
||||
this.tracks = data.playlist.tracks;
|
||||
this.tracks = mapTrackPlayableStatus(this.tracks);
|
||||
NProgress.done();
|
||||
if (next !== undefined) next();
|
||||
this.show = true;
|
||||
|
@ -194,7 +192,6 @@ export default {
|
|||
trackIDs = trackIDs.map(t => t.id);
|
||||
getTrackDetail(trackIDs.join(",")).then(data => {
|
||||
this.tracks.push(...data.songs);
|
||||
this.tracks = mapTrackPlayableStatus(this.tracks);
|
||||
this.lastLoadedTrackIndex += trackIDs.length;
|
||||
this.loadingMore = false;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user