Merge branch 'master' of git.flexites.org:Students/ITRadio
This commit is contained in:
commit
1cb37882bf
|
|
@ -35,7 +35,7 @@
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="user?.id">
|
<div @click="handleAuthRequired">
|
||||||
<q-skeleton v-if="loaderPlay" class="player__favorites m--skeleton" />
|
<q-skeleton v-if="loaderPlay" class="player__favorites m--skeleton" />
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
|
|
@ -43,10 +43,10 @@
|
||||||
:class="[isFavorites && 'm--active']"
|
:class="[isFavorites && 'm--active']"
|
||||||
@click="handlerFavorites"
|
@click="handlerFavorites"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</div>
|
||||||
<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" />
|
||||||
<div v-else @click="toggleMyMusic">
|
<div v-else @click="handleAuthRequired">
|
||||||
<FormKit
|
<FormKit
|
||||||
v-model="isUserMusic"
|
v-model="isUserMusic"
|
||||||
type="toggle"
|
type="toggle"
|
||||||
|
|
@ -271,8 +271,7 @@ export default {
|
||||||
actionCurrentPlay(song) {
|
actionCurrentPlay(song) {
|
||||||
// console.log('actionCurrentPlay', data);
|
// console.log('actionCurrentPlay', data);
|
||||||
const currentPlay = {
|
const currentPlay = {
|
||||||
...this.currentPlay,
|
...this.currentPlay, // Инфа про текущий трек
|
||||||
// Инфа про текущий трек
|
|
||||||
...song,
|
...song,
|
||||||
// azura_id: song.id,
|
// azura_id: song.id,
|
||||||
isLoader: false,
|
isLoader: false,
|
||||||
|
|
@ -366,14 +365,14 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeVolume() {
|
changeVolume() {
|
||||||
console.log(this.songVolume);
|
// console.log(this.songVolume);
|
||||||
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
||||||
},
|
},
|
||||||
toggleVolume() {
|
toggleVolume() {
|
||||||
if (this.songVolume === 0) {
|
if (this.songVolume === 0) {
|
||||||
this.songVolume = this.preToggleVol;
|
this.songVolume = this.preToggleVol;
|
||||||
// console.log(this.songVolume);
|
// console.log(this.songVolume);
|
||||||
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
this.$store.dispatch('handlerPlayer', { volume: this.preToggleVol });
|
||||||
} else {
|
} else {
|
||||||
this.preToggleVol = this.songVolume;
|
this.preToggleVol = this.songVolume;
|
||||||
this.songVolume = 0.0;
|
this.songVolume = 0.0;
|
||||||
|
|
@ -381,7 +380,7 @@ export default {
|
||||||
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggleMyMusic(e) {
|
handleAuthRequired(e) {
|
||||||
if (this.user?.id) return;
|
if (this.user?.id) return;
|
||||||
this.$store.dispatch('setModal', { auth: true });
|
this.$store.dispatch('setModal', { auth: true });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,29 @@ export default route(function (/* { store, ssrContext } */) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Router.beforeEach((to, from, next) => {
|
Router.beforeEach((to, from, next) => {
|
||||||
if (
|
// console.log(to);
|
||||||
to.matched.some((record) => record.meta.requiresAuth) &&
|
// console.log(process.env.SERVER);
|
||||||
!process.env.SERVER
|
// if (
|
||||||
) {
|
// to.matched.some((record) => record.meta.requiresAuth) &&
|
||||||
if (store.state.user && store.state.user?.id) {
|
// !process.env.SERVER
|
||||||
|
// ) {
|
||||||
|
// if (store.state.user && store.state.user?.id) {
|
||||||
|
// next();
|
||||||
|
// } else {
|
||||||
|
// next({ name: 'home' });
|
||||||
|
// this.$store.dispatch('setShowAuthModal', true);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// next();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// console.log(to);
|
||||||
|
// console.log(from);
|
||||||
|
if (to.meta.isAuth) {
|
||||||
|
if (store.state.user) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
next({ name: 'home' });
|
next({ name: 'home' });
|
||||||
this.$store.dispatch('setShowAuthModal', true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ const routes = [
|
||||||
component: profile,
|
component: profile,
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Личный кабинет',
|
title: 'Личный кабинет',
|
||||||
isAuth: false,
|
isAuth: true,
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { urlPath as settings } from '@/settings';
|
||||||
import { REST, RESTError } from './rest';
|
import { REST, RESTError } from './rest';
|
||||||
|
|
||||||
// запросы на сервер Django
|
// запросы на сервер Django
|
||||||
|
// console.log(settings);
|
||||||
|
|
||||||
export default class extends REST {
|
export default class extends REST {
|
||||||
static get settings() {
|
static get settings() {
|
||||||
|
|
@ -56,7 +57,9 @@ export default class extends REST {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getCheckFavoriteSong(id) {
|
static getCheckFavoriteSong(id) {
|
||||||
return this._get(`radio/song/check_is_favorite/${id}`, {}, {})
|
// return this._get(`radio/song/check_is_favorite/${id}`, {}, {})
|
||||||
|
return this._get(`radio/song/${id}/check_is_favorite`, {}, {})
|
||||||
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
@ -74,7 +77,9 @@ export default class extends REST {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static getAudio(id) {
|
static getAudio(id) {
|
||||||
return this._get(`radio/song/get_audio/${id}`, {}, {}, false, true)
|
// return this._get(`radio/song/get_audio/${id}`, {}, {}, false, true)
|
||||||
|
return this._get(`radio/song/${id}/get_audio/`, {}, {}, false, true)
|
||||||
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
@ -82,8 +87,9 @@ export default class extends REST {
|
||||||
throw new RESTError(error, 'Ошибка при получениии песни');
|
throw new RESTError(error, 'Ошибка при получениии песни');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static createFavoriteForUser(params) {
|
static createFavoriteForUser(id) {
|
||||||
return this._post(`radio/song/add_favorite`, {}, params)
|
// return this._post(`radio/song/add_favorite`, {}, params)
|
||||||
|
return this._post(`radio/song/${id}/add_favorite`, {}, {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
@ -159,8 +165,9 @@ export default class extends REST {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static addSongToPlaylist(params) {
|
static addSongToPlaylist(id) {
|
||||||
return this._post(`radio/playlists/add_to_playlist`, {}, params)
|
// return this._post(`radio/playlists/add_to_playlist`, {}, params)
|
||||||
|
return this._post(`radio/playlists/${id}/add_to_playlist`, {}, {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
@ -168,8 +175,9 @@ export default class extends REST {
|
||||||
throw new RESTError(error, 'Ошибка при получении плейлистов');
|
throw new RESTError(error, 'Ошибка при получении плейлистов');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static removeSongToPlaylist(params) {
|
static removeSongToPlaylist(id) {
|
||||||
return this._post(`radio/playlists/delete_song_with_playlist`, {}, params)
|
// return this._post(`radio/playlists/delete_song_with_playlist`, {}, params)
|
||||||
|
return this._post(`radio/playlists/${id}/delete_song_with_playlist`, {}, {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
@ -177,8 +185,9 @@ export default class extends REST {
|
||||||
throw new RESTError(error, 'Ошибка при удаления треков из плейлиста');
|
throw new RESTError(error, 'Ошибка при удаления треков из плейлиста');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static updatePlaylist(params) {
|
static updatePlaylist(id) {
|
||||||
return this._post(`radio/playlists/update_playlist`, {}, params)
|
// return this._post(`radio/playlists/update_playlist`, {}, params)
|
||||||
|
return this._post(`radio/playlists/${id}/update_playlist`, {}, {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue