шаблон для currentPlay.art, если отсутсвует
This commit is contained in:
parent
784399d84f
commit
6856f011cf
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
|
|
@ -2,7 +2,14 @@
|
||||||
<div class="player">
|
<div class="player">
|
||||||
<div class="player__cover">
|
<div class="player__cover">
|
||||||
<q-skeleton v-if="loaderPlay" height="100%" />
|
<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>
|
||||||
<div class="player__content">
|
<div class="player__content">
|
||||||
<div class="player__top">
|
<div class="player__top">
|
||||||
|
|
@ -238,16 +245,12 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleConnection(e) {
|
handleConnection(e) {
|
||||||
// console.log('getPlaying', e);
|
|
||||||
const jsonData = JSON.parse(e.data);
|
const jsonData = JSON.parse(e.data);
|
||||||
// console.log('jsonData', jsonData);
|
|
||||||
const data =
|
const data =
|
||||||
// Второй ответ
|
// Второй ответ
|
||||||
jsonData?.pub?.data ||
|
jsonData?.pub?.data ||
|
||||||
// Первый ответ
|
// Первый ответ
|
||||||
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
|
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
|
||||||
// console.log('getPlaying', data);
|
|
||||||
// console.log(data);
|
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (this.currentPlay.live) {
|
if (this.currentPlay.live) {
|
||||||
|
|
@ -255,12 +258,9 @@ export default {
|
||||||
const dataUrl = data.np.station.listen_url;
|
const dataUrl = data.np.station.listen_url;
|
||||||
// Объект с данными музыки
|
// Объект с данными музыки
|
||||||
const dataSong = data.np.now_playing.song;
|
const dataSong = data.np.now_playing.song;
|
||||||
// console.log(dataSong);
|
|
||||||
const playerUrl = this.player.target.src;
|
const playerUrl = this.player.target.src;
|
||||||
if (dataUrl !== playerUrl) {
|
if (dataUrl !== playerUrl) {
|
||||||
// console.log('data.np.station.listen_url', dataUrl);
|
|
||||||
this.$store.dispatch('changePlayer', dataUrl);
|
this.$store.dispatch('changePlayer', dataUrl);
|
||||||
// console.log(this.player);
|
|
||||||
this.actionCurrentPlay(dataSong);
|
this.actionCurrentPlay(dataSong);
|
||||||
}
|
}
|
||||||
if (dataSong.id !== this.currentPlay.id) {
|
if (dataSong.id !== this.currentPlay.id) {
|
||||||
|
|
@ -269,7 +269,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actionCurrentPlay(song) {
|
actionCurrentPlay(song) {
|
||||||
// console.log('actionCurrentPlay', data);
|
console.log('actionCurrentPlay', song);
|
||||||
const currentPlay = {
|
const currentPlay = {
|
||||||
...this.currentPlay, // Инфа про текущий трек
|
...this.currentPlay, // Инфа про текущий трек
|
||||||
...song,
|
...song,
|
||||||
|
|
@ -278,7 +278,6 @@ export default {
|
||||||
live: true,
|
live: true,
|
||||||
currentIndex: null,
|
currentIndex: null,
|
||||||
};
|
};
|
||||||
// console.log('params in getPlaying ', params);
|
|
||||||
// delete params.unique_id;
|
// delete params.unique_id;
|
||||||
this.$store.dispatch('setCurrentPlay', currentPlay);
|
this.$store.dispatch('setCurrentPlay', currentPlay);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export default route(function (/* { store, ssrContext } */) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Router.beforeEach((to, from, next) => {
|
Router.beforeEach((to, from, next) => {
|
||||||
console.log(process.env.SERVER);
|
// console.log(process.env.SERVER);
|
||||||
//уточнить зачем нужен process.env.SERVER
|
//уточнить зачем нужен process.env.SERVER
|
||||||
if (to.meta.isAuth && !process.env.SERVER) {
|
if (to.meta.isAuth && !process.env.SERVER) {
|
||||||
if (store.state.user) {
|
if (store.state.user) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue