refactor [P-36 УМТ]: страница конкретного теста

This commit is contained in:
Denzel committed 2025-02-17 16:46:38 +03:00
1 parent 52625d4992
commit 4e13d9f547
2 files changed
+14 -23

No files matched your search

@@ -21,6 +21,7 @@
:currentQuestion="currentQuestion"
:totalQuestions="data.question_count"
:answers="answers"
:finishTest="openFinishDialog"
@change-question="changeQuestion"
/>
@@ -73,26 +74,6 @@ export default {
console.log(data.value);
};
const questions = ref([
{
question: 'Ваши родители знают что Вы гей?',
options: ['Да', 'Нет'],
correct: 'Да',
},
{
question: 'Какой цвет у неба?',
options: ['Синий', 'Зеленый', 'Красный', 'Желтый'],
correct: 'Синий',
},
{ question: 'Сколько дней в неделе?', options: ['5', '6', '7', '8'], correct: '7' },
{
question: 'Как называется столица Франции?',
options: ['Берлин', 'Париж', 'Лондон', 'Рим'],
correct: 'Париж',
},
{ question: 'Сколько ног у паука?', options: ['4', '6', '8', '10'], correct: '8' },
]);
const formattedTime = computed(() => {
if (!data.value?.time) return '00:00';
@@ -175,7 +156,6 @@ export default {
formattedTime,
startTest,
finishTest,
questions,
answers,
currentQuestion,
changeQuestion,
@@ -1,5 +1,5 @@
<template>
<v-card class="mt-4 w-75 mx-auto">
<v-card class="mt-4 w-75 mx-auto h-50 d-flex flex-lg-column">
<v-card-title class="text-h6 font-weight-bold">
Вопрос {{ currentQuestion + 1 }} из {{ totalQuestions }}
</v-card-title>
@@ -22,12 +22,22 @@
Назад
</v-btn>
<v-btn
:disabled="currentQuestion === totalQuestions - 1"
v-if="currentQuestion !== totalQuestions - 1"
color="teal-darken-1"
@click="$emit('change-question', currentQuestion + 1)"
>
Далее
</v-btn>
<v-btn
v-if="currentQuestion === totalQuestions - 1"
elevation="0"
color="white"
rounded="lg"
class="bg-teal-darken-1"
@click="finishTest"
>
Завершить
</v-btn>
</v-card-actions>
</v-card>
</template>
@@ -38,6 +48,7 @@ export default {
question: Object,
currentQuestion: Number,
totalQuestions: Number,
finishTest: Function,
answers: Array,
},
emits: ['change-question'],