@ecored-sena/base-kit 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +49 -0
- package/plugin/components/AccordionRED.vue +78 -0
- package/plugin/components/AcordionA.vue +78 -0
- package/plugin/components/Audio.vue +20 -0
- package/plugin/components/BannerHero.vue +104 -0
- package/plugin/components/CarouselCard.vue +70 -0
- package/plugin/components/CarouselRED.vue +65 -0
- package/plugin/components/Complementario.vue +81 -0
- package/plugin/components/Creditos.vue +101 -0
- package/plugin/components/Dialogo.vue +30 -0
- package/plugin/components/DialogoActividad.vue +274 -0
- package/plugin/components/DialogoBurbuja.vue +46 -0
- package/plugin/components/DialogoChat.vue +88 -0
- package/plugin/components/Footer.vue +42 -0
- package/plugin/components/GlobalComponents.js +39 -0
- package/plugin/components/Glosario.vue +100 -0
- package/plugin/components/ImagenInfografica.vue +100 -0
- package/plugin/components/ImagenInfograficaB.vue +68 -0
- package/plugin/components/Inicio.vue +128 -0
- package/plugin/components/LineaTiempoA.vue +30 -0
- package/plugin/components/LineaTiempoB.vue +36 -0
- package/plugin/components/LineaTiempoC.vue +95 -0
- package/plugin/components/LineaTiempoD.vue +51 -0
- package/plugin/components/LineaTiempoE.vue +25 -0
- package/plugin/components/ModalA.vue +22 -0
- package/plugin/components/PasosA.vue +59 -0
- package/plugin/components/PasosB.vue +90 -0
- package/plugin/components/Referencias.vue +45 -0
- package/plugin/components/ScrollHorizontal.vue +105 -0
- package/plugin/components/Separador.vue +12 -0
- package/plugin/components/SlyderA.vue +65 -0
- package/plugin/components/SlyderB.vue +48 -0
- package/plugin/components/SlyderC.vue +53 -0
- package/plugin/components/SlyderD.vue +50 -0
- package/plugin/components/SlyderE.vue +58 -0
- package/plugin/components/SlyderF.vue +141 -0
- package/plugin/components/TabsA.vue +44 -0
- package/plugin/components/TabsB.vue +40 -0
- package/plugin/components/TabsC.vue +39 -0
- package/plugin/components/TarjetaAudio.vue +65 -0
- package/plugin/components/TimeLineRED.vue +51 -0
- package/plugin/components/actividad/ActividadController.vue +34 -0
- package/plugin/components/actividad/actividadCompletar/ActividadCompletar.vue +283 -0
- package/plugin/components/actividad/actividadCompletar/ActividadCompletarFooter.vue +63 -0
- package/plugin/components/actividad/actividadCompletar/ActividadParrafo.vue +218 -0
- package/plugin/components/actividad/actividadCompletar/ActividadResultados.vue +215 -0
- package/plugin/components/actividad/actividadCuestionario/Actividad.vue +222 -0
- package/plugin/components/actividad/actividadCuestionario/ActividadBarraAvance.vue +116 -0
- package/plugin/components/actividad/actividadCuestionario/ActividadPregunta.vue +146 -0
- package/plugin/components/actividad/actividadCuestionario/ActividadResultados.vue +215 -0
- package/plugin/components/audioMixins.js +73 -0
- package/plugin/components/componentSlotMixins.js +87 -0
- package/plugin/components/dialogoMixins.js +28 -0
- package/plugin/components/globalMixins.js +11 -0
- package/plugin/components/plantilla/Accesibilidad.vue +101 -0
- package/plugin/components/plantilla/AsideMenu.vue +242 -0
- package/plugin/components/plantilla/BannerInterno.vue +66 -0
- package/plugin/components/plantilla/BannerPrincipal.vue +104 -0
- package/plugin/components/plantilla/BarraAvance.vue +379 -0
- package/plugin/components/plantilla/Curso.vue +12 -0
- package/plugin/components/plantilla/Footer.vue +42 -0
- package/plugin/components/plantilla/Header.vue +152 -0
- package/plugin/components/plantilla/ScrollHorizontal.vue +105 -0
- package/plugin/components/plantillaMixins.js +34 -0
- package/plugin/components/slyderMixins.js +18 -0
- package/plugin/plugin.js +49 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="row align-items-center">
|
|
4
|
+
<div class="d-none d-lg-block col-3">
|
|
5
|
+
<img :src="imagen" alt="" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="col">
|
|
8
|
+
<div>
|
|
9
|
+
<h3 class="mb-4 pb-4">
|
|
10
|
+
{{ instruccion }}
|
|
11
|
+
</h3>
|
|
12
|
+
<div class="row align-items-center">
|
|
13
|
+
<ol class="lista-ol--cuadro lista-ol--separador">
|
|
14
|
+
<li v-for="(item, index) in textos" :key="item.id" class="d-flex">
|
|
15
|
+
<div class="lista-ol--cuadro__vineta v--green">
|
|
16
|
+
<span>{{ index + 1 }}</span>
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
class="texto-con-input"
|
|
20
|
+
v-html="procesarTextoConInput(item.texto, item.id)"
|
|
21
|
+
></div>
|
|
22
|
+
</li>
|
|
23
|
+
</ol>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
export default {
|
|
33
|
+
name: 'ActividadParrafo',
|
|
34
|
+
props: {
|
|
35
|
+
instruccion: {
|
|
36
|
+
type: String,
|
|
37
|
+
default:
|
|
38
|
+
'Digite en el espacio indicado la palabra que dé sentido a cada frase.',
|
|
39
|
+
},
|
|
40
|
+
imagen: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: require('@/assets/actividad/imagen1.png'),
|
|
43
|
+
},
|
|
44
|
+
textos: {
|
|
45
|
+
type: Array,
|
|
46
|
+
required: true,
|
|
47
|
+
default: () => [],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
respuestasUsuario: {},
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
mounted() {
|
|
56
|
+
// Inicializar respuestas del usuario
|
|
57
|
+
this.textos.forEach(item => {
|
|
58
|
+
this.$set(this.respuestasUsuario, item.id, '')
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
// Agregar event listeners para los inputs después de que se rendericen
|
|
62
|
+
this.$nextTick(() => {
|
|
63
|
+
this.agregarEventListeners()
|
|
64
|
+
})
|
|
65
|
+
},
|
|
66
|
+
methods: {
|
|
67
|
+
procesarTextoConInput(texto, itemId) {
|
|
68
|
+
// Reemplazar [respuesta] con un input envuelto en un span para posicionamiento
|
|
69
|
+
return texto.replace(
|
|
70
|
+
/\[respuesta\]/g,
|
|
71
|
+
`<span class="input-container"><input type="text" class="input-inline" data-item-id="${itemId}" placeholder="[?]" /></span>`,
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
agregarEventListeners() {
|
|
76
|
+
// Agregar event listeners a todos los inputs
|
|
77
|
+
const inputs = this.$el.querySelectorAll('.input-inline')
|
|
78
|
+
inputs.forEach(input => {
|
|
79
|
+
input.addEventListener('input', this.manejarCambioInput)
|
|
80
|
+
})
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
manejarCambioInput(event) {
|
|
84
|
+
const itemId = parseInt(event.target.dataset.itemId)
|
|
85
|
+
const valor = event.target.value
|
|
86
|
+
this.$set(this.respuestasUsuario, itemId, valor)
|
|
87
|
+
|
|
88
|
+
// Emitir evento para el componente padre
|
|
89
|
+
this.$emit('respuesta-cambiada', {
|
|
90
|
+
itemId: itemId,
|
|
91
|
+
valor: valor,
|
|
92
|
+
todasLasRespuestas: this.respuestasUsuario,
|
|
93
|
+
})
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style lang="sass" scoped>
|
|
100
|
+
img
|
|
101
|
+
width: auto
|
|
102
|
+
height: auto
|
|
103
|
+
display: block
|
|
104
|
+
margin: auto
|
|
105
|
+
|
|
106
|
+
.texto-con-input
|
|
107
|
+
flex: 1
|
|
108
|
+
line-height: 1.6
|
|
109
|
+
|
|
110
|
+
// Contenedor para input e icono
|
|
111
|
+
::v-deep .input-container
|
|
112
|
+
display: inline-block
|
|
113
|
+
position: relative
|
|
114
|
+
white-space: nowrap
|
|
115
|
+
|
|
116
|
+
// Estilos para el input inline
|
|
117
|
+
::v-deep .input-inline
|
|
118
|
+
display: inline !important
|
|
119
|
+
border: 2px solid #ddd !important
|
|
120
|
+
background-color: #f5d982 !important
|
|
121
|
+
padding: 4px 8px !important
|
|
122
|
+
margin: 0 2px !important
|
|
123
|
+
font-size: inherit !important
|
|
124
|
+
font-family: inherit !important
|
|
125
|
+
line-height: 1.2 !important
|
|
126
|
+
min-width: 100px !important
|
|
127
|
+
max-width: 150px !important
|
|
128
|
+
text-align: center !important
|
|
129
|
+
border-radius: 4px !important
|
|
130
|
+
transition: all 0.3s ease !important
|
|
131
|
+
vertical-align: baseline !important
|
|
132
|
+
height: auto !important
|
|
133
|
+
box-sizing: border-box !important
|
|
134
|
+
|
|
135
|
+
&:focus
|
|
136
|
+
outline: none !important
|
|
137
|
+
border-color: #556a82 !important
|
|
138
|
+
background-color: #f0d050 !important
|
|
139
|
+
box-shadow: 0 0 0 2px rgba(85, 106, 130, 0.2) !important
|
|
140
|
+
|
|
141
|
+
&::placeholder
|
|
142
|
+
color: #666 !important
|
|
143
|
+
font-size: inherit !important
|
|
144
|
+
font-weight: normal !important
|
|
145
|
+
|
|
146
|
+
// Estados de validación
|
|
147
|
+
&.input-correcto
|
|
148
|
+
border-color: #28a745 !important
|
|
149
|
+
background-color: #d4edda !important
|
|
150
|
+
color: #155724 !important
|
|
151
|
+
|
|
152
|
+
&:focus
|
|
153
|
+
border-color: #28a745 !important
|
|
154
|
+
background-color: #c3e6cb !important
|
|
155
|
+
box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.25) !important
|
|
156
|
+
|
|
157
|
+
&.input-incorrecto
|
|
158
|
+
border-color: #dc3545 !important
|
|
159
|
+
background-color: #f8d7da !important
|
|
160
|
+
color: #721c24 !important
|
|
161
|
+
|
|
162
|
+
&:focus
|
|
163
|
+
border-color: #dc3545 !important
|
|
164
|
+
background-color: #f1b0b7 !important
|
|
165
|
+
box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important
|
|
166
|
+
|
|
167
|
+
// Estado deshabilitado
|
|
168
|
+
&:disabled
|
|
169
|
+
opacity: 0.8 !important
|
|
170
|
+
cursor: not-allowed !important
|
|
171
|
+
|
|
172
|
+
.tarjeta--pregunta
|
|
173
|
+
background: #dce4eb
|
|
174
|
+
|
|
175
|
+
.tarjeta-respuesta
|
|
176
|
+
border: 2px solid transparent
|
|
177
|
+
cursor: pointer
|
|
178
|
+
transition: border-color 0.2s
|
|
179
|
+
|
|
180
|
+
&:hover
|
|
181
|
+
border-color: #556a82
|
|
182
|
+
|
|
183
|
+
.tarjeta-respuesta__icon:not(.tarjeta-respuesta__icon--correcto):not(.tarjeta-respuesta__icon--incorrecto)
|
|
184
|
+
background-image: url('~@/assets/actividad/vacio-hover.svg')
|
|
185
|
+
|
|
186
|
+
&--correcta
|
|
187
|
+
border-color: #61ca92ff
|
|
188
|
+
background-color: #ebfff0ff
|
|
189
|
+
|
|
190
|
+
&:hover
|
|
191
|
+
border-color: #61ca92ff
|
|
192
|
+
|
|
193
|
+
&--incorrecta
|
|
194
|
+
border-color: #ff6b6bff
|
|
195
|
+
background-color: #ffedecff
|
|
196
|
+
|
|
197
|
+
&:hover
|
|
198
|
+
border-color: #ff6b6bff
|
|
199
|
+
|
|
200
|
+
&--disabled
|
|
201
|
+
cursor: not-allowed
|
|
202
|
+
pointer-events: none
|
|
203
|
+
|
|
204
|
+
&__icon
|
|
205
|
+
width: 32px
|
|
206
|
+
height: 32px
|
|
207
|
+
position: relative
|
|
208
|
+
background-image: url('~@/assets/actividad/vacio.svg')
|
|
209
|
+
|
|
210
|
+
&:hover
|
|
211
|
+
background-image: url('~@/assets/actividad/vacio-hover.svg')
|
|
212
|
+
|
|
213
|
+
&--correcto
|
|
214
|
+
background-image: url('~@/assets/actividad/correcto.svg')
|
|
215
|
+
|
|
216
|
+
&--incorrecto
|
|
217
|
+
background-image: url('~@/assets/actividad/incorrecto.svg')
|
|
218
|
+
</style>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="row align-items-center justify-content-around">
|
|
3
|
+
<div class="col-lg-5">
|
|
4
|
+
<img
|
|
5
|
+
v-if="aprobado"
|
|
6
|
+
src="@/assets/componentes/cuestionario-resultado.svg"
|
|
7
|
+
alt=""
|
|
8
|
+
class="mx-auto d-none d-lg-block"
|
|
9
|
+
/>
|
|
10
|
+
<img
|
|
11
|
+
v-else
|
|
12
|
+
src="@/assets/componentes/cuestionario-resultado.svg"
|
|
13
|
+
alt=""
|
|
14
|
+
class="mx-auto d-none d-lg-block"
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="col-lg-4">
|
|
18
|
+
<div class="d-flex align-items-center flex-column">
|
|
19
|
+
<div class="circle-container mb-4">
|
|
20
|
+
<svg class="circle" viewBox="0 0 36 36">
|
|
21
|
+
<defs>
|
|
22
|
+
<linearGradient
|
|
23
|
+
id="progressGradient"
|
|
24
|
+
x1="0%"
|
|
25
|
+
y1="0%"
|
|
26
|
+
x2="100%"
|
|
27
|
+
y2="0%"
|
|
28
|
+
>
|
|
29
|
+
<stop offset="0%" stop-color="#00FF00" />
|
|
30
|
+
<stop offset="50%" stop-color="#FFFF00" />
|
|
31
|
+
<stop offset="100%" stop-color="#FF0000" />
|
|
32
|
+
</linearGradient>
|
|
33
|
+
</defs>
|
|
34
|
+
<path
|
|
35
|
+
class="circle-bg"
|
|
36
|
+
d="M18 2.0845
|
|
37
|
+
a 15.9155 15.9155 0 0 1 0 31.831
|
|
38
|
+
a 15.9155 15.9155 0 0 1 0 -31.831"
|
|
39
|
+
/>
|
|
40
|
+
<path
|
|
41
|
+
class="circle-progress"
|
|
42
|
+
:stroke-dasharray="`${currentPercentage}, 100`"
|
|
43
|
+
d="M18 2.0845
|
|
44
|
+
a 15.9155 15.9155 0 0 1 0 31.831
|
|
45
|
+
a 15.9155 15.9155 0 0 1 0 -31.831"
|
|
46
|
+
/>
|
|
47
|
+
</svg>
|
|
48
|
+
<div class="percentage-text">
|
|
49
|
+
{{ Math.round(porcentajeAprobadas) }} %
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<template v-if="aprobado">
|
|
54
|
+
<h3>{{ tituloAprobado }}</h3>
|
|
55
|
+
<p class="mb-0 text-center">
|
|
56
|
+
{{ mensajeAprobado }}
|
|
57
|
+
</p>
|
|
58
|
+
</template>
|
|
59
|
+
<template v-else>
|
|
60
|
+
<h3>{{ tituloReprobado }}</h3>
|
|
61
|
+
<p class="mb-0 text-center">
|
|
62
|
+
{{ mensajeReprobado }}
|
|
63
|
+
</p>
|
|
64
|
+
</template>
|
|
65
|
+
<hr class="w-100" />
|
|
66
|
+
<p class="mb-0">Aciertos: {{ rtas.correctas }} / {{ rtas.total }}</p>
|
|
67
|
+
<button
|
|
68
|
+
v-if="totalPreguntasBase >= preguntasCount"
|
|
69
|
+
class="boton btn-lg boton--b py-3 px-5 mt-3"
|
|
70
|
+
@click="$emit('reiniciar')"
|
|
71
|
+
>
|
|
72
|
+
<span>Volver a intentarlo</span>
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</template>
|
|
78
|
+
|
|
79
|
+
<script>
|
|
80
|
+
export default {
|
|
81
|
+
name: 'ActividadResultados',
|
|
82
|
+
props: {
|
|
83
|
+
respuestas: {
|
|
84
|
+
type: Array,
|
|
85
|
+
required: true,
|
|
86
|
+
},
|
|
87
|
+
mensajeAprobado: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: 'Ha superado la actividad.',
|
|
90
|
+
},
|
|
91
|
+
mensajeReprobado: {
|
|
92
|
+
type: String,
|
|
93
|
+
default:
|
|
94
|
+
'Se recomienda volver a revisar el componente formativo e intentar nuevamente la actividad didáctica.',
|
|
95
|
+
},
|
|
96
|
+
tituloAprobado: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: '¡FELICIDADES!',
|
|
99
|
+
},
|
|
100
|
+
tituloReprobado: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: 'VUELVA A INTENTARLO',
|
|
103
|
+
},
|
|
104
|
+
porcentajeAprobadas: {
|
|
105
|
+
type: Number,
|
|
106
|
+
required: true,
|
|
107
|
+
},
|
|
108
|
+
totalPreguntasBase: {
|
|
109
|
+
type: Number,
|
|
110
|
+
required: true,
|
|
111
|
+
},
|
|
112
|
+
preguntasCount: {
|
|
113
|
+
type: Number,
|
|
114
|
+
required: true,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
data() {
|
|
118
|
+
return {
|
|
119
|
+
currentPercentage: 0,
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
computed: {
|
|
123
|
+
rtas() {
|
|
124
|
+
const respuestas = {
|
|
125
|
+
correctas: 0,
|
|
126
|
+
incorrectas: 0,
|
|
127
|
+
total: this.respuestas.length,
|
|
128
|
+
porcentaje: 0,
|
|
129
|
+
}
|
|
130
|
+
this.respuestas.forEach(r => {
|
|
131
|
+
if (r.esCorrecta) {
|
|
132
|
+
respuestas.correctas++
|
|
133
|
+
} else {
|
|
134
|
+
respuestas.incorrectas++
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
respuestas.porcentaje = (respuestas.correctas / respuestas.total) * 100
|
|
138
|
+
return respuestas
|
|
139
|
+
},
|
|
140
|
+
aprobado() {
|
|
141
|
+
return this.rtas.porcentaje >= 70
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
mounted() {
|
|
145
|
+
this.animateProgress()
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
animateProgress() {
|
|
149
|
+
const duration = 1500
|
|
150
|
+
const start = performance.now()
|
|
151
|
+
|
|
152
|
+
const animate = time => {
|
|
153
|
+
const timeFraction = (time - start) / duration
|
|
154
|
+
if (timeFraction > 1) {
|
|
155
|
+
this.currentPercentage = this.porcentajeAprobadas
|
|
156
|
+
} else {
|
|
157
|
+
this.currentPercentage = timeFraction * this.porcentajeAprobadas
|
|
158
|
+
requestAnimationFrame(animate)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
requestAnimationFrame(animate)
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<style lang="sass" scoped>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
.resultados
|
|
172
|
+
&__icono
|
|
173
|
+
width: 150px
|
|
174
|
+
height: 150px
|
|
175
|
+
background-size: cover
|
|
176
|
+
background-repeat: no-repeat
|
|
177
|
+
&--correcto
|
|
178
|
+
background-image: url('~@/assets/actividad/correcto.svg')
|
|
179
|
+
&--incorrecto
|
|
180
|
+
background-image: url('~@/assets/actividad/incorrecto.svg')
|
|
181
|
+
@media (max-width: 560px)
|
|
182
|
+
width: 80px
|
|
183
|
+
height: 80px
|
|
184
|
+
|
|
185
|
+
.circle-container
|
|
186
|
+
width: 150px
|
|
187
|
+
height: 150px
|
|
188
|
+
position: relative
|
|
189
|
+
display: flex
|
|
190
|
+
justify-content: center
|
|
191
|
+
align-items: center
|
|
192
|
+
|
|
193
|
+
.circle
|
|
194
|
+
transform: rotate(0deg)
|
|
195
|
+
width: 100%
|
|
196
|
+
height: 100%
|
|
197
|
+
|
|
198
|
+
.circle-bg
|
|
199
|
+
fill: none
|
|
200
|
+
stroke: #eee
|
|
201
|
+
stroke-width: 3.8
|
|
202
|
+
|
|
203
|
+
.circle-progress
|
|
204
|
+
fill: none
|
|
205
|
+
stroke: url(#progressGradient)
|
|
206
|
+
stroke-width: 3.8
|
|
207
|
+
stroke-linecap: round
|
|
208
|
+
transition: stroke-dasharray 0.1s
|
|
209
|
+
|
|
210
|
+
.percentage-text
|
|
211
|
+
position: absolute
|
|
212
|
+
font-size: 1.5rem
|
|
213
|
+
font-weight: bold
|
|
214
|
+
color: #666
|
|
215
|
+
</style>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="tarjeta--blanca">
|
|
3
|
+
<div class="row align-items-center mb-4">
|
|
4
|
+
<div class="col-auto">
|
|
5
|
+
<img src="@/assets/componentes/icon-actividad.svg" alt="" />
|
|
6
|
+
</div>
|
|
7
|
+
<div class="col ">
|
|
8
|
+
<h2 class="titulo-tercero mb-0">
|
|
9
|
+
{{ cuestionario.titulo }}
|
|
10
|
+
</h2>
|
|
11
|
+
<p class="mb-0" v-html="cuestionario.introduccion"></p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="tarjeta tarjeta--lightest-gray px-4 pb-4 pt-4 px-md-5">
|
|
15
|
+
<div
|
|
16
|
+
v-if="respuestas.length !== preguntas.length"
|
|
17
|
+
class="d-flex justify-content-end mb-2"
|
|
18
|
+
>
|
|
19
|
+
<div class="form-check form-switch">
|
|
20
|
+
<input
|
|
21
|
+
id="switchCheckAudio"
|
|
22
|
+
v-model="audioEnabled"
|
|
23
|
+
class="form-check-input"
|
|
24
|
+
type="checkbox"
|
|
25
|
+
/>
|
|
26
|
+
<label class="form-check-label" for="switchCheckAudio">¿Audio?</label>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
<ActividadResultados
|
|
30
|
+
v-if="respuestas.length === preguntas.length"
|
|
31
|
+
:respuestas="respuestas"
|
|
32
|
+
:mensaje-aprobado="cuestionario.mensaje_final_aprobado"
|
|
33
|
+
:mensaje-reprobado="cuestionario.mensaje_final_reprobado"
|
|
34
|
+
:titulo-aprobado="cuestionario.titulo_aprobado"
|
|
35
|
+
:titulo-reprobado="cuestionario.titulo_reprobado"
|
|
36
|
+
:porcentaje-aprobadas="porcentajeAprobadas"
|
|
37
|
+
:preguntas-count="preguntas.length"
|
|
38
|
+
:total-preguntas-base="cuestionario.preguntas.length"
|
|
39
|
+
@reiniciar="onReiniciar"
|
|
40
|
+
/>
|
|
41
|
+
<ActividadPregunta
|
|
42
|
+
v-else
|
|
43
|
+
:pregunta="preguntaSelected"
|
|
44
|
+
:numero-pregunta="preguntaSelectedIdx + 1"
|
|
45
|
+
@respuestaSelected="onRrespuestaSelected"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
<ActividadBarraAvance
|
|
49
|
+
:pregunta-index="preguntaSelectedIdx"
|
|
50
|
+
:preguntas-count="preguntas.length"
|
|
51
|
+
:respuestas-length="respuestas.length"
|
|
52
|
+
:continuar-disabled="continuarDisabled"
|
|
53
|
+
:respuestas="respuestas"
|
|
54
|
+
class="mx-4 mx-md-5"
|
|
55
|
+
@continuar="onContinuar"
|
|
56
|
+
@reiniciar="onReiniciar"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import screenChangeSound from '@/assets/actividad/audio/screen-change.mp3'
|
|
63
|
+
import successSound from '@/assets/actividad/audio/success.mp3'
|
|
64
|
+
import failSound from '@/assets/actividad/audio/fail.mp3'
|
|
65
|
+
import endGameSuccessSound from '@/assets/actividad/audio/end-game-success.mp3'
|
|
66
|
+
import endGameFailSound from '@/assets/actividad/audio/end-game-fail.mp3'
|
|
67
|
+
import ActividadPregunta from './ActividadPregunta'
|
|
68
|
+
import ActividadBarraAvance from './ActividadBarraAvance'
|
|
69
|
+
import ActividadResultados from './ActividadResultados'
|
|
70
|
+
export default {
|
|
71
|
+
name: 'Actividad',
|
|
72
|
+
components: {
|
|
73
|
+
ActividadPregunta,
|
|
74
|
+
ActividadBarraAvance,
|
|
75
|
+
ActividadResultados,
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
cuestionario: {
|
|
79
|
+
type: Object,
|
|
80
|
+
required: true,
|
|
81
|
+
},
|
|
82
|
+
mezclarRespuestas: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
data: () => ({
|
|
88
|
+
intentos: 0,
|
|
89
|
+
preguntaSelectedIdx: 0,
|
|
90
|
+
respuestaActual: {},
|
|
91
|
+
respuestas: [],
|
|
92
|
+
continuarDisabled: true,
|
|
93
|
+
audioEnabled: true,
|
|
94
|
+
totalPreguntasOriginales: 0,
|
|
95
|
+
}),
|
|
96
|
+
computed: {
|
|
97
|
+
preguntas() {
|
|
98
|
+
const MAX_PREGUNTAS = 10
|
|
99
|
+
const { preguntas } = this.cuestionario
|
|
100
|
+
if (!preguntas) return []
|
|
101
|
+
|
|
102
|
+
const preguntasBarajadas = this.shuffle(preguntas)
|
|
103
|
+
|
|
104
|
+
const preguntasSeleccionadas =
|
|
105
|
+
preguntasBarajadas.length >= MAX_PREGUNTAS
|
|
106
|
+
? preguntasBarajadas.slice(0, MAX_PREGUNTAS)
|
|
107
|
+
: preguntasBarajadas
|
|
108
|
+
|
|
109
|
+
console.log(
|
|
110
|
+
'preguntasSeleccionadas',
|
|
111
|
+
preguntasSeleccionadas,
|
|
112
|
+
'preguntasBarajadas',
|
|
113
|
+
preguntasBarajadas,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return preguntasSeleccionadas.map(pregunta => ({
|
|
117
|
+
...pregunta,
|
|
118
|
+
opciones: pregunta.barajarRespuestas
|
|
119
|
+
? this.shuffle(pregunta.opciones)
|
|
120
|
+
: pregunta.opciones,
|
|
121
|
+
intentos: this.intentos,
|
|
122
|
+
}))
|
|
123
|
+
},
|
|
124
|
+
preguntaSelected() {
|
|
125
|
+
return this.preguntas[this.preguntaSelectedIdx]
|
|
126
|
+
},
|
|
127
|
+
porcentajeAprobadas() {
|
|
128
|
+
if (this.respuestas.length === 0) return 0
|
|
129
|
+
const aprobadas = this.respuestas.filter(r => r.esCorrecta).length
|
|
130
|
+
return Math.round((aprobadas / this.respuestas.length) * 100)
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
methods: {
|
|
134
|
+
shuffle(array) {
|
|
135
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
136
|
+
const j = Math.floor(Math.random() * (i + 1))
|
|
137
|
+
;[array[i], array[j]] = [array[j], array[i]]
|
|
138
|
+
}
|
|
139
|
+
return array
|
|
140
|
+
},
|
|
141
|
+
/*shuffle(array) {
|
|
142
|
+
let currentIndex = array.length
|
|
143
|
+
let randomIndex
|
|
144
|
+
while (currentIndex > 0) {
|
|
145
|
+
randomIndex = Math.floor(Math.random() * currentIndex)
|
|
146
|
+
currentIndex--
|
|
147
|
+
;[array[currentIndex], array[randomIndex]] = [
|
|
148
|
+
array[randomIndex],
|
|
149
|
+
array[currentIndex],
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
return array
|
|
153
|
+
},*/
|
|
154
|
+
onRrespuestaSelected(respuestaEsCorrecta) {
|
|
155
|
+
this.continuarDisabled = false
|
|
156
|
+
this.respuestaActual = {
|
|
157
|
+
id: this.preguntaSelected.id,
|
|
158
|
+
esCorrecta: respuestaEsCorrecta,
|
|
159
|
+
}
|
|
160
|
+
if (respuestaEsCorrecta) {
|
|
161
|
+
this.reproducirSonido(successSound)
|
|
162
|
+
} else {
|
|
163
|
+
this.reproducirSonido(failSound)
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
onContinuar() {
|
|
167
|
+
this.continuarDisabled = true
|
|
168
|
+
if (this.respuestaActual.id) {
|
|
169
|
+
const idx = this.respuestas.findIndex(
|
|
170
|
+
r => r.id === this.preguntaSelected.id,
|
|
171
|
+
)
|
|
172
|
+
if (idx === -1) {
|
|
173
|
+
this.respuestas.push(this.respuestaActual)
|
|
174
|
+
} else {
|
|
175
|
+
this.respuestas[idx] = this.respuestaActual
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (this.preguntaSelectedIdx < this.preguntas.length - 1) {
|
|
180
|
+
this.preguntaSelectedIdx += 1
|
|
181
|
+
this.reproducirSonido(screenChangeSound)
|
|
182
|
+
} else {
|
|
183
|
+
this.finalizarPrueba()
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
onReiniciar() {
|
|
187
|
+
this.preguntaSelectedIdx = 0
|
|
188
|
+
this.respuestas = []
|
|
189
|
+
this.respuestaActual = {}
|
|
190
|
+
this.intentos += 1
|
|
191
|
+
this.$emit('reiniciar')
|
|
192
|
+
},
|
|
193
|
+
reproducirSonido(audioSrc) {
|
|
194
|
+
if (this.audioEnabled) {
|
|
195
|
+
const audio = new Audio(audioSrc)
|
|
196
|
+
audio.play()
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
finalizarPrueba() {
|
|
200
|
+
const totalPreguntas = this.preguntas.length
|
|
201
|
+
const respuestasCorrectas = this.respuestas.filter(r => r.esCorrecta)
|
|
202
|
+
.length
|
|
203
|
+
const porcentajeAprobacion = (respuestasCorrectas / totalPreguntas) * 100
|
|
204
|
+
|
|
205
|
+
if (porcentajeAprobacion >= 70) {
|
|
206
|
+
this.reproducirSonido(endGameSuccessSound)
|
|
207
|
+
} else {
|
|
208
|
+
this.reproducirSonido(endGameFailSound)
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
</script>
|
|
214
|
+
|
|
215
|
+
<style lang="sass" scoped>
|
|
216
|
+
.boton--disabled
|
|
217
|
+
opacity: 0.5
|
|
218
|
+
pointer-events: none
|
|
219
|
+
|
|
220
|
+
.tarjeta--lightest-gray
|
|
221
|
+
border: 3px solid #dce4eb
|
|
222
|
+
</style>
|