fix [P-272]: консоль больше не плачет

This commit is contained in:
Denis Voinovich committed 2025-06-18 07:50:50 +03:00
1 parent 1a67d4cb80
commit 04b3d9298e
3 files changed
+25 -11

No files matched your search

@@ -1,6 +1,7 @@
<!-- Раздел с назначенным тестированием --> <!-- Раздел с назначенным тестированием -->
<template> <template>
<!-- <div class="my-4 text-h5 font-weight-medium">{{ title }}</div> --> <!-- <div class="my-4 text-h5 font-weight-medium">{{ title }}</div> -->
<div :class="containerClass">
<v-container :fluid="true"> <v-container :fluid="true">
<v-row> <v-row>
<v-text-field <v-text-field
@@ -80,6 +81,7 @@
</v-card-title> </v-card-title>
</v-row> </v-row>
</v-container> </v-container>
</div>
</template> </template>
<script> <script>
@@ -103,9 +105,16 @@ export default {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
class: {
type: [String, Object, Array],
default: '',
},
}, },
setup(props) { setup(props) {
const search = ref(''); const search = ref('');
// Create a computed property to handle the containerClass
const containerClass = computed(() => props.class);
const searchTest = computed(() => { const searchTest = computed(() => {
let filteredTests = props.testingCard; let filteredTests = props.testingCard;
@@ -169,7 +178,7 @@ export default {
return text.replace(/\r?\n/g, '<br>'); return text.replace(/\r?\n/g, '<br>');
}; };
return { search, searchTest, momenter, activeTabIcon, baseURL, formatDescription, defaultImage }; return { search, searchTest, momenter, activeTabIcon, baseURL, formatDescription, defaultImage, containerClass };
}, },
}; };
</script> </script>
@@ -227,11 +227,15 @@ export default {
const answers = ref([]); const answers = ref([]);
watch(data.value?.questions, (newData) => { watch(
if (newData && Array.isArray(newData.questions)) { () => data.value?.questions,
answers.value = newData.questions.map(() => null); (newQuestions) => {
} if (newQuestions && Array.isArray(newQuestions)) {
}); answers.value = newQuestions.map(() => null);
}
},
{ deep: true }
);
const correctAnswers = computed( const correctAnswers = computed(
() => () =>
@@ -588,9 +588,9 @@ export default {
}; };
watch( watch(
form.value, () => form.value,
() => { (formValue) => {
if (!form.value.title || !form.value.description || form.value.questions.length < 1) { if (!formValue.title || !formValue.description || formValue.questions.length < 1) {
errorMessage.value = 'Все обязательные поля должны быть заполнены'; errorMessage.value = 'Все обязательные поля должны быть заполнены';
} else { } else {
errorMessage.value = ''; errorMessage.value = '';
@@ -602,7 +602,6 @@ export default {
watch( watch(
() => form.value.questions, () => form.value.questions,
(newQuestions) => { (newQuestions) => {
quests.value = newQuestions.map((q) => !!q.text.trim());
const hasEmptyQuestions = newQuestions.some((q) => !q.text || q.text.trim() === ''); const hasEmptyQuestions = newQuestions.some((q) => !q.text || q.text.trim() === '');
const hasInvalidAnswers = validateAnswers(); const hasInvalidAnswers = validateAnswers();
@@ -686,11 +685,13 @@ export default {
testImage, testImage,
imagePreview, imagePreview,
previewImage, previewImage,
handleTestImageUpload,
getImagePreviewUrl, getImagePreviewUrl,
actualQuestionCount, actualQuestionCount,
actualTestQuestionCount, actualTestQuestionCount,
isTest: props.isTest, isTest: props.isTest,
imageError imageError,
validateImage
}; };
}, },
}; };