Приложение голосование сделано!

This commit is contained in:
Andrei Filippov committed 2024-11-01 11:48:49 +03:00
1 parent e3661db5cb
commit 2108058a6b
5 files changed
+83 -26

No files matched your search

+22 -13
View File
@@ -10,26 +10,26 @@
<v-card-title>Процент проголосовавших</v-card-title>
</v-card>
<v-card elevation="0">
<v-card-text>
<v-card-text class="perc-voted">
{{ perc_bst }}%
</v-card-text>
</v-card>
<v-card color="teal-darken-1" class="ma-2">
<v-card color="teal-darken-1" class="mb-2">
<v-card-title>Лидер номинации</v-card-title>
</v-card>
<v-card v-for="(employees, department) in max_bst" :key="department" elevation="0">
<v-card-title>{{ department }}</v-card-title>
<v-card-text>
<v-card class="scroll-leaders" elevation="0">
<v-card v-for="(employees, department) in max_bst" :key="department" elevation="0">
<v-card-title>{{ department }}</v-card-title>
<div v-for="employee in employees" :key="employee.name">
{{ employee.name }}
</div>
</v-card-text>
</v-card>
</v-card>
<v-card color="teal-darken-1" class="ma-2">
<v-card-title>ФИО не участвовавших в голосовании</v-card-title>
</v-card>
<v-card elevation="0">
<v-card id="scroll-window" elevation="0">
<v-card class="scroll-window" elevation="0">
<v-card v-for="[key, val] of Object.entries(result_bst)">
<v-card-title>{{ key }}</v-card-title>
<div v-for="item_fio in val">
@@ -51,14 +51,14 @@
<v-card-title>Процент проголосовавших</v-card-title>
</v-card>
<v-card elevation="0">
<v-card-text>
<v-card-text class="perc-voted">
<perc-thn />
</v-card-text>
</v-card>
<v-card color="teal-darken-1" class="ma-2">
<v-card color="teal-darken-1" class="mb-2">
<v-card-title>Лидер номинации</v-card-title>
</v-card>
<v-card elevation="0">
<v-card class="scroll-leaders pt-4" elevation="0">
<div v-for="leader in max_thn">
{{ leader }}
</div>
@@ -66,7 +66,7 @@
<v-card color="teal-darken-1" class="ma-2">
<v-card-title>ФИО не участвовавших в голосовании</v-card-title>
</v-card>
<v-card id="scroll-window" elevation="0">
<v-card class="scroll-window" elevation="0">
<v-card v-for="[key, val] of Object.entries(result_thn)">
<v-card-title>{{ key }}</v-card-title>
<div v-for="item_fio in val">
@@ -176,8 +176,17 @@ export default {
margin-left: 10%;
}
#scroll-window {
.scroll-leaders {
overflow-y: scroll;
height: 400px;
height: 95px;
}
.scroll-window {
overflow-y: scroll;
height: 378px;
}
.perc-voted {
font-size: 1.2em;
}
</style>
+8 -3
View File
@@ -1,8 +1,8 @@
<template>
<v-form @submit="voteSend">
<v-card height="520" variant="none">
<v-card id="scroll-window-chekbox" height="520" elevation="0">
<!-- Форма голосования -->
<v-virtual-scroll :items="vote_data" :height="500" :item-height="40">
<v-virtual-scroll :items="vote_data" :item-height="40">
<template v-slot:default="{ item }">
<v-checkbox v-model="vote" :id="item.fio" :value="item.fio" :label="item.fio" />
</template>
@@ -103,4 +103,9 @@ export default {
}
</script>
<style></style>
<style>
#scroll-window-chekbox {
overflow-y: scroll !important;
height: 400px;
}
</style>
+49 -4
View File
@@ -28,9 +28,13 @@
</v-card-title>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button">
<v-btn size="x-large" @click="toggleFlip1" variant="elevated" color="teal-darken-1"
<v-card-title class="you-voted" v-if="voted_bst">
<div>Вы уже проголосовали!</div>
</v-card-title>
<v-btn v-else size="x-large" @click="toggleFlip1" variant="elevated" color="teal-darken-1"
type="button">ОТДАТЬ
ГОЛОС!</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
@@ -58,7 +62,7 @@
<!-- Задняя сторона карточки КОНЕЦ-->
</v-col>
<!-- Голосование Лучший сотрудник КОНЕЦ-->
<v-col cols="2" v-if="admin_panel" justify="center" align="center">
<v-col class="w-15" cols="2" v-if="admin_panel" justify="center" align="center">
<v-dialog>
<template v-slot:activator="{ props: VoteAdmin }">
<v-btn variant="elevated" v-bind="VoteAdmin" color="teal-darken-1">ИНФОРМАЦИЯ О ХОДЕ <br>
@@ -92,7 +96,11 @@
</v-card-title>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button">
<v-btn size="x-large" @click="toggleFlip2" variant="elevated" color="teal-darken-1">ОТДАТЬ
<v-card-title class="you-voted" v-if="voted_thn">
<div>Вы уже проголосовали!</div>
</v-card-title>
<v-btn v-else size="x-large" @click="toggleFlip2" variant="elevated"
color="teal-darken-1">ОТДАТЬ
ГОЛОС!</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
@@ -126,6 +134,7 @@
</template>
<script>
import { ref } from "vue";
import { clearAxios } from "@/utils/axios-api";
import VoteForm from '@/components/vote/VoteForm.vue';
import PercBst from '@/components/vote/PercBst.vue';
import PercThn from '@/components/vote/PercThn.vue';
@@ -137,6 +146,7 @@ let account_login = useAccountStore().user.login;
export default {
components: {
VoteForm,
CountDown,
@@ -147,10 +157,36 @@ export default {
setup() {
let votedListBst = ref([]);
let votedListThn = ref([]);
let voted_thn = ref(false);
let voted_bst = ref(false);
const isFlipped1 = ref(false);
const isFlipped2 = ref(false);
const isVoted = () => {
clearAxios.get(`/api/vote/getthanks/`).then((data) => {
votedListThn = data.data;
let finded_thn = votedListThn.find(({ voted_user }) => voted_user === account_login)
if (finded_thn.voted_user === account_login) {
voted_thn.value = true;
}
});
clearAxios.get(`/api/vote/getbest/`).then((data) => {
votedListBst = data.data;
let finded_bst = votedListBst.find(({ voted_user }) => voted_user === account_login)
if (finded_bst.voted_user === account_login) {
voted_bst.value = true;
}
});
}
const toggleFlip1 = () => {
isFlipped1.value = !isFlipped1.value;
@@ -163,6 +199,7 @@ export default {
admin_panel = true;
}
isVoted();
return {
isFlipped1,
toggleFlip1,
@@ -170,6 +207,8 @@ export default {
toggleFlip2,
account_login,
admin_panel,
voted_bst,
voted_thn,
};
},
};
@@ -212,7 +251,7 @@ export default {
}
.vote-button {
margin-top: 572px;
margin-top: 577px;
}
.vote-cards_cell {
@@ -230,4 +269,10 @@ export default {
.card-count {
font-size: 4em;
}
.you-voted {
background-color: rgba(182, 182, 182, 0.4);
color: #ffff;
border-radius: 5px;
}
</style>