feat [P-227]: множественный выбор на основе числа верных ответов
This commit is contained in:
1 parent
cd6c8d9273
commit
0d0e287eba
2 files changed
+22
-7
No files matched your search
@@ -16,9 +16,13 @@
|
|||||||
</p>
|
</p>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions class="mx-2 my-4">
|
<v-card-actions class="mx-2 my-4">
|
||||||
<p>Попытка 1 из {{ data?.attemps_number }}</p>
|
<p v-if="isExamMode">Попытка 1 из {{ data?.attemps_number }}</p>
|
||||||
<v-btn color="white" class="ml-auto bg-teal-darken-1 px-9" @click="startTest">
|
<v-btn
|
||||||
Начать
|
color="white"
|
||||||
|
class="ml-auto bg-teal-darken-1 px-9"
|
||||||
|
@click="startTest"
|
||||||
|
>
|
||||||
|
{{ isExamMode ? 'Начать' : 'Тренироваться' }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -28,10 +32,21 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
startTest: Function,
|
startTest: Function,
|
||||||
data: Object,
|
data: Object,
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const route = useRoute();
|
||||||
|
const isExamMode = computed(() => route.query.mode === 'exam');
|
||||||
|
|
||||||
|
return {
|
||||||
|
isExamMode
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -96,10 +96,10 @@ export default {
|
|||||||
answers: Array,
|
answers: Array,
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
// Определяем, является ли вопрос с множественным выбором
|
const isMultipleChoice = computed(() => {
|
||||||
const isMultipleChoice = computed(() => props.question.settings?.multiply === 'true');
|
return props.question.answers.filter(answer => answer.right_wrong).length > 1;
|
||||||
|
});
|
||||||
|
|
||||||
// Следим за изменением текущего вопроса и создаем пустой массив, если множественный выбор
|
|
||||||
watch(
|
watch(
|
||||||
() => props.currentQuestion,
|
() => props.currentQuestion,
|
||||||
(newVal) => {
|
(newVal) => {
|
||||||
@@ -107,7 +107,7 @@ export default {
|
|||||||
props.answers[newVal] = [];
|
props.answers[newVal] = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true }, // Устанавливаем сразу при инициализации
|
{ immediate: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user