открытие модального окна при попытке переключиться на плейлист - при уловии отсутствия авторизации и плейлиста

This commit is contained in:
Norbaev 2024-07-02 18:02:41 +05:00
parent f8cc500a23
commit 3d294096f8
3 changed files with 19 additions and 18 deletions

View File

@ -73,7 +73,7 @@ export default boot(async ({ app, router }) => {
}), }),
toggle: createInput(toggle, { toggle: createInput(toggle, {
props: ['placeholder', 'disabled', 'readonly'], props: ['placeholder', 'disabled', 'readonly'],
emits: ['toggle'], // emits: ['toggle', 'customEvent'],
}), }),
}, },
}; };

View File

@ -17,6 +17,7 @@
import { defineProps, ref, onUpdated, computed } from 'vue'; import { defineProps, ref, onUpdated, computed } from 'vue';
export default { export default {
name: 'toggle',
props: { props: {
context: { context: {
type: Object, type: Object,

View File

@ -46,14 +46,15 @@
</template> </template>
<div class="player__tools"> <div class="player__tools">
<q-skeleton v-if="loaderPlay" class="player__tools m--skeleton" /> <q-skeleton v-if="loaderPlay" class="player__tools m--skeleton" />
<FormKit <div v-else @click="toggleMyMusic">
v-else <FormKit
@click="toggleMyMusic" v-model="isUserMusic"
v-model="isUserMusic" type="toggle"
type="toggle" label="Включить мою музыку"
label="Включить мою музыку" :disabled="!user?.id || userSongList.length === 0"
:disabled="!user?.id || userSongList.length === 0" />
/> </div>
<q-skeleton v-if="loaderPlay" class="player__tools m--skeleton" /> <q-skeleton v-if="loaderPlay" class="player__tools m--skeleton" />
<div v-else class="player__volume"> <div v-else class="player__volume">
<span <span
@ -112,9 +113,9 @@ export default {
isPlayRadio: false, isPlayRadio: false,
connection: null, connection: null,
isUserMusic: !this.$store.state.currentPlay.live, isUserMusic: !this.$store.state.currentPlay.live,
bolTemp: true, // Заглушка для теста
songVolume: 0.5, songVolume: 0.5,
// Локальное значение для хранения громкости перед toggleVolume preToggleVol: null, // Локальное значение для хранения громкости перед toggleVolume
preToggleVol: null,
playerInfo: { playerInfo: {
progress: 0, progress: 0,
currentTime: 0, currentTime: 0,
@ -246,7 +247,7 @@ export default {
// Первый ответ // Первый ответ
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data; jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
// console.log('getPlaying', data); // console.log('getPlaying', data);
console.log(data); // console.log(data);
if (!data) return; if (!data) return;
if (this.currentPlay.live) { if (this.currentPlay.live) {
@ -254,7 +255,7 @@ 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); // 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); // console.log('data.np.station.listen_url', dataUrl);
@ -380,6 +381,10 @@ export default {
this.$store.dispatch('handlerPlayer', { volume: this.songVolume }); this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
} }
}, },
toggleMyMusic(e) {
if (this.user?.id) return;
this.$store.dispatch('setModal', { auth: true });
},
}, },
getAudio(id) { getAudio(id) {
app app
@ -442,10 +447,5 @@ export default {
if (!paddedSeconds) paddedSeconds = '00'; if (!paddedSeconds) paddedSeconds = '00';
return `${paddedMinutes}:${paddedSeconds}`; return `${paddedMinutes}:${paddedSeconds}`;
}, },
toggleMyMusic() {
console.log('toggleMyMusic');
if (this.user.id) return;
this.$store.dispatch('setModal', { auth: true });
},
}; };
</script> </script>