From 04b3d9298ea35a8e318e5c1cd9cb33d2cb7a26a8 Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Wed, 18 Jun 2025 07:50:50 +0300 Subject: [PATCH] =?UTF-8?q?fix=20[P-272]:=20=D0=BA=D0=BE=D0=BD=D1=81=D0=BE?= =?UTF-8?q?=D0=BB=D1=8C=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=BB=D0=B0=D1=87=D0=B5=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/testing/CatalogTest.vue | 11 ++++++++++- .../src/components/testing/DetailCardTest.vue | 14 +++++++++----- src/front/src/components/vote/VoteConstructor.vue | 11 ++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/front/src/components/testing/CatalogTest.vue b/src/front/src/components/testing/CatalogTest.vue index 1ed17fb9c..73a385fcc 100644 --- a/src/front/src/components/testing/CatalogTest.vue +++ b/src/front/src/components/testing/CatalogTest.vue @@ -1,6 +1,7 @@ diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue index 1d578e7a3..ebafeff62 100644 --- a/src/front/src/components/testing/DetailCardTest.vue +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -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( () => diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index adcfd1bc7..04620f8eb 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -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 }; }, };