457 lines
18 KiB
HTML
457 lines
18 KiB
HTML
<style>
|
|
.fake {
|
|
background-image: url(img/bg02.jpg);
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-size: cover;
|
|
background-attachment: fixed;
|
|
}
|
|
|
|
.fake1 {
|
|
background-image: url(img/bg01.jpg);
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-size: cover;
|
|
background-attachment: fixed;
|
|
}
|
|
|
|
.fake2 {
|
|
background-image: url(img/bg03.jpg);
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-size: cover;
|
|
background-attachment: fixed;
|
|
}
|
|
|
|
.btn-comenzar {
|
|
border-radius: 20px;
|
|
border-bottom-left-radius: 0;
|
|
border-bottom-right-radius: 0;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.alarm-img {
|
|
width: 90px;
|
|
margin: 10px 15px;
|
|
}
|
|
|
|
.border-style {
|
|
border-width: 4px;
|
|
border-style: solid;
|
|
border-image: linear-gradient(0deg, #E31D73, #72256B) 1;
|
|
border-radius: 18px;
|
|
}
|
|
|
|
.no-overflow {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.btn-answer {
|
|
cursor: pointer;
|
|
border-radius: 10px;
|
|
box-shadow: 0 0 2px rgba(0, 0, 0, .5);
|
|
background-color: #f8f9fa;
|
|
color: #333;
|
|
}
|
|
|
|
.letter {
|
|
background-color: #925c8d;
|
|
border-radius: 10px;
|
|
border-top-right-radius: 0;
|
|
border-bottom-right-radius: 0;
|
|
}
|
|
|
|
.btn-answer.selected {
|
|
background-color: #C0D2CD;
|
|
}
|
|
|
|
.btn-answer.selected .letter {
|
|
background-color: #6c9d7a;
|
|
}
|
|
|
|
.btn-answer:hover {
|
|
background-color: #C0D2CD;
|
|
}
|
|
|
|
.btn-answer:hover .letter {
|
|
background-color: #6c9d7a;
|
|
}
|
|
.btn-reintentar {
|
|
cursor: pointer;
|
|
}
|
|
</style>
|
|
<div id="inicio" class='page-sco py-2 py-md-0 h-100'>
|
|
<div class='container h-100'>
|
|
<div class='row justify-content-center align-items-center h-100'>
|
|
<div class='col-11'>
|
|
<div class='row justify-content-center align-items-center'>
|
|
<div class="col-12 text-center animate__animated animate__bounceInDown">
|
|
<div class="position-relative d-inline-block">
|
|
<h2 class="text-primary mb-1 fw-bold">Alarmas</h2>
|
|
<hr class="border border-2 border-verde-oscuro hr-style my-0 mb-1 opacity-100">
|
|
</div>
|
|
</div>
|
|
<!-- <div class="col-12 mb-3 text-center">
|
|
<h4 class="fw-bold text-verde-pino">Alimentación y actividad física</h4>
|
|
</div> -->
|
|
<div class="col-5 text-center intro mb-3 animate__animated animate__flipInX">
|
|
<div class="card bg-white border-0 rounded-3 p-3 pb-0 bx-shadow">
|
|
<p>En caso de incidencia, el equipo lanzará alarmas.</p>
|
|
|
|
<p>Es importante conocerlas para llevar a cabo los procedimientos correctos y resolver el
|
|
problema. </p>
|
|
<div class="w-100 position-relative text-center">
|
|
<div
|
|
class="btn-comenzar bg-primary d-inline-block px-3 py-2 text-center animate__animated animate__pulse animate__infinite">
|
|
<h5 class="text-white fw-bold mb-0">COMENZAR ACTIVIDAD</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-4 text-center mb-1 animate__animated animate__zoomIn">
|
|
<img src="img/18.0.png" class="img-fluid">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="desarrollo" class='page-sco py-2 py-md-0 h-100' style="display: none;overflow: hidden;">
|
|
<div class='container h-100'>
|
|
<div class='row justify-content-center align-items-center h-100'>
|
|
<div class='col-12'>
|
|
<div class='row justify-content-center mb-5'>
|
|
<div class="col-11 text-center animate__animated animate__bounceInDown">
|
|
<div class="position-relative d-inline-block">
|
|
<h2 class="text-primary mb-1 fw-bold">Alarmas</h2>
|
|
<hr class="border border-2 border-verde-oscuro hr-style my-0 mb-3 opacity-100">
|
|
</div>
|
|
</div>
|
|
<!-- <div class="col-12 mb-3 text-center">
|
|
<h4 class="fw-bold text-verde-pino">Alimentación y actividad física</h4>
|
|
</div> -->
|
|
<div class="col-12 px-0 mb-3">
|
|
<div class="row justify-content-center">
|
|
<div class="col-8">
|
|
<div class="card bg-verde-claro border-0 bx-shadow py-2 px-3"
|
|
style="border-radius: 25px;">
|
|
<div class="row justify-content-start">
|
|
<div class="col-12">
|
|
<div
|
|
class="d-flex flex-row justify-content-center align-items-center gap-3 ps-4">
|
|
<img src="img/book3.png" class="img-fluid">
|
|
<p class="mb-0"><strong>Instrucciones:</strong> Seleccione una alarma.
|
|
Lea detenidamente la pregunta que se mostrará y elija la respuesta
|
|
que considere correcta. Su objetivo es apagar todas las alarmas.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-11">
|
|
<div
|
|
class="row justify-content-center align-items-center animate__animated animate__slideInRight">
|
|
<div class="col-10">
|
|
<div class="alarms alarms d-flex justify-content-center"></div>
|
|
</div>
|
|
<div class="col-8">
|
|
<div class="card mt-4 border-style">
|
|
<div class="card-body">
|
|
<div class="container-question"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="cierre" class='page-sco py-2 py-md-0 h-100' style="display: none;">
|
|
<div class='container h-100'>
|
|
<div class='row justify-content-center align-items-center h-100'>
|
|
<div class='col-12'>
|
|
<div class="row justify-content-center">
|
|
<div class="col-12 text-center mb-3">
|
|
<img src="img/cierre_actividad.png" class="img-fluid">
|
|
</div>
|
|
<div class="col-12 mb-3 text-center">
|
|
<div class="position-relative d-inline-block">
|
|
<h2 class="text-primary mb-1 fw-bold">Alarmas</h2>
|
|
<hr class="border border-2 border-verde-oscuro hr-style my-0 opacity-100">
|
|
</div>
|
|
</div>
|
|
<!-- <div class="col-12 mb-3 text-center">
|
|
<h4 class="fw-bold text-verde-pino">Alimentación y actividad física</h4>
|
|
</div> -->
|
|
<div class="col-12 text-center mb-3">
|
|
<h4 class="text-secondary fw-bold">Ha concluido la actividad.</h4>
|
|
</div>
|
|
<div class="col-12 text-center col-reintentar animate__animated animate__zoomIn"
|
|
style="display: none;">
|
|
<div class="btn-reintentar rounded-3 bg-primary d-inline-block px-3 py-2 text-center animate__animated animate__pulse animate__infinite"
|
|
onclick="CourseNav.reload()">
|
|
<h5 class="text-white fw-bold mb-0">Reintentar</h5>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
$(function () {
|
|
"use strict";
|
|
$('.wrap-course-content').addClass('fake');
|
|
|
|
setTimeout(() => {
|
|
$('.intro').removeClass('animate__flipInX');
|
|
}, 600);
|
|
|
|
var preguntasActual = 0,
|
|
preguntasMax = 6,
|
|
preguntasCorrectas = 0;
|
|
const bad = CourseNav.createSound("audio/feedback-incorrect.mpeg");
|
|
const good = CourseNav.createSound("audio/feedback-correct.mpeg");
|
|
|
|
// Agregar imágenes de alarmas al iniciar la actividad
|
|
function inicializarAlarmas() {
|
|
const $alarms = $('.alarms');
|
|
$alarms.empty();
|
|
for (let i = 0; i < preguntasMax; i++) {
|
|
$alarms.append(`<img src="img/alarm_n.png" class="alarm-img" data-idx="${i}">`);
|
|
}
|
|
}
|
|
|
|
$('.btn-comenzar').click(function (e) {
|
|
e.preventDefault();
|
|
CourseNav.soundClick();
|
|
$('.wrap-course-content').addClass('fake1').removeClass('fake');
|
|
$('#inicio').hide();
|
|
$('#desarrollo').show();
|
|
inicializarAlarmas();
|
|
mostrarPregunta();
|
|
});
|
|
|
|
const urlExcelFile = "Actividades_Manual_Vantive.xlsx";
|
|
|
|
function readExcelFile(url, callback) {
|
|
var xhr = new XMLHttpRequest();
|
|
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 result = {};
|
|
workbook.SheetNames.forEach((sheetName) => {
|
|
var sheet = workbook.Sheets[sheetName];
|
|
result[sheetName] = XLSX.utils.sheet_to_json(sheet);
|
|
});
|
|
callback(result);
|
|
};
|
|
xhr.send();
|
|
}
|
|
|
|
function procesarPreguntas(data) {
|
|
const preguntas = data.map((fila) => {
|
|
const opciones = [];
|
|
Object.keys(fila).forEach((key) => {
|
|
if (key.startsWith("opcion")) {
|
|
opciones.push({
|
|
text: fila[key].trim(),
|
|
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() : ''
|
|
};
|
|
});
|
|
return preguntas;
|
|
}
|
|
|
|
function shuffleArray(array) {
|
|
for (let i = array.length - 1; i > 0; i--) {
|
|
const j = Math.floor(Math.random() * (i + 1));
|
|
[array[i], array[j]] = [array[j], array[i]];
|
|
}
|
|
return array;
|
|
}
|
|
|
|
let questions = [];
|
|
|
|
function mostrarPregunta() {
|
|
if (questions.length === 0) return;
|
|
|
|
const QuestionPop = false;
|
|
const indiceAleatorio = Math.floor(Math.random() * questions.length);
|
|
const preguntaAleatoria = questions[indiceAleatorio];
|
|
questions.splice(indiceAleatorio, 1); // Eliminar la pregunta usada
|
|
const opcionesBarajadas = shuffleArray([...preguntaAleatoria.opciones]);
|
|
|
|
let opcionesHTML = '';
|
|
opcionesBarajadas.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>
|
|
</div>`;
|
|
});
|
|
|
|
if (QuestionPop) {
|
|
Swal.fire({
|
|
target: document.getElementById('wrap-course-content'),
|
|
html: `
|
|
<div class="text-center mb-3">
|
|
<h4 class="fw-bold text-verde-oscuro">${preguntaAleatoria.pregunta}</h4>
|
|
</div>
|
|
<div class="content-answers">
|
|
${opcionesHTML}
|
|
</div>
|
|
`,
|
|
showConfirmButton: false,
|
|
allowOutsideClick: false,
|
|
customClass: {
|
|
popup: 'swal-wide bg-white border-0 rounded-3 shadow'
|
|
},
|
|
backdrop: "rgba(65, 60, 60, .95)",
|
|
width: "50em",
|
|
didOpen: () => {
|
|
$('.btn-answer').click(function () {
|
|
const isCorrect = $(this).data('correct') === true;
|
|
// const puntos = $(this).data('puntos');
|
|
|
|
$('.btn-answer').off('click').css('pointer-events', 'none');
|
|
|
|
if (isCorrect) {
|
|
$(this).addClass('bg-success text-white');
|
|
// totalPuntos += puntos;
|
|
visualFeedBack(true);
|
|
} else {
|
|
visualFeedBack(false);
|
|
$(this).addClass('bg-danger text-white');
|
|
//$('.btn-answer[data-correct="true"]').addClass('bg-success text-white');
|
|
}
|
|
|
|
CourseNav.audioController.stopAllSoundsAndPlay(isCorrect ? good : bad);
|
|
|
|
setTimeout(() => {
|
|
Swal.close();
|
|
mostrarFeedback(isCorrect, preguntaAleatoria);
|
|
}, 500);
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
$('.container-question').html(`
|
|
<div class="text-center mb-3">
|
|
<h4 class="fw-bold text-primary">${preguntaAleatoria.pregunta}</h4>
|
|
</div>
|
|
<div class="content-answers">
|
|
${opcionesHTML}
|
|
</div>
|
|
`);
|
|
$('.btn-answer').click(function () {
|
|
const isCorrect = $(this).data('correct') === true;
|
|
// const puntos = $(this).data('puntos');
|
|
|
|
$('.btn-answer').off('click').css('pointer-events', 'none');
|
|
|
|
if (isCorrect) {
|
|
$(this).addClass('bg-success text-white');
|
|
// totalPuntos += puntos;
|
|
visualFeedBack(true);
|
|
} else {
|
|
visualFeedBack(false);
|
|
$(this).addClass('bg-danger text-white');
|
|
//$('.btn-answer[data-correct="true"]').addClass('bg-success text-white');
|
|
}
|
|
|
|
CourseNav.audioController.stopAllSoundsAndPlay(isCorrect ? good : bad);
|
|
|
|
setTimeout(() => {
|
|
// Swal.close();
|
|
mostrarFeedback(isCorrect, preguntaAleatoria);
|
|
}, 500);
|
|
});
|
|
}
|
|
}
|
|
|
|
function mostrarFeedback(isCorrect, pregunta) {
|
|
const retroalimentacion = isCorrect ? pregunta.retroalimentacion_correcta : pregunta.retroalimentacion_incorrecta;
|
|
|
|
if (isCorrect) {
|
|
preguntasCorrectas++;
|
|
}
|
|
|
|
Swal.fire({
|
|
target: document.getElementById('wrap-course-content'),
|
|
imageUrl: isCorrect ? 'img/good.png' : 'img/bad.png',
|
|
text: retroalimentacion || '',
|
|
showConfirmButton: true,
|
|
customClass: {
|
|
popup: 'pop_retros bg-transparent border-0 rounded-0 shadow-none',
|
|
confirmButton: 'btn text-primary bg-lila-rosa amor fw-semibold animate__animated animate__pulse animate__infinite'
|
|
},
|
|
confirmButtonText: "Continuar",
|
|
backdrop: "rgba(65, 60, 60, .95)",
|
|
width: "35em",
|
|
didClose: () => {
|
|
continuarJuego();
|
|
}
|
|
});
|
|
}
|
|
|
|
function continuarJuego() {
|
|
preguntasActual++;
|
|
|
|
if (preguntasActual >= preguntasMax) {
|
|
setTimeout(() => {
|
|
finalizarJuego();
|
|
}, 400);
|
|
} else {
|
|
mostrarPregunta();
|
|
}
|
|
}
|
|
|
|
function visualFeedBack(isCorrect) {
|
|
// Cambiar la imagen de la alarma correspondiente
|
|
const $alarms = $('.alarms .alarm-img');
|
|
if ($alarms.length > preguntasActual) {
|
|
$alarms.eq(preguntasActual).attr('src', isCorrect ? 'img/alarm_c.png' : 'img/alarm_i.png');
|
|
}
|
|
}
|
|
|
|
function finalizarJuego() {
|
|
const porcentaje = (preguntasCorrectas / preguntasMax) * 100;
|
|
const aprobado = porcentaje >= 60;
|
|
|
|
$('.wrap-course-content').addClass('fake2').removeClass('fake1');
|
|
|
|
CourseNav.setSlideVisited();
|
|
|
|
if (aprobado) {
|
|
$('#desarrollo').hide();
|
|
$('#cierre').show();
|
|
} else {
|
|
$('.col-reintentar').show();
|
|
$('#desarrollo').hide();
|
|
$('#cierre').show();
|
|
}
|
|
}
|
|
|
|
|
|
readExcelFile(urlExcelFile, function (data) {
|
|
const hojaDatos = data["Diapositiva 39"];
|
|
questions = shuffleArray(procesarPreguntas(hojaDatos));
|
|
});
|
|
});
|
|
</script>
|