Files
Rotafilio_Vantive/contenido/12.html
T

270 lines
9.2 KiB
HTML
Raw Normal View History

2025-09-23 16:53:05 -06:00
<style>
.fake {
background-image: url(img/bg12.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.hr-style {
opacity: 1;
2025-09-25 13:03:23 -06:00
width: 80%;
2025-09-23 16:53:05 -06:00
}
.btn-respuesta {
2025-09-24 22:51:53 -06:00
max-width: 550px;
cursor: pointer;
}
.indicator-circle {
width: 40px;
height: 40px;
margin: 0px 8px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
font-size: 18px;
font-weight: bold;
2025-09-23 16:53:05 -06:00
}
</style>
2026-07-01 02:25:52 -06:00
<div 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-12">
<div class="row justify-content-center">
2025-09-23 16:53:05 -06:00
<div class="col-10 mb-2">
<h2 class="text-center fw-bold text-primary">Cuidados del sitio de salida y complicaciones</h2>
2026-07-01 02:25:52 -06:00
<hr class="border border-3 border-verde-oscuro hr-style mx-auto my-0" />
2025-09-23 16:53:05 -06:00
</div>
2025-09-24 22:51:53 -06:00
<div class="col-10 px-0 mb-1 col-instrucciones">
2025-09-23 16:53:05 -06:00
<div class="card bg-lila-claro border-0 my-2 rounded-4 bg-custom px-3 py-2 text-center">
<div class="d-flex justify-content-center align-items-center flex-row">
2026-07-01 02:25:52 -06:00
<img src="img/12.3.png" class="img-fluid mx-3" />
2025-09-25 13:03:23 -06:00
<p class="mb-0 text-white text-start">Lee lo que opinan dos doctores sobre los cuidados del sitio de salida y las complicaciones que pueden surgir si no se hacen correctamente. Analiza cuidadosamente sus argumentos y elige quién tiene la razón.</p>
2025-09-23 16:53:05 -06:00
</div>
</div>
</div>
2025-09-24 22:51:53 -06:00
<div class="col-12 col-actividad">
<div class="row justify-content-center">
<div class="col-12 mb-2">
<div class="d-flex justify-content-center align-items-center gap-2 flex-row indicadores-avance"></div>
</div>
<div class="col-12">
<div id="puzzle-versus" class="d-flex flex-row justify-content-center gap-2"></div>
</div>
</div>
2025-09-23 16:53:05 -06:00
</div>
</div>
</div>
</div>
</div>
</div>
<div class="d-none">
<div id="pop0">
<div class="container-fluid">
2026-07-01 02:25:52 -06:00
<div class="w-100 text-center">
<img src="img/3.5.png" class="img-fluid" />
2025-09-23 16:53:05 -06:00
</div>
<div class="row justify-content-center">
<div class="col-12 text-center mb-2">
<h3 class="text-secondary-dark fw-bold">¡Bien hecho!</h3>
</div>
<div class="col-12 text-center">
<p class="mb-0">Has concluido la actividad.</p>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
2026-07-01 02:25:52 -06:00
'use strict';
2025-09-23 16:53:05 -06:00
$('.wrap-course-content').addClass('fake');
const feedbackcorrect = CourseNav.createSound('audio/feedback-correct.mpeg');
const feedbackincorrect = CourseNav.createSound('audio/feedback-incorrect.mpeg');
2026-07-01 02:25:52 -06:00
const imgPerso = ['img/12.0.png', 'img/12.1.png'];
2025-09-25 13:03:23 -06:00
const urlExcelFile = 'Actividades_Rotafolio_Vantive.xlsx';
2025-09-23 16:53:05 -06:00
let versusData;
let currentQuestionIndex = 0;
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);
2026-07-01 02:25:52 -06:00
var workbook = XLSX.read(data, { type: 'array' });
2025-09-23 16:53:05 -06:00
var result = {};
2026-07-01 02:25:52 -06:00
workbook.SheetNames.forEach((sheetName) => {
2025-09-23 16:53:05 -06:00
var sheet = workbook.Sheets[sheetName];
result[sheetName] = XLSX.utils.sheet_to_json(sheet);
});
callback(result);
};
xhr.send();
}
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;
}
2025-09-25 13:03:23 -06:00
function procesarPreguntas(data) {
2026-07-01 02:25:52 -06:00
return data.map((fila) => ({
2025-09-25 13:03:23 -06:00
pregunta: fila.pregunta ? String(fila.pregunta).trim() : '',
opcion: fila.opcion ? String(fila.opcion).trim() : '',
2026-07-01 02:25:52 -06:00
opcion_c: fila.opcion_c ? String(fila.opcion_c).trim() : '',
2025-09-25 13:03:23 -06:00
}));
}
2025-09-24 22:51:53 -06:00
function createIndicators(total) {
const container = $('.indicadores-avance');
container.empty();
for (let i = 0; i < total; i++) {
const circle = $('<div class="indicator-circle"></div>');
circle.css({
2026-07-01 02:25:52 -06:00
'background-color': i === 0 ? '#2196F3' : '#E0E0E0',
2025-09-24 22:51:53 -06:00
});
circle.attr('data-index', i);
container.append(circle);
}
}
function updateIndicators() {
2026-07-01 02:25:52 -06:00
$('.indicator-circle').each(function (index) {
2025-09-24 22:51:53 -06:00
const $this = $(this);
if (index < currentQuestionIndex) {
$this.empty();
const img = $('<img>').attr({
2026-07-01 02:25:52 -06:00
src: 'img/11.check.png',
style: 'width: 100%; height: 100%;',
2025-09-24 22:51:53 -06:00
});
$this.append(img);
} else if (index === currentQuestionIndex) {
$this.css('background-color', '#2196F3').empty();
} else {
$this.css('background-color', '#E0E0E0').empty();
}
});
}
2025-09-23 16:53:05 -06:00
function createVersusStructure() {
const container = $('#puzzle-versus');
if (!versusData || currentQuestionIndex >= versusData.length) {
console.log('No hay más datos disponibles');
return;
}
const data = versusData[currentQuestionIndex];
console.log('Pregunta actual:', data);
const shuffledImages = shuffleArray([...imgPerso]);
const responses = [data.opcion, data.opcion_c];
const randomOrder = Math.random() < 0.5;
const leftResponse = randomOrder ? responses[0] : responses[1];
const rightResponse = randomOrder ? responses[1] : responses[0];
2025-09-25 13:03:23 -06:00
const leftIsCorrect = randomOrder ? false : true; // opcion_c es la correcta
2025-09-23 16:53:05 -06:00
const structure = `
<div class="btn-respuesta" data-correct="${leftIsCorrect}">
<div class="d-flex flex-column justify-content-center align-items-center gap-0">
2025-09-25 13:03:23 -06:00
<img src="${shuffledImages[0]}" alt="personaje" style="z-index:1;">
2026-07-01 02:25:52 -06:00
<div class="card bg-verde-ceniza border-0 shadow rounded-15 pt-5 px-3 pb-3 text-center text-respuesta text-white" style="margin-top: -60px;"><p class="mb-0">${leftResponse || ''}</p></div>
2025-09-23 16:53:05 -06:00
</div>
</div>
2025-09-24 22:51:53 -06:00
<img src="img/12.2.png" class="img-fluid mx-2">
2025-09-23 16:53:05 -06:00
<div class="btn-respuesta" data-correct="${!leftIsCorrect}">
<div class="d-flex flex-column justify-content-center align-items-center gap-0">
2025-09-25 13:03:23 -06:00
<img src="${shuffledImages[1]}" alt="personaje" style="z-index:1;">
2026-07-01 02:25:52 -06:00
<div class="card bg-verde-ceniza border-0 shadow rounded-15 pt-5 px-3 pb-3 text-center text-respuesta text-white" style="margin-top: -60px;"><p class="mb-0">${rightResponse || ''}</p></div>
2025-09-23 16:53:05 -06:00
</div>
</div>
`;
container.html(structure);
2025-09-24 22:51:53 -06:00
container.addClass('animate__animated animate__zoomIn');
setTimeout(() => {
container.removeClass('animate__animated animate__zoomIn');
}, 1000);
2025-09-23 16:53:05 -06:00
2026-07-01 02:25:52 -06:00
$('.btn-respuesta').click(function () {
2025-09-23 16:53:05 -06:00
const isCorrect = $(this).data('correct');
if (isCorrect) {
feedbackcorrect.play();
currentQuestionIndex++;
2025-09-24 22:51:53 -06:00
updateIndicators();
container.addClass('animate__animated animate__zoomOut');
2025-09-23 16:53:05 -06:00
if (currentQuestionIndex >= versusData.length) {
2025-09-24 22:51:53 -06:00
setTimeout(() => showResults(), 700);
2025-09-23 16:53:05 -06:00
} else {
2025-09-24 22:51:53 -06:00
setTimeout(() => {
container.removeClass('animate__animated animate__zoomOut');
createVersusStructure();
}, 500);
2025-09-23 16:53:05 -06:00
}
} else {
feedbackincorrect.play();
}
});
}
2025-09-24 22:51:53 -06:00
function showResults() {
$('.col-actividad').hide();
$('.col-instrucciones').html('');
const resultHTML = `
<div class="text-center animate__animated animate__zoomIn">
<h3 class="text-primary fw-bold">¡Actividad completada!</h3>
<p class="text-secondary">¡Todas las respuestas fueron correctas!</p>
</div>
`;
$('.col-instrucciones').html(resultHTML);
setTimeout(() => checkAllCompleted(), 300);
}
2025-09-23 16:53:05 -06:00
function checkAllCompleted() {
setTimeout(() => {
2026-07-01 02:25:52 -06:00
const html = $('#pop0').html();
2025-09-23 16:53:05 -06:00
Swal.fire({
html: html,
2025-09-24 22:51:53 -06:00
target: document.getElementById('wrap-course-content'),
2025-09-23 16:53:05 -06:00
customClass: {
popup: 'pop_html_style border border-3 border-primary rounded-4',
2026-07-01 02:25:52 -06:00
confirmButton: 'btn text-white bg-primary amor fw-semibold animate__animated animate__pulse animate__infinite',
2025-09-23 16:53:05 -06:00
},
2026-07-01 02:25:52 -06:00
confirmButtonText: 'Cerrar',
2025-09-23 16:53:05 -06:00
showConfirmButton: true,
allowOutsideClick: false,
allowEscapeKey: false,
2026-07-01 02:25:52 -06:00
backdrop: 'rgba(65, 60, 60, .95)',
width: '35em',
2025-09-23 16:53:05 -06:00
didClose: () => {
CourseNav.setSlideVisited();
2026-07-01 02:25:52 -06:00
$('.card-container2').addClass('disabled');
},
2025-09-23 16:53:05 -06:00
});
}, 250);
}
// Cargar datos del Excel
2026-07-01 02:25:52 -06:00
readExcelFile(urlExcelFile, function (data) {
const hojaDatos = data['Diapositiva 14'];
2025-09-25 13:03:23 -06:00
versusData = procesarPreguntas(hojaDatos);
2025-09-23 16:53:05 -06:00
console.log('Datos cargados:', versusData);
2025-09-24 22:51:53 -06:00
createIndicators(versusData.length);
2025-09-23 16:53:05 -06:00
createVersusStructure();
});
});
</script>