mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-02-02 07:58:03 +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 request from "@/utils/request";
|
||||||
|
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||||
|
|
||||||
export function getArtist(id) {
|
export function getArtist(id) {
|
||||||
return request({
|
return request({
|
||||||
url: "/artists",
|
url: "/artists",
|
||||||
method: "get",
|
method: "get",
|
||||||
params: {
|
params: {
|
||||||
id,
|
id
|
||||||
},
|
}
|
||||||
|
}).then(data => {
|
||||||
|
data.hotSongs = mapTrackPlayableStatus(data.hotSongs);
|
||||||
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +21,7 @@ export function getArtistAlbum(params) {
|
||||||
return request({
|
return request({
|
||||||
url: "/artist/album",
|
url: "/artist/album",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +35,8 @@ export function toplistOfArtists(type = null) {
|
||||||
url: "/toplist/artist",
|
url: "/toplist/artist",
|
||||||
method: "get",
|
method: "get",
|
||||||
params: {
|
params: {
|
||||||
type,
|
type
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +45,7 @@ export function artistMv(id) {
|
||||||
url: "/artist/mv",
|
url: "/artist/mv",
|
||||||
method: "get",
|
method: "get",
|
||||||
params: {
|
params: {
|
||||||
id,
|
id
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import { mapTrackPlayableStatus } from "@/utils/common";
|
||||||
|
|
||||||
export function recommendPlaylist(params) {
|
export function recommendPlaylist(params) {
|
||||||
// limit: 取出数量 , 默认为 30
|
// limit: 取出数量 , 默认为 30
|
||||||
return request({
|
return request({
|
||||||
url: "/personalized",
|
url: "/personalized",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export function dailyRecommendPlaylist(params) {
|
export function dailyRecommendPlaylist(params) {
|
||||||
|
@ -13,7 +14,7 @@ export function dailyRecommendPlaylist(params) {
|
||||||
return request({
|
return request({
|
||||||
url: "/recommend/resource",
|
url: "/recommend/resource",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +24,10 @@ export function getPlaylistDetail(id, noCache = false) {
|
||||||
return request({
|
return request({
|
||||||
url: "/playlist/detail",
|
url: "/playlist/detail",
|
||||||
method: "get",
|
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({
|
return request({
|
||||||
url: "/top/playlist/highquality",
|
url: "/top/playlist/highquality",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,21 +50,21 @@ export function topPlaylist(params) {
|
||||||
return request({
|
return request({
|
||||||
url: "/top/playlist",
|
url: "/top/playlist",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function playlistCatlist() {
|
export function playlistCatlist() {
|
||||||
return request({
|
return request({
|
||||||
url: "/playlist/catlist",
|
url: "/playlist/catlist",
|
||||||
method: "get",
|
method: "get"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toplists() {
|
export function toplists() {
|
||||||
return request({
|
return request({
|
||||||
url: "/toplist",
|
url: "/toplist",
|
||||||
method: "get",
|
method: "get"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +74,6 @@ export function subscribePlaylist(params) {
|
||||||
return request({
|
return request({
|
||||||
url: "/playlist/subscribe",
|
url: "/playlist/subscribe",
|
||||||
method: "get",
|
method: "get",
|
||||||
params,
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapMutations, mapActions, mapState } from "vuex";
|
import { mapMutations, mapActions, mapState } from "vuex";
|
||||||
import { getArtist, getArtistAlbum, artistMv } from "@/api/artist";
|
import { getArtist, getArtistAlbum, artistMv } from "@/api/artist";
|
||||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
|
||||||
import { playAList } from "@/utils/play";
|
import { playAList } from "@/utils/play";
|
||||||
import NProgress from "nprogress";
|
import NProgress from "nprogress";
|
||||||
|
|
||||||
|
@ -146,7 +145,6 @@ export default {
|
||||||
getArtist(id).then(data => {
|
getArtist(id).then(data => {
|
||||||
this.artist = data.artist;
|
this.artist = data.artist;
|
||||||
this.popularTracks = data.hotSongs;
|
this.popularTracks = data.hotSongs;
|
||||||
this.popularTracks = mapTrackPlayableStatus(this.popularTracks);
|
|
||||||
if (next !== undefined) next();
|
if (next !== undefined) next();
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
this.show = true;
|
this.show = true;
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
import { mapState } from "vuex";
|
import { mapState } from "vuex";
|
||||||
import { getTrackDetail, getLyric } from "@/api/track";
|
import { getTrackDetail, getLyric } from "@/api/track";
|
||||||
import { userDetail, userPlaylist } from "@/api/user";
|
import { userDetail, userPlaylist } from "@/api/user";
|
||||||
import { mapTrackPlayableStatus, randomNum } from "@/utils/common";
|
import { randomNum } from "@/utils/common";
|
||||||
import { getPlaylistDetail } from "@/api/playlist";
|
import { getPlaylistDetail } from "@/api/playlist";
|
||||||
import { playPlaylistByID } from "@/utils/play";
|
import { playPlaylistByID } from "@/utils/play";
|
||||||
import NProgress from "nprogress";
|
import NProgress from "nprogress";
|
||||||
|
@ -149,17 +149,16 @@ export default {
|
||||||
this.playlists.push(...data.playlist);
|
this.playlists.push(...data.playlist);
|
||||||
}
|
}
|
||||||
this.hasMorePlaylists = data.more;
|
this.hasMorePlaylists = data.more;
|
||||||
this.likedSongsPlaylist = data.playlist[0];
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLikedSongs(getLyric = true) {
|
getLikedSongs(getLyric = true) {
|
||||||
getPlaylistDetail(this.settings.user.likedSongPlaylistID, true).then(
|
getPlaylistDetail(this.settings.user.likedSongPlaylistID, true).then(
|
||||||
data => {
|
data => {
|
||||||
|
this.likedSongsPlaylist = data.playlist;
|
||||||
let TrackIDs = data.playlist.trackIds.slice(0, 20).map(t => t.id);
|
let TrackIDs = data.playlist.trackIds.slice(0, 20).map(t => t.id);
|
||||||
this.likedSongIDs = TrackIDs;
|
this.likedSongIDs = TrackIDs;
|
||||||
getTrackDetail(this.likedSongIDs.join(",")).then(data => {
|
getTrackDetail(this.likedSongIDs.join(",")).then(data => {
|
||||||
this.likedSongs = data.songs;
|
this.likedSongs = data.songs;
|
||||||
this.likedSongs = mapTrackPlayableStatus(this.likedSongs);
|
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
this.show = true;
|
this.show = true;
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,7 +92,6 @@ import NProgress from "nprogress";
|
||||||
import { getPlaylistDetail, subscribePlaylist } from "@/api/playlist";
|
import { getPlaylistDetail, subscribePlaylist } from "@/api/playlist";
|
||||||
import { playAList } from "@/utils/play";
|
import { playAList } from "@/utils/play";
|
||||||
import { getTrackDetail } from "@/api/track";
|
import { getTrackDetail } from "@/api/track";
|
||||||
import { mapTrackPlayableStatus } from "@/utils/common";
|
|
||||||
import { isLoggedIn } from "@/utils/auth";
|
import { isLoggedIn } from "@/utils/auth";
|
||||||
|
|
||||||
import ButtonTwoTone from "@/components/ButtonTwoTone.vue";
|
import ButtonTwoTone from "@/components/ButtonTwoTone.vue";
|
||||||
|
@ -166,7 +165,6 @@ export default {
|
||||||
.then(data => {
|
.then(data => {
|
||||||
this.playlist = data.playlist;
|
this.playlist = data.playlist;
|
||||||
this.tracks = data.playlist.tracks;
|
this.tracks = data.playlist.tracks;
|
||||||
this.tracks = mapTrackPlayableStatus(this.tracks);
|
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
if (next !== undefined) next();
|
if (next !== undefined) next();
|
||||||
this.show = true;
|
this.show = true;
|
||||||
|
@ -194,7 +192,6 @@ export default {
|
||||||
trackIDs = trackIDs.map(t => t.id);
|
trackIDs = trackIDs.map(t => t.id);
|
||||||
getTrackDetail(trackIDs.join(",")).then(data => {
|
getTrackDetail(trackIDs.join(",")).then(data => {
|
||||||
this.tracks.push(...data.songs);
|
this.tracks.push(...data.songs);
|
||||||
this.tracks = mapTrackPlayableStatus(this.tracks);
|
|
||||||
this.lastLoadedTrackIndex += trackIDs.length;
|
this.lastLoadedTrackIndex += trackIDs.length;
|
||||||
this.loadingMore = false;
|
this.loadingMore = false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user