шаблон для currentPlay.art, если отсутсвует

This commit is contained in:
Norbaev 2024-07-12 16:11:48 +05:00
parent 784399d84f
commit 6856f011cf
3 changed files with 10 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -2,7 +2,14 @@
<div class="player">
<div class="player__cover">
<q-skeleton v-if="loaderPlay" height="100%" />
<img v-else :src="currentPlay.art" alt="player" />
<template v-else>
<img v-if="currentPlay.art" :src="currentPlay.art" alt="player" />
<img
v-else
:src="require('@/assets/img/mock/template-artist.png')"
alt="player"
/>
</template>
</div>
<div class="player__content">
<div class="player__top">
@ -238,16 +245,12 @@ export default {
});
},
handleConnection(e) {
// console.log('getPlaying', e);
const jsonData = JSON.parse(e.data);
// console.log('jsonData', jsonData);
const data =
// Второй ответ
jsonData?.pub?.data ||
// Первый ответ
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
// console.log('getPlaying', data);
// console.log(data);
if (!data) return;
if (this.currentPlay.live) {
@ -255,12 +258,9 @@ export default {
const dataUrl = data.np.station.listen_url;
// Объект с данными музыки
const dataSong = data.np.now_playing.song;
// console.log(dataSong);
const playerUrl = this.player.target.src;
if (dataUrl !== playerUrl) {
// console.log('data.np.station.listen_url', dataUrl);
this.$store.dispatch('changePlayer', dataUrl);
// console.log(this.player);
this.actionCurrentPlay(dataSong);
}
if (dataSong.id !== this.currentPlay.id) {
@ -269,7 +269,7 @@ export default {
}
},
actionCurrentPlay(song) {
// console.log('actionCurrentPlay', data);
console.log('actionCurrentPlay', song);
const currentPlay = {
...this.currentPlay, // Инфа про текущий трек
...song,
@ -278,7 +278,6 @@ export default {
live: true,
currentIndex: null,
};
// console.log('params in getPlaying ', params);
// delete params.unique_id;
this.$store.dispatch('setCurrentPlay', currentPlay);
},

View File

@ -49,7 +49,7 @@ export default route(function (/* { store, ssrContext } */) {
});
Router.beforeEach((to, from, next) => {
console.log(process.env.SERVER);
// console.log(process.env.SERVER);
//уточнить зачем нужен process.env.SERVER
if (to.meta.isAuth && !process.env.SERVER) {
if (store.state.user) {