diff --git a/src/components/Player.vue b/src/components/Player.vue index 9cf962e..7577fe9 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -37,7 +37,7 @@ -
+
1 ? max - 1 : max; }, - accountLogin() { - return isAccountLoggedIn(); - }, }, methods: { ...mapMutations([ @@ -206,6 +203,7 @@ export default { "previousTrack", "playTrackOnListByID", "addNextTrackEvent", + "showToast", ]), play() { if (this.playing) { @@ -269,6 +267,10 @@ export default { return `${min}:${sec}`; }, likeCurrentSong() { + if (!isAccountLoggedIn()) { + this.showToast("此操作需要登录网易云账号"); + return; + } let id = this.currentTrack.id; let like = true; if (this.liked.songs.includes(id)) like = false; diff --git a/src/components/TrackList.vue b/src/components/TrackList.vue index 33394e8..49302df 100644 --- a/src/components/TrackList.vue +++ b/src/components/TrackList.vue @@ -11,18 +11,10 @@
{{ $t("contextMenu.play") }}
{{ $t("contextMenu.playNext") }}
-
+
{{ $t("contextMenu.saveToMyLikedSongs") }}
-
+
{{ $t("contextMenu.removeFromMyLikedSongs") }}
@@ -99,9 +91,6 @@ export default { isRightClickedTrackLiked() { return this.liked.songs.includes(this.rightClickedTrack?.id); }, - accountLogin() { - return isAccountLoggedIn(); - }, }, methods: { ...mapMutations(["updateLikedSongs"]), @@ -152,6 +141,10 @@ export default { this.likeASong(this.rightClickedTrack.id); }, likeASong(id) { + if (!isAccountLoggedIn()) { + this.showToast("此操作需要登录网易云账号"); + return; + } let like = true; let likedSongs = this.liked.songs; if (likedSongs.includes(id)) like = false; diff --git a/src/components/TrackListItem.vue b/src/components/TrackListItem.vue index c086c16..1446532 100644 --- a/src/components/TrackListItem.vue +++ b/src/components/TrackListItem.vue @@ -62,7 +62,7 @@
-