|
|
@ -17,28 +17,35 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="controls">
|
|
|
|
<div class="controls">
|
|
|
|
<div class="playing">
|
|
|
|
<div class="playing">
|
|
|
|
<router-link :to="`/album/${player.currentTrack.album.id}`"
|
|
|
|
<router-link :to="`/album/${currentTrack.al.id}`"
|
|
|
|
><img :src="player.currentTrack.album.picUrl | resizeImage" />
|
|
|
|
><img :src="currentTrack.al.picUrl | resizeImage" />
|
|
|
|
</router-link>
|
|
|
|
</router-link>
|
|
|
|
<div class="track-info">
|
|
|
|
<div class="track-info">
|
|
|
|
<div class="name">
|
|
|
|
<div class="name">
|
|
|
|
<router-link
|
|
|
|
<router-link
|
|
|
|
:to="'/' + player.listInfo.type + '/' + player.listInfo.id"
|
|
|
|
:to="'/' + player.listInfo.type + '/' + player.listInfo.id"
|
|
|
|
>{{ player.currentTrack.name }}</router-link
|
|
|
|
>{{ currentTrack.name }}</router-link
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="artist">
|
|
|
|
<div class="artist">
|
|
|
|
<span
|
|
|
|
<span v-for="(ar, index) in currentTrack.ar" :key="ar.id">
|
|
|
|
v-for="(ar, index) in player.currentTrack.artists"
|
|
|
|
|
|
|
|
:key="ar.id"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<router-link :to="`/artist/${ar.id}`">{{ ar.name }}</router-link>
|
|
|
|
<router-link :to="`/artist/${ar.id}`">{{ ar.name }}</router-link>
|
|
|
|
<span v-if="index !== player.currentTrack.artists.length - 1"
|
|
|
|
<span v-if="index !== currentTrack.ar.length - 1">, </span>
|
|
|
|
>,
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="like-button" v-show="isLoggedIn">
|
|
|
|
|
|
|
|
<button-icon @click.native="likeCurrentSong">
|
|
|
|
|
|
|
|
<svg-icon
|
|
|
|
|
|
|
|
icon-class="heart"
|
|
|
|
|
|
|
|
v-show="!liked.songs.includes(currentTrack.id)"
|
|
|
|
|
|
|
|
></svg-icon>
|
|
|
|
|
|
|
|
<svg-icon
|
|
|
|
|
|
|
|
icon-class="heart-solid"
|
|
|
|
|
|
|
|
v-show="liked.songs.includes(currentTrack.id)"
|
|
|
|
|
|
|
|
></svg-icon>
|
|
|
|
|
|
|
|
</button-icon>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="middle-control-buttons">
|
|
|
|
<div class="middle-control-buttons">
|
|
|
|
<button-icon @click.native="previous" title="Previous Song"
|
|
|
|
<button-icon @click.native="previous" title="Previous Song"
|
|
|
@ -106,6 +113,9 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import { updateMediaSessionMetaData } from "@/utils/mediaSession";
|
|
|
|
import { updateMediaSessionMetaData } from "@/utils/mediaSession";
|
|
|
|
import { mapState, mapMutations, mapActions } from "vuex";
|
|
|
|
import { mapState, mapMutations, mapActions } from "vuex";
|
|
|
|
|
|
|
|
import { isLoggedIn } from "@/utils/auth";
|
|
|
|
|
|
|
|
import { userLikedSongsIDs } from "@/api/user";
|
|
|
|
|
|
|
|
import { likeATrack } from "@/api/track";
|
|
|
|
import "@/assets/css/slider.css";
|
|
|
|
import "@/assets/css/slider.css";
|
|
|
|
|
|
|
|
|
|
|
|
import ButtonIcon from "@/components/ButtonIcon.vue";
|
|
|
|
import ButtonIcon from "@/components/ButtonIcon.vue";
|
|
|
@ -128,9 +138,17 @@ export default {
|
|
|
|
setInterval(() => {
|
|
|
|
setInterval(() => {
|
|
|
|
this.progress = ~~this.howler.seek();
|
|
|
|
this.progress = ~~this.howler.seek();
|
|
|
|
}, 1000);
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
if (this.isLoggedIn) {
|
|
|
|
|
|
|
|
userLikedSongsIDs(this.settings.user.userId).then((data) => {
|
|
|
|
|
|
|
|
this.updateLikedSongs(data.ids);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
...mapState(["player", "howler", "Howler"]),
|
|
|
|
...mapState(["player", "howler", "Howler", "settings", "liked"]),
|
|
|
|
|
|
|
|
currentTrack() {
|
|
|
|
|
|
|
|
return this.player.currentTrack;
|
|
|
|
|
|
|
|
},
|
|
|
|
volume: {
|
|
|
|
volume: {
|
|
|
|
get() {
|
|
|
|
get() {
|
|
|
|
return this.player.volume;
|
|
|
|
return this.player.volume;
|
|
|
@ -147,9 +165,12 @@ export default {
|
|
|
|
return this.howler.playing();
|
|
|
|
return this.howler.playing();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
progressMax() {
|
|
|
|
progressMax() {
|
|
|
|
let max = ~~(this.player.currentTrack.time / 1000);
|
|
|
|
let max = ~~(this.currentTrack.dt / 1000);
|
|
|
|
return max > 1 ? max - 1 : max;
|
|
|
|
return max > 1 ? max - 1 : max;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
isLoggedIn() {
|
|
|
|
|
|
|
|
return isLoggedIn();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
...mapMutations([
|
|
|
|
...mapMutations([
|
|
|
@ -158,6 +179,7 @@ export default {
|
|
|
|
"shuffleTheList",
|
|
|
|
"shuffleTheList",
|
|
|
|
"updatePlayerState",
|
|
|
|
"updatePlayerState",
|
|
|
|
"updateRepeatStatus",
|
|
|
|
"updateRepeatStatus",
|
|
|
|
|
|
|
|
"updateLikedSongs",
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
...mapActions([
|
|
|
|
...mapActions([
|
|
|
|
"nextTrack",
|
|
|
|
"nextTrack",
|
|
|
@ -170,22 +192,22 @@ export default {
|
|
|
|
this.howler.pause();
|
|
|
|
this.howler.pause();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (this.howler.state() === "unloaded") {
|
|
|
|
if (this.howler.state() === "unloaded") {
|
|
|
|
this.playTrackOnListByID(this.player.currentTrack.id);
|
|
|
|
this.playTrackOnListByID(this.currentTrack.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.howler.play();
|
|
|
|
this.howler.play();
|
|
|
|
if (this.howler._onend.length === 0) {
|
|
|
|
if (this.howler._onend.length === 0) {
|
|
|
|
this.addNextTrackEvent();
|
|
|
|
this.addNextTrackEvent();
|
|
|
|
updateMediaSessionMetaData(this.player.currentTrack);
|
|
|
|
updateMediaSessionMetaData(this.currentTrack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
next() {
|
|
|
|
next() {
|
|
|
|
this.nextTrack(true);
|
|
|
|
|
|
|
|
this.progress = 0;
|
|
|
|
this.progress = 0;
|
|
|
|
|
|
|
|
this.nextTrack(true);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
previous() {
|
|
|
|
previous() {
|
|
|
|
this.previousTrack();
|
|
|
|
|
|
|
|
this.progress = 0;
|
|
|
|
this.progress = 0;
|
|
|
|
|
|
|
|
this.previousTrack();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
shuffle() {
|
|
|
|
shuffle() {
|
|
|
|
if (this.player.shuffle === true) {
|
|
|
|
if (this.player.shuffle === true) {
|
|
|
@ -228,6 +250,20 @@ export default {
|
|
|
|
let sec = (~~(value % 60)).toString().padStart(2, "0");
|
|
|
|
let sec = (~~(value % 60)).toString().padStart(2, "0");
|
|
|
|
return `${min}:${sec}`;
|
|
|
|
return `${min}:${sec}`;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
likeCurrentSong() {
|
|
|
|
|
|
|
|
let id = this.currentTrack.id;
|
|
|
|
|
|
|
|
let like = true;
|
|
|
|
|
|
|
|
if (this.liked.songs.includes(id)) like = false;
|
|
|
|
|
|
|
|
likeATrack({ id, like }).then(() => {
|
|
|
|
|
|
|
|
if (like === false) {
|
|
|
|
|
|
|
|
this.updateLikedSongs(this.liked.songs.filter((d) => d !== id));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
let newLikeSongs = this.liked.songs;
|
|
|
|
|
|
|
|
newLikeSongs.push(id);
|
|
|
|
|
|
|
|
this.updateLikedSongs(newLikeSongs);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
@ -289,6 +325,7 @@ export default {
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
&:hover {
|
|
|
|
&:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -300,6 +337,7 @@ export default {
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
overflow: hidden;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
a {
|
|
|
|
a {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
|
&:hover {
|
|
|
|
&:hover {
|
|
|
@ -319,11 +357,11 @@ export default {
|
|
|
|
margin: 0 8px;
|
|
|
|
margin: 0 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.play {
|
|
|
|
.play {
|
|
|
|
height: 48px;
|
|
|
|
height: 42px;
|
|
|
|
width: 48px;
|
|
|
|
width: 42px;
|
|
|
|
.svg-icon {
|
|
|
|
.svg-icon {
|
|
|
|
width: 28px;
|
|
|
|
width: 24px;
|
|
|
|
height: 28px;
|
|
|
|
height: 24px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -351,4 +389,8 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.like-button {
|
|
|
|
|
|
|
|
margin-left: 16px;
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|