This commit is contained in:
2026-07-01 15:47:43 -06:00
parent 0be4d028e1
commit 2e304d7a99
15 changed files with 314 additions and 278 deletions
+62 -63
View File
@@ -1,6 +1,6 @@
<style>
.fake {
background-image: url("img/bg11.jpg");
background-image: url('img/bg11.jpg');
background-size: cover;
background-repeat: no-repeat;
}
@@ -118,15 +118,14 @@
display: block !important;
}
.pop_html_style{
.pop_html_style {
width: 100%;
}
@media (min-width: 768px) {
.pop_html_style{
.pop_html_style {
width: 700px;
}
}
</style>
<div class="page-sco py-2 py-md-0 h-100">
<div class="container h-100 m-0 g-0 p-0">
@@ -140,14 +139,11 @@
</div>
<div class="row animate__animated animate__slideInLeft">
<div class="col-7">
<div class="d-flex flex-row align-items-center bg-morado-claro py-3 text-white rounded-15" style="border-radius: 15px; border-top-left-radius: 0; border-bottom-left-radius: 0;">
<div class="d-flex flex-row align-items-center bg-morado-claro py-3 text-white rounded-15" style="border-radius: 15px; border-top-left-radius: 0; border-bottom-left-radius: 0">
<div class="mx-3">
<img src="img/2.1.png" alt="" class="img-fluid" />
</div>
<div>
<b>Instrucciones:</b> Da clic en la ruleta y contesta correctamente la pregunta acerca de la alimentación o medicación en diálisis peritoneal
para ganar los puntos.
</div>
<div><b>Instrucciones:</b> Da clic en la ruleta y contesta correctamente la pregunta acerca de la alimentación o medicación en diálisis peritoneal para ganar los puntos.</div>
</div>
</div>
</div>
@@ -187,7 +183,7 @@
</div>
</div>
</div>
<div class="col-4 text-center" style="margin-top: -30px;">
<div class="col-4 text-center" style="margin-top: -30px">
<div class="card flat justify-content-center align-items-center d-inline-flex">
<div class="indicador position-absolute start-50 translate-middle-x" style="z-index: 9999 !important; top: -1em">
<img src="img/ruleta/indicador.png" alt="" style="transform: rotate(90deg)" />
@@ -205,8 +201,8 @@
<div class="d-none">
<div id="pop0">
<div class="container-fluid">
<div class=" w-100 text-center">
<img src="img/3.5.png" class="img-fluid">
<div class="w-100 text-center">
<img src="img/3.5.png" class="img-fluid" />
</div>
<div class="row justify-content-center">
<div class="col-12 text-center mb-2">
@@ -221,8 +217,8 @@
</div>
<script>
$(function () {
"use strict";
$('.wrap-course-content').addClass("fake");
'use strict';
$('.wrap-course-content').addClass('fake');
// Puntajes de la ruleta en orden horario (empezando desde arriba)
const puntajes = [100, 200, 300, 400, 500, 600, 700, 600, 500, 400, 300, 200];
let isSpinning = false;
@@ -231,19 +227,19 @@
let girosRealizados = 0;
const maxGiros = 6;
const ruletaWheel = document.getElementById("ruleta-wheel");
const spinBtn = document.getElementById("spin-btn");
const puntosDisplay = document.querySelector(".puntos");
const avanceImages = document.querySelectorAll(".avance img");
const ruletaWheel = document.getElementById('ruleta-wheel');
const spinBtn = document.getElementById('spin-btn');
const puntosDisplay = document.querySelector('.puntos');
const avanceImages = document.querySelectorAll('.avance img');
function girarRuleta() {
if (isSpinning || girosRealizados >= maxGiros) return;
isSpinning = true;
spinBtn.disabled = true;
spinBtn.classList.remove("animate__animated", "animate__pulse", "animate__infinite");
ruletaWheel.classList.add("spinning");
document.getElementById("coursenav-main-content").classList.add("no-overflow");
spinBtn.classList.remove('animate__animated', 'animate__pulse', 'animate__infinite');
ruletaWheel.classList.add('spinning');
document.getElementById('coursenav-main-content').classList.add('no-overflow');
// Mínimo 3 vueltas + ángulo aleatorio (siempre hacia la derecha)
const vueltas = 3 + Math.random() * 2; // 3-5 vueltas
const anguloFinal = Math.random() * 360;
@@ -267,21 +263,21 @@
}, 4000);
}
spinBtn.addEventListener("click", girarRuleta);
spinBtn.addEventListener('click', girarRuleta);
const bad = CourseNav.createSound("audio/feedback-incorrect.mpeg");
const good = CourseNav.createSound("audio/feedback-correct.mpeg");
const bad = CourseNav.createSound('audio/feedback-incorrect.mpeg');
const good = CourseNav.createSound('audio/feedback-correct.mpeg');
const urlExcelFile = "Actividades_Rotafolio_Vantive.xlsx";
const urlExcelFile = 'Actividades_Rotafolio_Vantive.xlsx';
function readExcelFile(url, callback) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.responseType = "arraybuffer";
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function (e) {
var arrayBuffer = xhr.response;
var data = new Uint8Array(arrayBuffer);
var workbook = XLSX.read(data, { type: "array" });
var workbook = XLSX.read(data, { type: 'array' });
var result = {};
workbook.SheetNames.forEach((sheetName) => {
var sheet = workbook.Sheets[sheetName];
@@ -296,18 +292,18 @@
const preguntas = data.map((fila) => {
const opciones = [];
Object.keys(fila).forEach((key) => {
if (key.startsWith("opcion")) {
if (key.startsWith('opcion')) {
opciones.push({
text: fila[key].trim(),
correct: key === "opcion_c",
correct: key === 'opcion_c',
});
}
});
return {
pregunta: fila.pregunta.trim(),
opciones: opciones,
retroalimentacion_correcta: fila.retroalimentacion_correcta ? fila.retroalimentacion_correcta.trim() : "",
retroalimentacion_incorrecta: fila.retroalimentacion_incorrecta ? fila.retroalimentacion_incorrecta.trim() : "",
retroalimentacion_correcta: fila.retroalimentacion_correcta ? fila.retroalimentacion_correcta.trim() : '',
retroalimentacion_incorrecta: fila.retroalimentacion_incorrecta ? fila.retroalimentacion_incorrecta.trim() : '',
};
});
return preguntas;
@@ -327,7 +323,7 @@
function mostrarPregunta(puntajeEnJuego) {
if (questions.length === 0) {
console.error("No hay preguntas cargadas");
console.error('No hay preguntas cargadas');
return;
}
@@ -343,7 +339,7 @@
preguntasUsadas.push(originalIndex);
// Crear HTML para opciones
let opcionesHTML = "";
let opcionesHTML = '';
pregunta.opciones.forEach((opcion, index) => {
const letra = String.fromCharCode(97 + index); // 97 = 'a'
opcionesHTML += `<button class="opcion-btn d-block w-100" data-correct="${opcion.correct}" data-letter="${letra}"><span>${opcion.text}</span></button>`;
@@ -351,25 +347,29 @@
Swal.fire({
title: pregunta.pregunta,
html: `<div class="text-start">${opcionesHTML}</div>`,
html: `<div class="text-start mb-3">${opcionesHTML}</div>
<div class="col-12 text-center">
<p class="small mb-0">"Estos son casos hipotéticos basados en las referencias bibliográficas."</p>
</div>
`,
showConfirmButton: false,
allowOutsideClick: false,
target: document.getElementById('wrap-course-content'),
customClass: {
popup: "pop_html_style border border-3 border-primary rounded-4",
confirmButton: "btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite",
popup: 'pop_html_style border border-3 border-primary rounded-4',
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite',
},
didOpen: () => {
document.querySelectorAll(".opcion-btn").forEach((btn) => {
btn.addEventListener("mouseenter", () => {
btn.classList.add("selected");
document.querySelectorAll('.opcion-btn').forEach((btn) => {
btn.addEventListener('mouseenter', () => {
btn.classList.add('selected');
});
btn.addEventListener("mouseleave", () => {
btn.classList.remove("selected");
btn.addEventListener('mouseleave', () => {
btn.classList.remove('selected');
});
btn.addEventListener("click", (e) => {
const target = e.target.closest(".opcion-btn");
const esCorrecta = target.dataset.correct === "true";
btn.addEventListener('click', (e) => {
const target = e.target.closest('.opcion-btn');
const esCorrecta = target.dataset.correct === 'true';
manejarRespuesta(esCorrecta, puntajeEnJuego, pregunta);
});
});
@@ -385,20 +385,20 @@
// Marcar imagen como visitada solo cuando responde correctamente
if (girosRealizados < maxGiros) {
avanceImages[girosRealizados].classList.add("visited");
avanceImages[girosRealizados].classList.add('visited');
girosRealizados++;
}
Swal.fire({
title: "¡Correcto!",
title: '¡Correcto!',
text: `Has ganado ${puntajeEnJuego} puntos. ${pregunta.retroalimentacion_correcta}`,
icon: "success",
icon: 'success',
target: document.getElementById('wrap-course-content'),
confirmButtonText: "Continuar",
confirmButtonText: 'Continuar',
}).then(() => {
finalizarTurno();
if (girosRealizados < maxGiros) {
spinBtn.classList.add("animate__animated", "animate__pulse", "animate__infinite");
spinBtn.classList.add('animate__animated', 'animate__pulse', 'animate__infinite');
}
});
} else {
@@ -409,11 +409,11 @@
function finalizarTurno() {
isSpinning = false;
document.getElementById("coursenav-main-content").classList.remove("no-overflow");
document.getElementById('coursenav-main-content').classList.remove('no-overflow');
if (girosRealizados >= maxGiros) {
spinBtn.disabled = true;
spinBtn.textContent = "¡Juego Completado!";
spinBtn.textContent = '¡Juego Completado!';
CourseNav.setSlideVisited();
setTimeout(() => {
Completed();
@@ -423,27 +423,26 @@
spinBtn.textContent = `¡GIRAR RULETA! (${maxGiros - girosRealizados} restantes)`;
}
ruletaWheel.classList.remove("spinning");
ruletaWheel.classList.remove('spinning');
}
function Completed() {
const html = $("#pop0").html();
const html = $('#pop0').html();
Swal.fire({
html: html,
target: document.getElementById('wrap-course-content'),
customClass: {
popup: 'pop_html_style border border-3 border-primary rounded-4',
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite'
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite',
},
confirmButtonText: "Cerrar",
confirmButtonText: 'Cerrar',
showConfirmButton: true,
allowOutsideClick: false,
allowEscapeKey: false,
focusConfirm: false,
backdrop: "rgba(65, 60, 60, .95)",
width: "35em",
didOpen: () => {
},
backdrop: 'rgba(65, 60, 60, .95)',
width: '35em',
didOpen: () => {},
didClose: () => {
CourseNav.audioController.stopAudio();
CourseNav.setSlideVisited();
@@ -452,13 +451,13 @@
}
// Cargar preguntas de "Diapositiva 19"
readExcelFile(urlExcelFile, function (data) {
const sheetData = data["Diapositiva 19"];
const sheetData = data['Diapositiva 19'];
if (sheetData) {
questions = procesarPreguntas(sheetData);
console.log("Preguntas cargadas de Diapositiva 19:", questions);
console.log('Preguntas cargadas de Diapositiva 19:', questions);
} else {
console.error('No se encontró la hoja "Diapositiva 19"');
console.log("Hojas disponibles:", Object.keys(data));
console.log('Hojas disponibles:', Object.keys(data));
}
});
});