edit: audioData est mtn const reactive() et playlist editor fonctionne coté client

This commit is contained in:
2026-07-07 01:23:27 +02:00
parent 874226a140
commit 7c25390ead
4 changed files with 60 additions and 40 deletions
+2
View File
@@ -15,4 +15,6 @@ POUR LE STATUT D'OUVERTURE DU LIEU IL FAUT :
NB: les infos indiquées sont surtout là pour prévisualiser, mais ne sont pour l'instant pas plus que des envies personelles par rapport au lieu (rien d'officiel pour l'instant, juste des idées) NB: les infos indiquées sont surtout là pour prévisualiser, mais ne sont pour l'instant pas plus que des envies personelles par rapport au lieu (rien d'officiel pour l'instant, juste des idées)
PS: BESOIN DE QQN POUR FAIRE LE BACKEND SVP <3 <3 <3
333 333
+25 -10
View File
@@ -17,9 +17,10 @@
<p>&emsp; Artiste &emsp;&emsp;&ensp; &rarr;</p> <p>&emsp; Artiste &emsp;&emsp;&ensp; &rarr;</p>
<input type="text" name="songArtist" v-model="artist"> <input type="text" name="songArtist" v-model="artist">
</div> </div>
<p v-show="editingSong" id="note">Note : Laisser vide pour conserver le fichier </p>
<div class="inputDiv" id="src"> <div class="inputDiv" id="src">
<p>&emsp; Fichier MP3 &ensp; &rarr;</p> <p>&emsp; Fichier MP3 &ensp; &rarr;</p>
<input type="file" name="songFile" ref="audioFile" @change="loadFile"> <input type="file" name="songFile" ref="audioFile" @change="modifyFile">
</div> </div>
<button type="button" name="saveChanges" class="textBtnStyle" @click="savePlaylist" :class="{alert: playlistAlertActive}">SAUVEGARDER !</button> <button type="button" name="saveChanges" class="textBtnStyle" @click="savePlaylist" :class="{alert: playlistAlertActive}">SAUVEGARDER !</button>
</div> </div>
@@ -108,6 +109,15 @@
color: var(--back-color); color: var(--back-color);
background-color: var(--main-color); background-color: var(--main-color);
} }
#note{
width: 66%;
font-family: 'velvelyne';
font-weight: normal;
font-size: 13.12px;
color: var(--main-color);
margin: 0;
text-align: right;
}
.inputDiv{ .inputDiv{
display: flex; display: flex;
@@ -251,13 +261,12 @@
src: null src: null
}, },
editingSong: null, editingSong: null,
fileInput: null selectedInput: null
} }
}, },
computed: { computed: {
displayedPlaylists(){ displayedPlaylists(){
let list = loadAudioData() return loadAudioData
return list
}, },
playlistPannel(){ playlistPannel(){
return pannelStatusList.playlist; return pannelStatusList.playlist;
@@ -286,7 +295,6 @@
backToDefaultPlaylist(){ backToDefaultPlaylist(){
this.track = this.playlistDefault.track; this.track = this.playlistDefault.track;
this.artist = this.playlistDefault.artist; this.artist = this.playlistDefault.artist;
this.src = this.playlistDefault.src;
this.editingSong = null; this.editingSong = null;
this.newSongText = 'Nouveau Son'; this.newSongText = 'Nouveau Son';
}, },
@@ -296,16 +304,16 @@
artist: this.artist, artist: this.artist,
src: this.src src: this.src
} }
console.log('created or modified entry :', entry)
return entry return entry
}, },
savePlaylist(){ savePlaylist(){
let entry = this.createListEntry(); let entry = this.createListEntry();
if(this.editingSong){ if(this.editingSong){
Object.assign(this.editingSong, { Object.assign(this.editingSong, {
title: this.title, track: this.track,
href: this.href, artist: this.artist,
desc: this.desc src: this.src
}) })
} else { } else {
this.displayedPlaylists.push(entry); this.displayedPlaylists.push(entry);
@@ -324,6 +332,7 @@
this.track = obj.track; this.track = obj.track;
this.artist = obj.artist; this.artist = obj.artist;
this.src = obj.src; this.src = obj.src;
this.newSongText = 'Éditer les infos' this.newSongText = 'Éditer les infos'
this.toggleNewPlaylist(); this.toggleNewPlaylist();
}, },
@@ -336,10 +345,16 @@
this.eventAlertActive = false; this.eventAlertActive = false;
this.submitPlaylistText = 'SAUVEGARDER'; this.submitPlaylistText = 'SAUVEGARDER';
}, 1610) }, 1610)
},
modifyFile(){
if (this.selectedInput.files[0]){
this.src = this.selectedInput.files[0];
}
} }
}, },
mounted(){ mounted(){
this.fileInput = this.$refs.audioFile; this.selectedInput = this.$refs.audioFile;
console.log(this.selectedInput)
watch( () => this.playlistPannel, () => { watch( () => this.playlistPannel, () => {
if(!this.playlistPannel){ if(!this.playlistPannel){
this.newSong = false; this.newSong = false;
+11 -8
View File
@@ -5,7 +5,6 @@
import PauseIcon from '../assets/icons/pause.svg' import PauseIcon from '../assets/icons/pause.svg'
import NextIcon from '../assets/icons/next.svg' import NextIcon from '../assets/icons/next.svg'
import PrevIcon from '../assets/icons/prev.svg' import PrevIcon from '../assets/icons/prev.svg'
import { loadAudioData } from '@/data/audioData.js'
</script> </script>
<template> <template>
@@ -24,13 +23,13 @@
<marquee direction="left" behavior="scroll" scrollamount="7" width="100%">{{selectedSong.track}} {{selectedSong.artist}}</marquee> <marquee direction="left" behavior="scroll" scrollamount="7" width="100%">{{selectedSong.track}} {{selectedSong.artist}}</marquee>
</div> </div>
<div id="controls"> <div id="controls">
<button type="button" class="iconBtnStyle" @click="prevTrack" data-tooltip="précédente"> <button type="button" class="iconBtnStyle" @mousedown.stop @touchstart.stop @click="prevTrack" data-tooltip="précédente">
<PrevIcon name="prev" class="icon"/> <PrevIcon name="prev" class="icon"/>
</button> </button>
<button type="button" class="iconBtnStyle" @click="toggleAudio" data-tooltip="lancer"> <button type="button" class="iconBtnStyle" @mousedown.stop @touchstart.stop @click="toggleAudio" data-tooltip="lancer">
<component :is="isPlaying? PauseIcon : PlayIcon" class="icon"/> <component :is="isPlaying? PauseIcon : PlayIcon" class="icon"/>
</button> </button>
<button type="button" class="iconBtnStyle" @click="nextTrack" data-tooltip="suivante"> <button type="button" class="iconBtnStyle" @mousedown.stop @touchstart.stop @click="nextTrack" data-tooltip="suivante">
<NextIcon name="next" class="icon"/> <NextIcon name="next" class="icon"/>
</button> </button>
</div> </div>
@@ -119,6 +118,8 @@
</style> </style>
<script> <script>
import { loadAudioData } from '../data/audioData.js'
import Moveable from 'vue3-moveable'; import Moveable from 'vue3-moveable';
export default { export default {
@@ -130,7 +131,6 @@
return{ return{
target: null, target: null,
audioTarget: null, audioTarget: null,
audioData: [],
selectedSong:{ selectedSong:{
track: "", track: "",
artist: "", artist: "",
@@ -142,6 +142,11 @@
isPlaying: false isPlaying: false
} }
}, },
computed: {
audioData(){
return loadAudioData
}
},
emits: ['close','focus'], emits: ['close','focus'],
methods: { methods: {
onDrag({ target, transform }) { onDrag({ target, transform }) {
@@ -186,10 +191,8 @@
}, },
async mounted(){ async mounted(){
this.target = this.$refs.playerPannel; this.target = this.$refs.playerPannel;
this.audioData = await loadAudioData();
this.audioTarget = this.$refs.selectedAudio; this.audioTarget = this.$refs.selectedAudio;
//console.log('AUDIO/', this.audioData); console.log('AUDIO/', this.audioData);
this.loadAudio(); this.loadAudio();
console.log("Player pannel is loaded!"); console.log("Player pannel is loaded!");
+5 -5
View File
@@ -1,9 +1,11 @@
import { reactive } from 'vue'
import audio01 from './juste-tek.mp3' import audio01 from './juste-tek.mp3'
import audio02 from './sinking-into-.mp3' import audio02 from './sinking-into-.mp3'
import audio03 from './technoloooogia.mp3' import audio03 from './technoloooogia.mp3'
export async function loadAudioData() { export const loadAudioData = reactive (
let audioFiles = [ [
{ {
track: 'the sink', track: 'the sink',
artist: '333', artist: '333',
@@ -20,6 +22,4 @@ export async function loadAudioData() {
src: audio03 src: audio03
} }
] ]
//console.log(audioFiles); )
return audioFiles
}