fix [P-272]: консоль больше не плачет
This commit is contained in:
1 parent
1a67d4cb80
commit
04b3d9298e
3 files changed
+25
-11
No files matched your search
@@ -1,6 +1,7 @@
|
||||
<!-- Раздел с назначенным тестированием -->
|
||||
<template>
|
||||
<!-- <div class="my-4 text-h5 font-weight-medium">{{ title }}</div> -->
|
||||
<div :class="containerClass">
|
||||
<v-container :fluid="true">
|
||||
<v-row>
|
||||
<v-text-field
|
||||
@@ -80,6 +81,7 @@
|
||||
</v-card-title>
|
||||
</v-row>
|
||||
</v-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -103,9 +105,16 @@ export default {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
class: {
|
||||
type: [String, Object, Array],
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const search = ref('');
|
||||
|
||||
// Create a computed property to handle the containerClass
|
||||
const containerClass = computed(() => props.class);
|
||||
|
||||
const searchTest = computed(() => {
|
||||
let filteredTests = props.testingCard;
|
||||
@@ -169,7 +178,7 @@ export default {
|
||||
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>
|
||||
|
||||
@@ -227,11 +227,15 @@ export default {
|
||||
|
||||
const answers = ref([]);
|
||||
|
||||
watch(data.value?.questions, (newData) => {
|
||||
if (newData && Array.isArray(newData.questions)) {
|
||||
answers.value = newData.questions.map(() => null);
|
||||
}
|
||||
});
|
||||
watch(
|
||||
() => data.value?.questions,
|
||||
(newQuestions) => {
|
||||
if (newQuestions && Array.isArray(newQuestions)) {
|
||||
answers.value = newQuestions.map(() => null);
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
||||
const correctAnswers = computed(
|
||||
() =>
|
||||
|
||||
@@ -588,9 +588,9 @@ export default {
|
||||
};
|
||||
|
||||
watch(
|
||||
form.value,
|
||||
() => {
|
||||
if (!form.value.title || !form.value.description || form.value.questions.length < 1) {
|
||||
() => form.value,
|
||||
(formValue) => {
|
||||
if (!formValue.title || !formValue.description || formValue.questions.length < 1) {
|
||||
errorMessage.value = 'Все обязательные поля должны быть заполнены';
|
||||
} else {
|
||||
errorMessage.value = '';
|
||||
@@ -602,7 +602,6 @@ export default {
|
||||
watch(
|
||||
() => form.value.questions,
|
||||
(newQuestions) => {
|
||||
quests.value = newQuestions.map((q) => !!q.text.trim());
|
||||
|
||||
const hasEmptyQuestions = newQuestions.some((q) => !q.text || q.text.trim() === '');
|
||||
const hasInvalidAnswers = validateAnswers();
|
||||
@@ -686,11 +685,13 @@ export default {
|
||||
testImage,
|
||||
imagePreview,
|
||||
previewImage,
|
||||
handleTestImageUpload,
|
||||
getImagePreviewUrl,
|
||||
actualQuestionCount,
|
||||
actualTestQuestionCount,
|
||||
isTest: props.isTest,
|
||||
imageError
|
||||
imageError,
|
||||
validateImage
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user