From fdd28a200c6613239e672b9bef19688664998961 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 14 Jan 2025 14:20:01 +0300 Subject: [PATCH 01/12] fix --- src/back/vote/views.py | 2 +- src/front/src/views/VoteHomePage.vue | 25 +++++++------------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/back/vote/views.py b/src/back/vote/views.py index d432cdeec..1cf911a92 100644 --- a/src/back/vote/views.py +++ b/src/back/vote/views.py @@ -68,7 +68,7 @@ class VoteCreate(APIView): def post(self, request): try: vote = self.create_vote(request) - self.create_news(request) + # self.create_news(request) return Response({'status': 'success', 'message': 'Vote and news created successfully.'}, status=200) except Exception as e: return Response({'status': 'error', 'message': str(e)}, status=400) diff --git a/src/front/src/views/VoteHomePage.vue b/src/front/src/views/VoteHomePage.vue index b62d46ac8..a7c9c3c6c 100644 --- a/src/front/src/views/VoteHomePage.vue +++ b/src/front/src/views/VoteHomePage.vue @@ -17,7 +17,7 @@ - + @@ -29,7 +29,7 @@ - + {{ voting.title }} @@ -102,7 +102,7 @@ \ No newline at end of file From 3bab6ea1e12f48f2ad604870b5942307d1e473da Mon Sep 17 00:00:00 2001 From: Nukeap <53114367+Nukeap@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:06:12 +0300 Subject: [PATCH 08/12] tt --- src/front/src/components/{secret/TimerUI.vue => UI/Timer.vue} | 0 src/front/src/components/vote/VoteCard.vue | 4 ++-- src/front/src/views/VoteHomePage.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/front/src/components/{secret/TimerUI.vue => UI/Timer.vue} (100%) diff --git a/src/front/src/components/secret/TimerUI.vue b/src/front/src/components/UI/Timer.vue similarity index 100% rename from src/front/src/components/secret/TimerUI.vue rename to src/front/src/components/UI/Timer.vue diff --git a/src/front/src/components/vote/VoteCard.vue b/src/front/src/components/vote/VoteCard.vue index c7c944a3a..b8e528c64 100644 --- a/src/front/src/components/vote/VoteCard.vue +++ b/src/front/src/components/vote/VoteCard.vue @@ -38,11 +38,11 @@ diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index d14a6a835..22db34b8e 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -93,22 +93,6 @@ async function getVotes(status) { } } -// getVotes('completed') -// .then(data => { -// console.log('Завершённые голосования:', data); -// }) -// .catch(err => { -// console.error('Ошибка:', err); -// }); - -// getVotes('active') -// .then(data => { -// console.log('Активные голосования:', data); -// }) -// .catch(err => { -// console.error('Ошибка:', err); -// }); - async function createVote(voteData, files) { try { const formData = new FormData(); From a132144cf814ac9fc4489015e4ae8efb10389cd4 Mon Sep 17 00:00:00 2001 From: Nukeap <53114367+Nukeap@users.noreply.github.com> Date: Wed, 15 Jan 2025 15:19:44 +0300 Subject: [PATCH 10/12] =?UTF-8?q?=D0=B9=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/back/vote/admin.py | 1 + src/front/src/components/vote/CurrentVote.vue | 53 +++++++++++-------- src/front/src/components/vote/VoteCard.vue | 2 +- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/back/vote/admin.py b/src/back/vote/admin.py index 529e46caa..19a39c4cc 100644 --- a/src/back/vote/admin.py +++ b/src/back/vote/admin.py @@ -3,3 +3,4 @@ from .models import * admin.site.register(Vote) admin.site.register(Question) +admin.site.register(Answer) \ No newline at end of file diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index 5c5732f6d..e87dba85f 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -3,39 +3,40 @@ {{ data.name }} {{ data.description }} - + {{ data }} - Вопрос {{ index + 1 }} + Вопрос {{ question.numb }} {{ question.question }} + + {{ result }}-- - + @@ -94,9 +95,15 @@ export default { const isVoteSubmitted = ref(false); const isCurrentQuestionAnswered = computed(() => { - return !!answers.value[activeStep.value]; + let q = props.data.questions.find(e=>e.numb==activeStep.value+1) + return result.value[q.id].length>0; }); - + const getres=()=>{ + return props.data.questions.reduce((acc,item)=> {acc[item.id]=[] + return acc + },{}) + } + const result=ref(getres()) const nextStep = () => { if (activeStep.value < props.data.questions.length - 1) { activeStep.value++; @@ -110,14 +117,15 @@ export default { }; const submitVote = () => { - const voteData = props.data.questions.map((question, index) => ({ - question: question.question, - answer: answers.value[index], - })); - console.log("Отправляем данные голосования:", voteData); + // const voteData = props.data.questions.map((question, index) => ({ + // question: question.id, + // answer: answers.value[index], + // })); + result.value + console.log("Отправляем данные голосования:", result.value); - isVoteSubmitted.value = true; - emit("submit", voteData); + // isVoteSubmitted.value = true; + // emit("submit", voteData); }; return { @@ -128,6 +136,7 @@ export default { prevStep, submitVote, isVoteSubmitted, + result }; }, }; diff --git a/src/front/src/components/vote/VoteCard.vue b/src/front/src/components/vote/VoteCard.vue index b8e528c64..fdb5b9bd9 100644 --- a/src/front/src/components/vote/VoteCard.vue +++ b/src/front/src/components/vote/VoteCard.vue @@ -17,7 +17,7 @@ {{ voteCard.description }} - + Date: Wed, 15 Jan 2025 15:42:47 +0300 Subject: [PATCH 11/12] Update VoteConstructor.vue --- src/front/src/components/vote/VoteConstructor.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 835be72cc..8d59d9f32 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -60,6 +60,7 @@ hide-weekdays title="дата окончания" /> + { + updateEndDate() }) @@ -370,7 +372,8 @@ export default { form.value.startDate.setHours(hours, minutes); }; const updateEndDate = () => { - const [hours, minutes] = selectedTimeStart.value.split(":").map(Number); + const [hours, minutes] = selectedTimeEnd.value.split(":").map(Number); + console.log( form.value.endDate); form.value.endDate.setHours(hours, minutes); }; From ff09b656c05d1f2f02b6f26d2ac1fd1ee9e65659 Mon Sep 17 00:00:00 2001 From: Denzel Date: Wed, 15 Jan 2025 16:09:42 +0300 Subject: [PATCH 12/12] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=BE?= =?UTF-8?q?=D0=BB=D0=BE=D1=81=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/UI/date-select.vue | 16 ++++----- .../src/components/vote/VoteConstructor.vue | 36 +++++++++---------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/front/src/components/UI/date-select.vue b/src/front/src/components/UI/date-select.vue index 5193c5929..4628ca6fd 100644 --- a/src/front/src/components/UI/date-select.vue +++ b/src/front/src/components/UI/date-select.vue @@ -19,14 +19,14 @@ density="compact" v-bind="props" > - @@ -37,8 +37,6 @@ hide-header @update:modelValue="dateStart" border - :max="formatDash(new Date())" - :min="formatDash(appStore.countvisitor.visitdate)" /> @@ -59,14 +57,14 @@ export default { } }, - + setup(props, {emit}) { const appStore = useAppStore() const maxdate = formatDash(new Date()) const menudate = ref(false) const selectedDate = ref(null) - + const dateStart = () => { emit('returndate', selectedDate.value) menudate.value=false @@ -102,4 +100,4 @@ export default { .v-field__prepend-inner { align-items: center!important; } - \ No newline at end of file + diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 8d59d9f32..0565f6d5d 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -36,14 +36,9 @@ outlined > -
- +
Дата начала:
+
- - +
Дата окончания:
+
-
- -
начало {{ form.startDate }}
-
окончание {{ form.endDate }}
@@ -242,8 +228,10 @@