This commit is contained in:
Nukeap committed 2025-01-22 16:46:37 +03:00
1 parent e6eac9f982
commit 2dcec97731
2 files changed
+12 -3

No files matched your search

@@ -42,12 +42,15 @@
<span>{{ voteCard.description }}</span> <span>{{ voteCard.description }}</span>
</v-tooltip> </v-tooltip>
</v-card-text> </v-card-text>
<div class="px-2">
<Timer v-if="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }" <Timer v-if="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
@changeBtn="(time) => timeChange = time"/> @changeBtn="(time) => timeChange = time"/>
<div v-else class="font-weight-bold text-center"> Завершено: {{ <div v-else class="font-weight-bold text-center"> Завершено: {{
new Date(voteCard.dateend).toLocaleDateString() new Date(voteCard.dateend).toLocaleDateString()
}} }}
</div> </div>
</div>
<v-card-actions class="justify-space-between mt-4 pb-2"> <v-card-actions class="justify-space-between mt-4 pb-2">
<template v-if="!isFinished"> <template v-if="!isFinished">
<v-btn :disabled="voteCard.is_passed || timeChange" color="teal-darken-4" prepend-icon="mdi-vote-outline" <v-btn :disabled="voteCard.is_passed || timeChange" color="teal-darken-4" prepend-icon="mdi-vote-outline"
+9 -3
View File
@@ -6,9 +6,13 @@
v-model="currentTab" v-model="currentTab"
align="center"> align="center">
<v-tab v-for="x in tabs" :key="x.value" :value="x.value">{{ x.text }}</v-tab> <v-tab v-for="x in tabs" :key="x.value" :value="x.value">{{ x.text }}</v-tab>
<v-tab v-if="accountStore.user.is_staff" value="constructor">Создать новое голосование</v-tab>
</v-tabs> </v-tabs>
</v-col> </v-col>
<v-col class="pa-0 overflow-hidden"> <v-col class="pa-0 overflow-hidden">
<v-window v-model="currentTab" class="h-100"> <v-window v-model="currentTab" class="h-100">
<!-- Текущие голосования --> <!-- Текущие голосования -->
<v-tabs-window-item v-for="x in ['active','completed']" :value="x" class="h-100 overflow-auto"> <v-tabs-window-item v-for="x in ['active','completed']" :value="x" class="h-100 overflow-auto">
@@ -31,7 +35,7 @@
</v-row> </v-row>
</v-tabs-window-item> </v-tabs-window-item>
<!-- Конструктор --> <!-- Конструктор -->
<v-tabs-window-item class="h-100 overflow-auto" value="constructor"> <v-tabs-window-item v-if="accountStore.user.is_staff" class="h-100 overflow-auto" value="constructor">
<VoteConstructor @updating="updating"/> <VoteConstructor @updating="updating"/>
</v-tabs-window-item> </v-tabs-window-item>
</v-window> </v-window>
@@ -63,16 +67,17 @@ import {useRoute, useRouter} from "vue-router";
import VoteResult from "@/components/vote/VoteResult.vue"; import VoteResult from "@/components/vote/VoteResult.vue";
import {deleteVote, getVoteDetail, getVoteResult, getVotes} from "@/utils/axios-api"; import {deleteVote, getVoteDetail, getVoteResult, getVotes} from "@/utils/axios-api";
import {formatDate} from "@vueuse/shared"; import {formatDate} from "@vueuse/shared";
import { useAccountStore } from "@/store/AccountStore";
export default { export default {
methods: {formatDate}, methods: {formatDate},
components: {CurrentVote, VoteConstructor, VoteCardVue, VoteResult}, components: {CurrentVote, VoteConstructor, VoteCardVue, VoteResult},
setup() { setup() {
const accountStore = useAccountStore();
const tabs = [ const tabs = [
{value: "active", text: 'Текущие голосования'}, {value: "active", text: 'Текущие голосования'},
{value: "completed", text: 'Завершенные голосования'}, {value: "completed", text: 'Завершенные голосования'},
{value: "constructor", text: 'Создать новое голосование'},
] ]
const currentTab = ref("active"); const currentTab = ref("active");
@@ -173,6 +178,7 @@ export default {
updating("active"); updating("active");
return { return {
accountStore,
currentTab, currentTab,
votes, votes,
sortedVotes, sortedVotes,