actualizacion de super indices, cambios de imagenes y textos. Asi como funcionabilidad de actividades

This commit is contained in:
2026-06-10 23:15:23 -06:00
parent 86391ea412
commit 447954b520
21 changed files with 1095 additions and 1110 deletions
+19 -21
View File
@@ -316,7 +316,7 @@
});
return {
pregunta: fila.pregunta.trim(),
opciones: opciones,
opciones: shuffleArray(opciones),
retroalimentacion_correcta: fila.retroalimentacion_correcta ? fila.retroalimentacion_correcta.trim() : '',
retroalimentacion_incorrecta: fila.retroalimentacion_incorrecta ? fila.retroalimentacion_incorrecta.trim() : ''
};
@@ -336,10 +336,8 @@
if (questionIndex >= questions.length) return;
const pregunta = questions[questionIndex];
const opcionesBarajadas = shuffleArray([...pregunta.opciones]);
let opcionesHTML = '';
opcionesBarajadas.forEach((opcion, index) => {
pregunta.opciones.forEach((opcion, index) => {
opcionesHTML += `<div class="position-relative d-flex flex-row align-items-center gap-0 mb-2 btn-answer" data-correct="${opcion.correct}">
<div class="d-flex flex-row justify-content-center align-items-center letter text-white text-center p-3">${String.fromCharCode(97 + index)}</div>
<div class="txt-answer ps-3">${opcion.text}</div>
@@ -369,35 +367,35 @@
backdrop: "rgba(65, 60, 60, .95)",
width: "50em",
didOpen: () => {
$('.btn-answer').click(function() {
function handleAnswer() {
const isCorrect = $(this).data('correct') === true;
$('.btn-answer').off('click hover').css('pointer-events', 'none');
$('.btn-answer').off('click').css('pointer-events', 'none');
CourseNav.audioController.stopAllSoundsAndPlay(isCorrect ? good : bad);
if (isCorrect) {
correctQuestions++;
$(`.med_style:eq(${questionIndex})`).addClass('bien');
setTimeout(() => {
Swal.close();
mostrarFeedback(pregunta, questionIndex);
}, 250);
} else {
$(`.med_style:eq(${questionIndex})`).addClass('mal');
setTimeout(() => {
$('.btn-answer').css('pointer-events', '').on('click', handleAnswer);
}, 600);
}
CourseNav.audioController.stopAllSoundsAndPlay(isCorrect ? good : bad);
setTimeout(() => {
Swal.close();
mostrarFeedback(isCorrect, pregunta, questionIndex);
}, 250);
});
}
$('.btn-answer').on('click', handleAnswer);
}
});
}
function mostrarFeedback(isCorrect, pregunta, questionIndex) {
const retroalimentacion = isCorrect ? pregunta.retroalimentacion_correcta : pregunta.retroalimentacion_incorrecta;
function mostrarFeedback(pregunta, questionIndex) {
Swal.fire({
target: document.getElementById('wrap-course-content'),
imageUrl: isCorrect ? 'img/good.png' : 'img/bad.png',
text: retroalimentacion || '',
imageUrl: 'img/good.png',
text: pregunta.retroalimentacion_correcta || '',
showConfirmButton: true,
customClass: {
popup: 'pop_retros bg-transparent border-0 rounded-0 shadow-none',
@@ -408,7 +406,7 @@
width: "35em",
didClose: () => {
const currentBtn = $(`.object-btn[data-obj="${questionIndex}"]`);
currentBtn.addClass(isCorrect ? 'completed good' : 'completed bad');
currentBtn.addClass('completed good');
currentQuestionIndex++;
if (currentQuestionIndex >= questions.length) {