Добавлены рабочий счетчик ставшегося времени, форма отправки(голоса считаются) нет блокировки голосования, проценты не считаются, нет предупреждений о выборе кандидата )
This commit is contained in:
1 parent
db025fe7f7
commit
31aa6429dd
6 files changed
+180
-70
No files matched your search
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<v-card color="teal-darken-1" width="420" height="150" elevation="24">
|
||||
<v-card-title>До конца голосования осталось:</v-card-title>
|
||||
<div class="card-count">{{ displayDays }}:{{ displayHours }}:{{ displayMinutes }}</div>
|
||||
<span class="card-sub-title ">дней : часов : минут</span>
|
||||
</v-card>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
displayDays: 0,
|
||||
displayHours: 0,
|
||||
displayMinutes: 0
|
||||
}),
|
||||
|
||||
computed: {
|
||||
_seconds: () => 1000,
|
||||
_minutes() {
|
||||
return this._seconds * 60
|
||||
},
|
||||
_hours() {
|
||||
return this._minutes * 60
|
||||
},
|
||||
_days() {
|
||||
return this._hours * 24
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.countDown();
|
||||
},
|
||||
|
||||
methods: {
|
||||
countDown() {
|
||||
const timer = setInterval(() => {
|
||||
const now = new Date();
|
||||
// здесь задается конец отчета (гггг, мм, дд, остальные цифры не меняются)
|
||||
const end = new Date(2024, 11 - 1, 21, 10, 10, 10);
|
||||
const distance = end.getTime() - now.getTime();
|
||||
|
||||
if (distance < 0) {
|
||||
clearInterval(timer);
|
||||
return
|
||||
}
|
||||
|
||||
const days = Math.floor(distance / this._days);
|
||||
const hours = Math.floor((distance % this._days) / this._hours);
|
||||
const minutes = Math.floor((distance % this._hours) / this._minutes);
|
||||
|
||||
this.displayMinutes = minutes < 10 ? "0" + minutes : minutes;
|
||||
this.displayHours = minutes < 10 & minutes > 10 ? "0" + hours : hours;
|
||||
this.displayDays = days < 10 ? "0" + days : days;
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.card-count {
|
||||
font-size: 3em;
|
||||
}
|
||||
|
||||
.card-sub-title {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
</style>
|
||||
@@ -1,31 +1,42 @@
|
||||
<template>
|
||||
<v-card height="520">
|
||||
<v-virtual-scroll :items="vote_data" :height="500" :item-height="30">
|
||||
<v-card-text v-for="item in vote_data">
|
||||
<p>{{ item.fio }}</p>
|
||||
</v-card-text>
|
||||
</v-virtual-scroll>
|
||||
</v-card>
|
||||
<v-form @submit="voteSend">
|
||||
<v-card height="520" variant="none">
|
||||
|
||||
<v-virtual-scroll :items="vote_data" :height="500" :item-height="40">
|
||||
<template v-slot:default="{ item }">
|
||||
<v-checkbox id="vote" v-model="vote" :value="item.fio" :label="item.fio"> </v-checkbox>
|
||||
</template>
|
||||
</v-virtual-scroll>
|
||||
|
||||
</v-card>
|
||||
<v-card-actions class="justify-center vote-button-back">
|
||||
<v-btn variant="elevated" color="teal-darken-1" type="submit">ПРОГОЛОСОВАТЬ</v-btn>
|
||||
</v-card-actions>
|
||||
</v-form>
|
||||
</template>
|
||||
<script>
|
||||
<script scope>
|
||||
import { ref } from "vue";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
|
||||
export default {
|
||||
|
||||
props: ['type_fetch'],
|
||||
setup(props) {
|
||||
let account_login = useAccountStore().user.login;
|
||||
let department_id = useAccountStore().user.id_dict_department;
|
||||
let type_fetch = props.type_fetch;
|
||||
let vote = ref();
|
||||
let get_address = ref();
|
||||
let send_address = ref();
|
||||
let vote_data = ref([]);
|
||||
|
||||
|
||||
if (type_fetch == "thn") {
|
||||
get_address = `api/vote/get_for_thn/?login=${account_login}`;
|
||||
send_address = `api/vote/setthanks/`;
|
||||
} else if (type_fetch == "bst") {
|
||||
get_address = `api/vote/get_for_bst/?login=${account_login}&dep=${department_id}`;
|
||||
send_address = `api/vote/setbest/`;
|
||||
}
|
||||
|
||||
const getVotesData = () => {
|
||||
@@ -34,15 +45,30 @@ export default {
|
||||
});
|
||||
};
|
||||
|
||||
const voteSend = () => {
|
||||
clearAxios.post(send_address, {
|
||||
cand_name_id: vote.value,
|
||||
voted_user: account_login
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
getVotesData();
|
||||
return {
|
||||
voteSend,
|
||||
vote_data,
|
||||
vote,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
@@ -1,19 +1,31 @@
|
||||
<template>
|
||||
<v-row justify="center" align="center">
|
||||
|
||||
<v-row justify="center" class="d-flex align-start h-100">
|
||||
<v-col cols="12" class="h-15 d-flex justify-center proc-count_cell">
|
||||
<v-col justify="center" align="center" cols="2">
|
||||
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
|
||||
<span>45%</span>
|
||||
</v-card>
|
||||
</v-col>
|
||||
<v-col justify="center" align="center" cols="4" class="vote-cards_cell ">
|
||||
<count-down />
|
||||
</v-col>
|
||||
<v-col justify="center" align="center" cols="2">
|
||||
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
|
||||
<span>55%</span>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-col>
|
||||
<!-- Голосование Лучший сотрудник -->
|
||||
<v-col justify="center" align="center">
|
||||
<div class="flip-card" :class="{ 'flipped': isFlipped1 }">
|
||||
<div class="flip-card-inner">
|
||||
<div class="flip-card-front">
|
||||
<!-- Передняя сторона карточки -->
|
||||
<v-card class="justify-center elevation-24" image="@/assets/best_employee.jpg" width="500"
|
||||
<v-card class="justify-center elevation-24 " image="@/assets/best_employee.jpg" width="500"
|
||||
height="700" variant="elevated">
|
||||
|
||||
<v-card-title class="vote-card-title">
|
||||
ЛУЧШИЙ СОТРУДНИК
|
||||
«МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ»
|
||||
</v-card-title>
|
||||
|
||||
<!-- Кнопка активации поворота -->
|
||||
<v-card-actions class="justify-center vote-button">
|
||||
<v-btn size="x-large" @click="toggleFlip1" variant="elevated" color="teal-darken-1"
|
||||
@@ -21,24 +33,18 @@
|
||||
ГОЛОС!</v-btn>
|
||||
</v-card-actions>
|
||||
<!-- Кнопка активации поворота КОНЕЦ-->
|
||||
|
||||
</v-card>
|
||||
</div>
|
||||
|
||||
<!-- Передняя сторона карточки КОНЕЦ-->
|
||||
|
||||
|
||||
<div class="flip-card-back">
|
||||
<!-- Задняя сторона карточки -->
|
||||
<v-card class="justify-center elevation-24" width="500" height="700">
|
||||
|
||||
<v-card-title>
|
||||
Лучший сотрудник
|
||||
«МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ»
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<vote-form :type_fetch="'bst'" />
|
||||
</v-card-text>
|
||||
|
||||
<!-- Кнопка активации поворота -->
|
||||
<v-card-actions class="justify-center vote-button-back">
|
||||
<v-btn @click="toggleFlip1" variant="elevated" color="teal-darken-1"
|
||||
@@ -50,11 +56,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Задняя сторона карточки КОНЕЦ-->
|
||||
|
||||
</v-col>
|
||||
<!-- Голосование Лучший сотрудник КОНЕЦ-->
|
||||
|
||||
|
||||
<!-- Голосование Спасибо -->
|
||||
<v-col justify="center" align="center">
|
||||
<div class="flip-card" :class="{ 'flipped': isFlipped2 }">
|
||||
@@ -63,62 +66,53 @@
|
||||
<!-- Передняя сторона карточки -->
|
||||
<v-card class="justify-center elevation-24" image="@/assets/thanks.jpeg" width="500" height="700"
|
||||
variant="elevated">
|
||||
|
||||
<v-card-title class="vote-card-title">
|
||||
СПАСИБО!
|
||||
«ХОЧУ СКАЗАТЬ СПАСИБО!»
|
||||
</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-btn>
|
||||
</v-card-actions>
|
||||
<!-- Кнопка активации поворота КОНЕЦ-->
|
||||
|
||||
</v-card>
|
||||
</div>
|
||||
<!-- Передняя сторона карточки КОНЕЦ-->
|
||||
|
||||
<!-- Задняя сторона карточки -->
|
||||
<div class="flip-card-back">
|
||||
<v-card class="justify-center elevation-24" width="500" height="700" variant="elevated">
|
||||
|
||||
<v-card-title>
|
||||
СПАСИБО
|
||||
«ХОЧУ СКАЗАТЬ СПАСИБО!»
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
|
||||
<vote-form :type_fetch="'thn'" />
|
||||
|
||||
</v-card-text>
|
||||
|
||||
<!-- Кнопка активации поворота -->
|
||||
<v-card-actions class="justify-center vote-button-back">
|
||||
<v-btn @click="toggleFlip2" variant="elevated" color="teal-darken-1"
|
||||
type="button">назад</v-btn>
|
||||
</v-card-actions>
|
||||
<!-- Кнопка активации поворота КОНЕЦ-->
|
||||
|
||||
</v-card>
|
||||
</div>
|
||||
|
||||
<!-- Задняя сторона карточки КОНЕЦ-->
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<!-- Голосование Спасибо КОНЕЦ-->
|
||||
|
||||
<!-- Голосование Спасибо КОНЕЦ-->
|
||||
</v-row>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import VoteForm from '@/components/VoteForm.vue';
|
||||
import CountDown from '@/components/CountDown.vue';
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
VoteForm,
|
||||
CountDown,
|
||||
},
|
||||
|
||||
setup() {
|
||||
@@ -182,10 +176,22 @@ export default {
|
||||
}
|
||||
|
||||
.vote-button {
|
||||
margin-top: 580px;
|
||||
margin-top: 572px;
|
||||
}
|
||||
|
||||
.vote-button-back {
|
||||
margin-top: 10%;
|
||||
.vote-cards_cell {
|
||||
height: 14% !important;
|
||||
}
|
||||
|
||||
.proc-count_cell {
|
||||
height: 18% !important;
|
||||
}
|
||||
|
||||
.procent-card-font {
|
||||
font-size: 4em;
|
||||
}
|
||||
|
||||
.card-count {
|
||||
font-size: 4em;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user