mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: show like buttons to visitors
This commit is contained in:
parent
fe1ae83b73
commit
f68ae5c078
6 changed files with 34 additions and 42 deletions
|
|
@ -37,7 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- 账号登录才会显示 like 图标 -->
|
||||
<div class="like-button" v-show="accountLogin">
|
||||
<div class="like-button">
|
||||
<button-icon
|
||||
@click.native="likeCurrentSong"
|
||||
:title="$t('player.like')"
|
||||
|
|
@ -189,9 +189,6 @@ export default {
|
|||
let max = ~~(this.currentTrack.dt / 1000);
|
||||
return max > 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue