Spaces:
Sleeping
Sleeping
Update templates/philosophie.html
Browse files- templates/philosophie.html +66 -8
templates/philosophie.html
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
margin: 0; padding: 0; color: var(--text-primary);
|
| 37 |
line-height: 1.6; font-weight: 400;
|
| 38 |
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
| 39 |
-
min-height:
|
| 40 |
}
|
| 41 |
.container { max-width: 900px; margin: 0 auto; padding: 3rem 2rem; }
|
| 42 |
h1 { font-size: 3.5rem; font-weight: 700; text-align: center; background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin: 0 0 1rem 0; letter-spacing: -0.02em; }
|
|
@@ -76,6 +76,30 @@
|
|
| 76 |
.dissertation-paper .transition { margin-top: 2em; margin-bottom: 2em; font-style: italic; color: #4a6a9c; }
|
| 77 |
.dissertation-paper, .dissertation-paper * { box-sizing: border-box; }
|
| 78 |
.avoid-page-break { page-break-inside: avoid; break-inside: avoid; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
@media (max-width: 768px) { .container { padding: 2rem 1rem; } h1 { font-size: 2.5rem; } .form-container { padding: 1.5rem; } .dissertation-paper { padding-left: 2em; padding-right: 1rem; font-size: 18px; } }
|
| 80 |
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
|
| 81 |
.container > * { animation: fadeInUp 0.6s ease-out; }
|
|
@@ -118,6 +142,12 @@
|
|
| 118 |
<div v-if="dissertationType === 'type3'" class="form-group">
|
| 119 |
<label for="text-image">Téléchargez une image du texte à commenter</label>
|
| 120 |
<input type="file" @change="handleFileUpload" id="text-image" accept="image/*" class="file-input">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
</div>
|
| 122 |
|
| 123 |
<button type="submit" class="primary-button" :disabled="isLoading">
|
|
@@ -164,7 +194,8 @@
|
|
| 164 |
dissertationType: 'type1',
|
| 165 |
courses: [],
|
| 166 |
selectedCourse: '',
|
| 167 |
-
uploadedFile: null,
|
|
|
|
| 168 |
isLoading: false,
|
| 169 |
isDownloading: false,
|
| 170 |
errorMessage: null,
|
|
@@ -172,7 +203,6 @@
|
|
| 172 |
}
|
| 173 |
},
|
| 174 |
computed: {
|
| 175 |
-
// Propriété calculée pour afficher le bon libellé en haut
|
| 176 |
dissertationTypeLabel() {
|
| 177 |
const labels = {
|
| 178 |
'type1': 'Type 1',
|
|
@@ -182,14 +212,38 @@
|
|
| 182 |
return labels[this.dissertationType] || 'Inconnu';
|
| 183 |
}
|
| 184 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
mounted() {
|
| 186 |
this.fetchCourses();
|
| 187 |
},
|
| 188 |
methods: {
|
| 189 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
handleFileUpload(event) {
|
| 191 |
-
this.
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
},
|
| 194 |
async fetchCourses() {
|
| 195 |
try {
|
|
@@ -200,7 +254,6 @@
|
|
| 200 |
this.errorMessage = error.message;
|
| 201 |
}
|
| 202 |
},
|
| 203 |
-
// MÉTHODE MISE À JOUR pour gérer les deux types de soumission
|
| 204 |
async generateDissertation() {
|
| 205 |
this.isLoading = true;
|
| 206 |
this.errorMessage = null;
|
|
@@ -249,9 +302,14 @@
|
|
| 249 |
this.errorMessage = error.message;
|
| 250 |
} finally {
|
| 251 |
this.isLoading = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
}
|
| 253 |
},
|
| 254 |
-
// La méthode de génération PDF reste identique car elle travaille sur l'objet 'dissertation' final
|
| 255 |
async generatePDF() {
|
| 256 |
if (!this.dissertation) return;
|
| 257 |
this.isDownloading = true;
|
|
|
|
| 36 |
margin: 0; padding: 0; color: var(--text-primary);
|
| 37 |
line-height: 1.6; font-weight: 400;
|
| 38 |
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
| 39 |
+
min-height: 10vh;
|
| 40 |
}
|
| 41 |
.container { max-width: 900px; margin: 0 auto; padding: 3rem 2rem; }
|
| 42 |
h1 { font-size: 3.5rem; font-weight: 700; text-align: center; background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin: 0 0 1rem 0; letter-spacing: -0.02em; }
|
|
|
|
| 76 |
.dissertation-paper .transition { margin-top: 2em; margin-bottom: 2em; font-style: italic; color: #4a6a9c; }
|
| 77 |
.dissertation-paper, .dissertation-paper * { box-sizing: border-box; }
|
| 78 |
.avoid-page-break { page-break-inside: avoid; break-inside: avoid; }
|
| 79 |
+
|
| 80 |
+
/* NOUVEAU STYLE POUR LA PRÉVISUALISATION */
|
| 81 |
+
.image-preview-container {
|
| 82 |
+
margin-top: 1.5rem;
|
| 83 |
+
padding: 1rem;
|
| 84 |
+
border: 1px dashed var(--primary-color);
|
| 85 |
+
border-radius: 12px;
|
| 86 |
+
background-color: var(--surface);
|
| 87 |
+
}
|
| 88 |
+
.image-preview-container label {
|
| 89 |
+
font-size: 0.9rem;
|
| 90 |
+
color: var(--primary-color);
|
| 91 |
+
margin-bottom: 0.5rem;
|
| 92 |
+
font-weight: 500;
|
| 93 |
+
}
|
| 94 |
+
.uploaded-image-preview {
|
| 95 |
+
max-width: 100%;
|
| 96 |
+
height: auto;
|
| 97 |
+
display: block;
|
| 98 |
+
border-radius: 8px;
|
| 99 |
+
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
|
| 100 |
+
}
|
| 101 |
+
/* FIN NOUVEAU STYLE */
|
| 102 |
+
|
| 103 |
@media (max-width: 768px) { .container { padding: 2rem 1rem; } h1 { font-size: 2.5rem; } .form-container { padding: 1.5rem; } .dissertation-paper { padding-left: 2em; padding-right: 1rem; font-size: 18px; } }
|
| 104 |
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
|
| 105 |
.container > * { animation: fadeInUp 0.6s ease-out; }
|
|
|
|
| 142 |
<div v-if="dissertationType === 'type3'" class="form-group">
|
| 143 |
<label for="text-image">Téléchargez une image du texte à commenter</label>
|
| 144 |
<input type="file" @change="handleFileUpload" id="text-image" accept="image/*" class="file-input">
|
| 145 |
+
|
| 146 |
+
<!-- PRÉVISUALISATION DE L'IMAGE AJOUTÉE ICI -->
|
| 147 |
+
<div v-if="uploadedImageUrl" class="image-preview-container">
|
| 148 |
+
<label>Aperçu du texte à commenter :</label>
|
| 149 |
+
<img :src="uploadedImageUrl" alt="Aperçu du texte" class="uploaded-image-preview">
|
| 150 |
+
</div>
|
| 151 |
</div>
|
| 152 |
|
| 153 |
<button type="submit" class="primary-button" :disabled="isLoading">
|
|
|
|
| 194 |
dissertationType: 'type1',
|
| 195 |
courses: [],
|
| 196 |
selectedCourse: '',
|
| 197 |
+
uploadedFile: null,
|
| 198 |
+
uploadedImageUrl: null, // <-- NOUVEL état pour l'URL de l'image
|
| 199 |
isLoading: false,
|
| 200 |
isDownloading: false,
|
| 201 |
errorMessage: null,
|
|
|
|
| 203 |
}
|
| 204 |
},
|
| 205 |
computed: {
|
|
|
|
| 206 |
dissertationTypeLabel() {
|
| 207 |
const labels = {
|
| 208 |
'type1': 'Type 1',
|
|
|
|
| 212 |
return labels[this.dissertationType] || 'Inconnu';
|
| 213 |
}
|
| 214 |
},
|
| 215 |
+
watch: {
|
| 216 |
+
// Surveiller le changement de type pour nettoyer la prévisualisation si on quitte le type 3
|
| 217 |
+
dissertationType(newType, oldType) {
|
| 218 |
+
if (oldType === 'type3' && newType !== 'type3') {
|
| 219 |
+
this.cleanupImage();
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
},
|
| 223 |
mounted() {
|
| 224 |
this.fetchCourses();
|
| 225 |
},
|
| 226 |
methods: {
|
| 227 |
+
// Nouvelle méthode pour nettoyer la mémoire de l'URL objet
|
| 228 |
+
cleanupImage() {
|
| 229 |
+
if (this.uploadedImageUrl) {
|
| 230 |
+
URL.revokeObjectURL(this.uploadedImageUrl);
|
| 231 |
+
this.uploadedImageUrl = null;
|
| 232 |
+
}
|
| 233 |
+
this.uploadedFile = null;
|
| 234 |
+
},
|
| 235 |
+
// MÉTHODE MISE À JOUR pour gérer la sélection du fichier et l'aperçu
|
| 236 |
handleFileUpload(event) {
|
| 237 |
+
this.cleanupImage(); // Nettoie l'ancienne image/URL
|
| 238 |
+
|
| 239 |
+
const file = event.target.files[0];
|
| 240 |
+
this.uploadedFile = file;
|
| 241 |
+
this.errorMessage = null;
|
| 242 |
+
|
| 243 |
+
if (file) {
|
| 244 |
+
// Crée une URL locale pour l'aperçu de l'image
|
| 245 |
+
this.uploadedImageUrl = URL.createObjectURL(file);
|
| 246 |
+
}
|
| 247 |
},
|
| 248 |
async fetchCourses() {
|
| 249 |
try {
|
|
|
|
| 254 |
this.errorMessage = error.message;
|
| 255 |
}
|
| 256 |
},
|
|
|
|
| 257 |
async generateDissertation() {
|
| 258 |
this.isLoading = true;
|
| 259 |
this.errorMessage = null;
|
|
|
|
| 302 |
this.errorMessage = error.message;
|
| 303 |
} finally {
|
| 304 |
this.isLoading = false;
|
| 305 |
+
// Optionnel : Nettoyer l'image après la soumission réussie
|
| 306 |
+
if (this.dissertationType === 'type3') {
|
| 307 |
+
// Note: Laisser la prévisualisation peut être utile si l'utilisateur veut resoumettre rapidement
|
| 308 |
+
// Si on veut nettoyer l'input file: event.target.value = null; (difficile ici car l'event n'est plus là)
|
| 309 |
+
// Pour cet exemple, nous allons laisser la prévisualisation visible jusqu'à la prochaine action.
|
| 310 |
+
}
|
| 311 |
}
|
| 312 |
},
|
|
|
|
| 313 |
async generatePDF() {
|
| 314 |
if (!this.dissertation) return;
|
| 315 |
this.isDownloading = true;
|