fix: bugs

This commit is contained in:
qier222 2021-03-24 22:28:11 +08:00
parent 044720c531
commit fd16d470bd
No known key found for this signature in database
GPG Key ID: 9C85007ED905F14D
5 changed files with 21 additions and 18 deletions

View File

@ -66,14 +66,14 @@
</nav>
<ContextMenu ref="userProfileMenu">
<div class="item" @click="toLogin" v-if="!isLooseLoggedIn">
<svg-icon icon-class="login" />
{{ $t("login.login") }}
</div>
<div class="item" @click="toSettings">
<svg-icon icon-class="settings" />
{{ $t("library.userProfileMenu.settings") }}
</div>
<div class="item" @click="toLogin" v-if="!isLooseLoggedIn">
<svg-icon icon-class="login" />
{{ $t("login.login") }}
</div>
<div class="item" @click="logout" v-if="isLooseLoggedIn">
<svg-icon icon-class="logout" />
{{ $t("library.userProfileMenu.logout") }}

View File

@ -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") {

View File

@ -56,9 +56,7 @@
<div></div>
</div>
<div class="album" v-if="!isTracklist && !isAlbum">
<router-link :to="`/album/${track.al.id}`">{{
track.al.name
}}</router-link>
<router-link :to="`/album/${album.id}`">{{ album.name }}</router-link>
<div></div>
</div>
<div class="actions" v-if="!isTracklist">
@ -66,8 +64,7 @@
<svg-icon
icon-class="heart"
:style="{
visibility:
focus && !isLiked && track.playable ? 'visible' : 'hidden',
visibility: focus && !isLiked ? 'visible' : 'hidden',
}"
></svg-icon>
<svg-icon icon-class="heart-solid" v-show="isLiked"></svg-icon>
@ -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;
},

View File

@ -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();

View File

@ -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;
});