From fd16d470bd3cafce349c3564e1e64d5cdba59c1c Mon Sep 17 00:00:00 2001 From: qier222 Date: Wed, 24 Mar 2021 22:28:11 +0800 Subject: [PATCH] fix: bugs --- src/components/Navbar.vue | 8 ++++---- src/components/TrackList.vue | 7 ++----- src/components/TrackListItem.vue | 10 +++++----- src/utils/Player.js | 10 +++++++--- src/utils/request.js | 4 +++- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index bd16b51..18ae01a 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -66,14 +66,14 @@ -
- - {{ $t("login.login") }} -
{{ $t("library.userProfileMenu.settings") }}
+
+ + {{ $t("login.login") }} +
{{ $t("library.userProfileMenu.logout") }} diff --git a/src/components/TrackList.vue b/src/components/TrackList.vue index c897a25..7f7ff4f 100644 --- a/src/components/TrackList.vue +++ b/src/components/TrackList.vue @@ -119,11 +119,8 @@ export default { }, methods: { ...mapMutations(["updateLikedSongs", "updateModal"]), - ...mapActions(["nextTrack", "playTrackOnListByID", "showToast"]), + ...mapActions(["nextTrack", "showToast"]), openMenu(e, track) { - if (!track.playable) { - return; - } this.rightClickedTrack = track; this.$refs.menu.openMenu(e); }, @@ -141,7 +138,7 @@ export default { } else if (this.dbclickTrackFunc === "none") { // do nothing } else if (this.dbclickTrackFunc === "playTrackOnListByID") { - this.playTrackOnListByID(trackID); + this.$store.state.player.playTrackOnListByID(trackID); } else if (this.dbclickTrackFunc === "playPlaylistByID") { this.$store.state.player.playPlaylistByID(this.id, trackID); } else if (this.dbclickTrackFunc === "playAList") { diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue index 4d5a892..2140604 100644 --- a/src/components/TrackListItem.vue +++ b/src/components/TrackListItem.vue @@ -56,9 +56,7 @@
- {{ - track.al.name - }} + {{ album.name }}
@@ -66,8 +64,7 @@ @@ -111,6 +108,9 @@ export default { if (this.track.artists !== undefined) return this.track.artists; return []; }, + album() { + return this.track.album || this.track.al; + }, type() { return this.$parent.type; }, diff --git a/src/utils/Player.js b/src/utils/Player.js index 72fd4c3..e59375f 100644 --- a/src/utils/Player.js +++ b/src/utils/Player.js @@ -162,7 +162,7 @@ export default class { if (firstTrackID !== "first") this._shuffledList.unshift(firstTrackID); } async _scrobble(track, time, complete = false) { - console.log("scrobble"); + console.log(`scrobble ${track.name} by ${track.ar[0].name}`); const trackDuration = ~~(track.dt / 1000); scrobble({ id: track.id, @@ -173,7 +173,6 @@ export default class { store.state.lastfm.key !== undefined && (time >= trackDuration / 2 || time >= 240) ) { - console.log({ currentTrack: track }); const timestamp = ~~(new Date().getTime() / 1000) - time; trackScrobble({ artist: track.ar[0].name, @@ -425,7 +424,6 @@ export default class { document.title = `${this._currentTrack.name} ยท ${this._currentTrack.ar[0].name} - YesPlayMusic`; this._playDiscordPresence(this._currentTrack, this.seek()); if (store.state.lastfm.key !== undefined) { - console.log({ currentTrack: this.currentTrack }); trackUpdateNowPlaying({ artist: this.currentTrack.ar[0].name, track: this.currentTrack.name, @@ -505,6 +503,12 @@ export default class { this.replacePlaylist(trackIDs, id, "artist", trackID); }); } + playTrackOnListByID(id, listName = "default") { + if (listName === "default") { + this._current = this._list.findIndex((t) => t === id); + } + this._replaceCurrentTrack(id); + } addTrackToPlayNext(trackID, playNow = false) { this._playNextList.push(trackID); if (playNow) this.playNextTrack(); diff --git a/src/utils/request.js b/src/utils/request.js index b984ae9..1ff8810 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -21,7 +21,9 @@ const service = axios.create({ service.interceptors.request.use(function (config) { if (!config.params) config.params = {}; - config.params.cookie = `MUSIC_U=${Cookies.get("MUSIC_U")};`; + if (baseURL[0] !== "/") { + config.params.cookie = `MUSIC_U=${Cookies.get("MUSIC_U")};`; + } return config; });