|
|
@ -40,9 +40,40 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="playlists" v-if="playlists.length > 1">
|
|
|
|
<div class="section-two" id="liked">
|
|
|
|
<div class="title">{{ $t("playlist.playlist") }}</div>
|
|
|
|
<div class="tabs">
|
|
|
|
<div>
|
|
|
|
<div
|
|
|
|
|
|
|
|
class="tab"
|
|
|
|
|
|
|
|
:class="{ active: currentTab === 'playlists' }"
|
|
|
|
|
|
|
|
@click="updateCurrentTab('playlists')"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
Playlists
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
class="tab"
|
|
|
|
|
|
|
|
:class="{ active: currentTab === 'albums' }"
|
|
|
|
|
|
|
|
@click="updateCurrentTab('albums')"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
Albums
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
class="tab"
|
|
|
|
|
|
|
|
:class="{ active: currentTab === 'artists' }"
|
|
|
|
|
|
|
|
@click="updateCurrentTab('artists')"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
Artists
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
class="tab"
|
|
|
|
|
|
|
|
:class="{ active: currentTab === 'mvs' }"
|
|
|
|
|
|
|
|
@click="updateCurrentTab('mvs')"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
MVs
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-show="currentTab === 'playlists'">
|
|
|
|
|
|
|
|
<div v-if="playlists.length > 1">
|
|
|
|
<CoverRow
|
|
|
|
<CoverRow
|
|
|
|
:items="playlists.slice(1)"
|
|
|
|
:items="playlists.slice(1)"
|
|
|
|
type="playlist"
|
|
|
|
type="playlist"
|
|
|
@ -51,13 +82,37 @@
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-show="currentTab === 'albums'">
|
|
|
|
|
|
|
|
<CoverRow
|
|
|
|
|
|
|
|
:items="albums"
|
|
|
|
|
|
|
|
type="album"
|
|
|
|
|
|
|
|
subText="artist"
|
|
|
|
|
|
|
|
:showPlayButton="true"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-show="currentTab === 'artists'">
|
|
|
|
|
|
|
|
<CoverRow :items="artists" type="artist" :showPlayButton="true" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div v-show="currentTab === 'mvs'">
|
|
|
|
|
|
|
|
<MvRow :mvs="mvs" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
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,
|
|
|
|
|
|
|
|
likedAlbums,
|
|
|
|
|
|
|
|
likedArtists,
|
|
|
|
|
|
|
|
likedMVs,
|
|
|
|
|
|
|
|
} from "@/api/user";
|
|
|
|
import { randomNum, dailyTask } from "@/utils/common";
|
|
|
|
import { randomNum, dailyTask } from "@/utils/common";
|
|
|
|
import { getPlaylistDetail } from "@/api/playlist";
|
|
|
|
import { getPlaylistDetail } from "@/api/playlist";
|
|
|
|
import { playPlaylistByID } from "@/utils/play";
|
|
|
|
import { playPlaylistByID } from "@/utils/play";
|
|
|
@ -65,11 +120,12 @@ import NProgress from "nprogress";
|
|
|
|
|
|
|
|
|
|
|
|
import TrackList from "@/components/TrackList.vue";
|
|
|
|
import TrackList from "@/components/TrackList.vue";
|
|
|
|
import CoverRow from "@/components/CoverRow.vue";
|
|
|
|
import CoverRow from "@/components/CoverRow.vue";
|
|
|
|
|
|
|
|
import MvRow from "@/components/MvRow.vue";
|
|
|
|
import SvgIcon from "@/components/SvgIcon.vue";
|
|
|
|
import SvgIcon from "@/components/SvgIcon.vue";
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "Library",
|
|
|
|
name: "Library",
|
|
|
|
components: { SvgIcon, CoverRow, TrackList },
|
|
|
|
components: { SvgIcon, CoverRow, TrackList, MvRow },
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
show: false,
|
|
|
|
show: false,
|
|
|
@ -88,11 +144,15 @@ export default {
|
|
|
|
likedSongs: [],
|
|
|
|
likedSongs: [],
|
|
|
|
likedSongIDs: [],
|
|
|
|
likedSongIDs: [],
|
|
|
|
lyric: undefined,
|
|
|
|
lyric: undefined,
|
|
|
|
|
|
|
|
currentTab: "playlists",
|
|
|
|
|
|
|
|
albums: [],
|
|
|
|
|
|
|
|
artists: [],
|
|
|
|
|
|
|
|
mvs: [],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
created() {
|
|
|
|
NProgress.start();
|
|
|
|
NProgress.start();
|
|
|
|
userDetail(this.settings.user.userId).then((data) => {
|
|
|
|
userDetail(this.data.user.userId).then((data) => {
|
|
|
|
this.user = data;
|
|
|
|
this.user = data;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -101,7 +161,7 @@ export default {
|
|
|
|
dailyTask();
|
|
|
|
dailyTask();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
...mapState(["settings"]),
|
|
|
|
...mapState(["data"]),
|
|
|
|
likedSongsInState() {
|
|
|
|
likedSongsInState() {
|
|
|
|
return this.$store.state.liked.songs;
|
|
|
|
return this.$store.state.liked.songs;
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -129,18 +189,38 @@ export default {
|
|
|
|
playLikedSongs() {
|
|
|
|
playLikedSongs() {
|
|
|
|
playPlaylistByID(this.playlists[0].id, "first", true);
|
|
|
|
playPlaylistByID(this.playlists[0].id, "first", true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
updateCurrentTab(tab) {
|
|
|
|
|
|
|
|
this.currentTab = tab;
|
|
|
|
|
|
|
|
document
|
|
|
|
|
|
|
|
.getElementById("liked")
|
|
|
|
|
|
|
|
.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
|
|
|
|
|
|
if (tab === "albums") {
|
|
|
|
|
|
|
|
if (this.albums.length === 0) this.loadLikedAlbums();
|
|
|
|
|
|
|
|
} else if (tab === "artists") {
|
|
|
|
|
|
|
|
if (this.artists.length === 0) this.loadLikedArtists();
|
|
|
|
|
|
|
|
} else if (tab === "mvs") {
|
|
|
|
|
|
|
|
if (this.mvs.length === 0) this.loadLikedMVs();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
goToLikedSongsList() {
|
|
|
|
goToLikedSongsList() {
|
|
|
|
this.$router.push({ path: "/library/liked-songs" });
|
|
|
|
this.$router.push({ path: "/library/liked-songs" });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
loadData() {
|
|
|
|
loadData() {
|
|
|
|
if (this.hasMorePlaylists) {
|
|
|
|
if (this.hasMorePlaylists && this.currentTab === "playlists") {
|
|
|
|
this.getUserPlaylists();
|
|
|
|
this.getUserPlaylists();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.currentTab === "albums") {
|
|
|
|
|
|
|
|
this.loadLikedAlbums();
|
|
|
|
|
|
|
|
} else if (this.currentTab === "artists") {
|
|
|
|
|
|
|
|
this.loadLikedArtists();
|
|
|
|
|
|
|
|
} else if (this.currentTab === "mvs") {
|
|
|
|
|
|
|
|
this.loadLikedMVs();
|
|
|
|
|
|
|
|
}
|
|
|
|
this.getLikedSongs();
|
|
|
|
this.getLikedSongs();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getUserPlaylists(replace = false) {
|
|
|
|
getUserPlaylists(replace = false) {
|
|
|
|
userPlaylist({
|
|
|
|
userPlaylist({
|
|
|
|
uid: this.settings.user.userId,
|
|
|
|
uid: this.data.user.userId,
|
|
|
|
offset: this.playlists.length === 0 ? 0 : this.playlists.length - 1,
|
|
|
|
offset: this.playlists.length === 0 ? 0 : this.playlists.length - 1,
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
timestamp: new Date().getTime(),
|
|
|
|
}).then((data) => {
|
|
|
|
}).then((data) => {
|
|
|
@ -153,8 +233,7 @@ export default {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getLikedSongs(getLyric = true) {
|
|
|
|
getLikedSongs(getLyric = true) {
|
|
|
|
getPlaylistDetail(this.settings.user.likedSongPlaylistID, true).then(
|
|
|
|
getPlaylistDetail(this.data.likedSongPlaylistID, true).then((data) => {
|
|
|
|
(data) => {
|
|
|
|
|
|
|
|
this.likedSongsPlaylist = data.playlist;
|
|
|
|
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;
|
|
|
@ -164,8 +243,7 @@ export default {
|
|
|
|
this.show = true;
|
|
|
|
this.show = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (getLyric) this.getRandomLyric();
|
|
|
|
if (getLyric) this.getRandomLyric();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getRandomLyric() {
|
|
|
|
getRandomLyric() {
|
|
|
|
getLyric(
|
|
|
|
getLyric(
|
|
|
@ -174,6 +252,21 @@ export default {
|
|
|
|
if (data.lrc !== undefined) this.lyric = data.lrc.lyric;
|
|
|
|
if (data.lrc !== undefined) this.lyric = data.lrc.lyric;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
loadLikedAlbums() {
|
|
|
|
|
|
|
|
likedAlbums().then((data) => {
|
|
|
|
|
|
|
|
this.albums = data.data;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
loadLikedArtists() {
|
|
|
|
|
|
|
|
likedArtists().then((data) => {
|
|
|
|
|
|
|
|
this.artists = data.data;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
loadLikedMVs() {
|
|
|
|
|
|
|
|
likedMVs().then((data) => {
|
|
|
|
|
|
|
|
this.mvs = data.data;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
watch: {
|
|
|
|
likedSongsInState() {
|
|
|
|
likedSongsInState() {
|
|
|
@ -280,14 +373,37 @@ h1 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.playlists {
|
|
|
|
.section-two {
|
|
|
|
|
|
|
|
// margin-top: 42px;
|
|
|
|
|
|
|
|
// padding-top: 14px;
|
|
|
|
|
|
|
|
// border-top: 1px solid rgba(128, 128, 128, 0.18);
|
|
|
|
margin-top: 54px;
|
|
|
|
margin-top: 54px;
|
|
|
|
.title {
|
|
|
|
min-height: calc(100vh - 182px);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.tabs {
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
color: var(--color-text);
|
|
|
|
color: var(--color-text);
|
|
|
|
opacity: 0.88;
|
|
|
|
margin-bottom: 6px;
|
|
|
|
margin-bottom: 8px;
|
|
|
|
.tab {
|
|
|
|
font-size: 24px;
|
|
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
|
|
padding: 8px 14px;
|
|
|
|
|
|
|
|
margin: 10px 14px 6px 0;
|
|
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
user-select: none;
|
|
|
|
|
|
|
|
transition: 0.2s;
|
|
|
|
|
|
|
|
opacity: 0.68;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
|
|
opacity: 0.88;
|
|
|
|
|
|
|
|
background-color: var(--color-secondary-bg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.tab.active {
|
|
|
|
|
|
|
|
opacity: 0.88;
|
|
|
|
|
|
|
|
background-color: var(--color-secondary-bg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|