fix: 修复部分按钮失效的问题 (#1380)

master
memorydream 3 years ago committed by GitHub
parent 596204dc58
commit 7dad7d810a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -71,19 +71,19 @@
<button-icon <button-icon
v-show="!player.isPersonalFM" v-show="!player.isPersonalFM"
:title="$t('player.previous')" :title="$t('player.previous')"
@click.native="player.playPrevTrack" @click.native="playPrevTrack"
><svg-icon icon-class="previous" ><svg-icon icon-class="previous"
/></button-icon> /></button-icon>
<button-icon <button-icon
v-show="player.isPersonalFM" v-show="player.isPersonalFM"
title="不喜欢" title="不喜欢"
@click.native="player.moveToFMTrash" @click.native="moveToFMTrash"
><svg-icon icon-class="thumbs-down" ><svg-icon icon-class="thumbs-down"
/></button-icon> /></button-icon>
<button-icon <button-icon
class="play" class="play"
:title="$t(player.playing ? 'player.pause' : 'player.play')" :title="$t(player.playing ? 'player.pause' : 'player.play')"
@click.native="player.playOrPause" @click.native="playOrPause"
> >
<svg-icon :icon-class="player.playing ? 'pause' : 'play'" <svg-icon :icon-class="player.playing ? 'pause' : 'play'"
/></button-icon> /></button-icon>
@ -115,7 +115,7 @@
? $t('player.repeatTrack') ? $t('player.repeatTrack')
: $t('player.repeat') : $t('player.repeat')
" "
@click.native="player.switchRepeatMode" @click.native="switchRepeatMode"
> >
<svg-icon <svg-icon
v-show="player.repeatMode !== 'one'" v-show="player.repeatMode !== 'one'"
@ -129,18 +129,18 @@
<button-icon <button-icon
:class="{ active: player.shuffle, disabled: player.isPersonalFM }" :class="{ active: player.shuffle, disabled: player.isPersonalFM }"
:title="$t('player.shuffle')" :title="$t('player.shuffle')"
@click.native="player.switchShuffle" @click.native="switchShuffle"
><svg-icon icon-class="shuffle" ><svg-icon icon-class="shuffle"
/></button-icon> /></button-icon>
<button-icon <button-icon
v-if="settings.enableReversedMode" v-if="settings.enableReversedMode"
:class="{ active: player.reversed, disabled: player.isPersonalFM }" :class="{ active: player.reversed, disabled: player.isPersonalFM }"
:title="$t('player.reversed')" :title="$t('player.reversed')"
@click.native="player.switchReversed" @click.native="switchReversed"
><svg-icon icon-class="sort-up" ><svg-icon icon-class="sort-up"
/></button-icon> /></button-icon>
<div class="volume-control"> <div class="volume-control">
<button-icon :title="$t('player.mute')" @click.native="player.mute"> <button-icon :title="$t('player.mute')" @click.native="mute">
<svg-icon v-show="volume > 0.5" icon-class="volume" /> <svg-icon v-show="volume > 0.5" icon-class="volume" />
<svg-icon v-show="volume === 0" icon-class="volume-mute" /> <svg-icon v-show="volume === 0" icon-class="volume-mute" />
<svg-icon <svg-icon
@ -214,6 +214,12 @@ export default {
methods: { methods: {
...mapMutations(['toggleLyrics']), ...mapMutations(['toggleLyrics']),
...mapActions(['showToast', 'likeATrack']), ...mapActions(['showToast', 'likeATrack']),
playPrevTrack() {
this.player.playPrevTrack();
},
playOrPause() {
this.player.playOrPause();
},
playNextTrack() { playNextTrack() {
if (this.player.isPersonalFM) { if (this.player.isPersonalFM) {
this.player.playNextFMTrack(); this.player.playNextFMTrack();
@ -246,6 +252,21 @@ export default {
goToArtist(id) { goToArtist(id) {
this.$router.push({ path: '/artist/' + id }); this.$router.push({ path: '/artist/' + id });
}, },
moveToFMTrash() {
this.player.moveToFMTrash();
},
switchRepeatMode() {
this.player.switchRepeatMode();
},
switchShuffle() {
this.player.switchShuffle();
},
switchReversed() {
this.player.switchReversed();
},
mute() {
this.player.mute();
},
}, },
}; };
</script> </script>

@ -120,7 +120,7 @@
: $t('player.repeat') : $t('player.repeat')
" "
:class="{ active: player.repeatMode !== 'off' }" :class="{ active: player.repeatMode !== 'off' }"
@click.native="player.switchRepeatMode" @click.native="switchRepeatMode"
> >
<svg-icon <svg-icon
v-show="player.repeatMode !== 'one'" v-show="player.repeatMode !== 'one'"
@ -135,21 +135,21 @@
<button-icon <button-icon
v-show="!player.isPersonalFM" v-show="!player.isPersonalFM"
:title="$t('player.previous')" :title="$t('player.previous')"
@click.native="player.playPrevTrack" @click.native="playPrevTrack"
> >
<svg-icon icon-class="previous" /> <svg-icon icon-class="previous" />
</button-icon> </button-icon>
<button-icon <button-icon
v-show="player.isPersonalFM" v-show="player.isPersonalFM"
title="不喜欢" title="不喜欢"
@click.native="player.moveToFMTrash" @click.native="moveToFMTrash"
> >
<svg-icon icon-class="thumbs-down" /> <svg-icon icon-class="thumbs-down" />
</button-icon> </button-icon>
<button-icon <button-icon
id="play" id="play"
:title="$t(player.playing ? 'player.pause' : 'player.play')" :title="$t(player.playing ? 'player.pause' : 'player.play')"
@click.native="player.playOrPause" @click.native="playOrPause"
> >
<svg-icon :icon-class="player.playing ? 'pause' : 'play'" /> <svg-icon :icon-class="player.playing ? 'pause' : 'play'" />
</button-icon> </button-icon>
@ -164,7 +164,7 @@
v-show="!player.isPersonalFM" v-show="!player.isPersonalFM"
:title="$t('player.shuffle')" :title="$t('player.shuffle')"
:class="{ active: player.shuffle }" :class="{ active: player.shuffle }"
@click.native="player.switchShuffle" @click.native="switchShuffle"
> >
<svg-icon icon-class="shuffle" /> <svg-icon icon-class="shuffle" />
</button-icon> </button-icon>
@ -332,6 +332,12 @@ export default {
methods: { methods: {
...mapMutations(['toggleLyrics']), ...mapMutations(['toggleLyrics']),
...mapActions(['likeATrack']), ...mapActions(['likeATrack']),
playPrevTrack() {
this.player.playPrevTrack();
},
playOrPause() {
this.player.playOrPause();
},
playNextTrack() { playNextTrack() {
if (this.player.isPersonalFM) { if (this.player.isPersonalFM) {
this.player.playNextFMTrack(); this.player.playNextFMTrack();
@ -417,6 +423,12 @@ export default {
moveToFMTrash() { moveToFMTrash() {
this.player.moveToFMTrash(); this.player.moveToFMTrash();
}, },
switchRepeatMode() {
this.player.switchRepeatMode();
},
switchShuffle() {
this.player.switchShuffle();
},
getCoverColor() { getCoverColor() {
if (this.settings.lyricsBackground !== true) return; if (this.settings.lyricsBackground !== true) return;
const cover = this.currentTrack.al?.picUrl + '?param=1024y1024'; const cover = this.currentTrack.al?.picUrl + '?param=1024y1024';

Loading…
Cancel
Save