Merge branch 'Alex' into develop

This commit is contained in:
Nukeap committed 2025-01-15 12:12:10 +03:00
commit 40574cc88e
3 files changed
+37 -34

No files matched your search

+23 -20
View File
@@ -1,32 +1,32 @@
<template> <template>
<v-row dense> <v-row class="px-2">
<v-card variant="text" <v-card variant="text"
:disabled="disabledcard.disabled" :disabled="disabledcard.disabled"
class="py-1"> class="py-2 mx-auto">
<v-card-title class="text-body-1"> До {{ disabledcard.text }} голосования осталось: </v-card-title> <v-card-title class="text-body-1"> До {{ disabledcard.text }} голосования осталось: </v-card-title>
<v-row no-gutters dense class="align-baseline justify-center"> <v-row no-gutters class="align-baseline">
<v-col cols="2" class="text-center"> <v-col class="text-center">
<v-card class="bg-yellow-darken-4"> <v-card class="bg-yellow-darken-4">
<div>{{ displayDays }}</div> <div>{{ displayDays }}</div>
</v-card> </v-card>
<span class="text-caption">{{ declOfNum(displayDays, [' день', ' дня', ' дней']) }}</span> <span class="text-caption">{{ declOfNum(displayDays, [' день', ' дня', ' дней']) }}</span>
</v-col> </v-col>
<v-col cols="auto" class="px-1">:</v-col> <v-col cols="auto" class="px-1">:</v-col>
<v-col cols="2" class="text-center"> <v-col class="text-center">
<v-card class="bg-yellow-darken-4"> <v-card class="bg-yellow-darken-4">
<div>{{ displayHours }}</div> <div>{{ displayHours }}</div>
</v-card> </v-card>
<span class="text-caption">{{ declOfNum(displayHours, [' час', ' часа', ' часов']) }}</span> <span class="text-caption">{{ declOfNum(displayHours, [' час', ' часа', ' часов']) }}</span>
</v-col> </v-col>
<v-col cols="auto" class="px-1">:</v-col> <v-col cols="auto" class="px-1">:</v-col>
<v-col cols="2" class="text-center"> <v-col class="text-center">
<v-card class="bg-yellow-darken-4"> <v-card class="bg-yellow-darken-4">
<div>{{ displayMinutes }}</div> <div>{{ displayMinutes }}</div>
</v-card> </v-card>
<span class="text-caption">{{ declOfNum(displayMinutes, [' минута', ' минуты', ' минут']) }}</span> <span class="text-caption">{{ declOfNum(displayMinutes, [' минута', ' минуты', ' минут']) }}</span>
</v-col> </v-col>
<v-col cols="auto" class="px-1">:</v-col> <v-col cols="auto" class="px-1">:</v-col>
<v-col cols="2" class="text-center"> <v-col class="text-center">
<v-card class="bg-yellow-darken-4"> <v-card class="bg-yellow-darken-4">
<div>{{ displaySeconds }}</div> <div>{{ displaySeconds }}</div>
</v-card> </v-card>
@@ -43,13 +43,13 @@ export default {
props: { props: {
voteTime: { voteTime: {
type: Object, type: Object,
default: () => { return {dateend:new Date().setFullYear(), default: () => { return {
datestart:new Date().setFullYear() dateend:new Date().setFullYear(),
}} datestart:new Date().setFullYear()
}}
} }
}, },
setup(props, {emit}) {
setup(props) {
const seconds = 1000 const seconds = 1000
const displayMinutes = ref(0); const displayMinutes = ref(0);
const displayHours = ref(0); const displayHours = ref(0);
@@ -80,15 +80,19 @@ export default {
const dateendorStart = ()=>{ const dateendorStart = ()=>{
let param = 'dateend' let param = 'dateend'
if (new Date().getTime()<new Date(props.voteTime.datestart).getTime()){ if (new Date().getTime() < new Date(props.voteTime.datestart).getTime()) {
param='datestart' param='datestart'
disabledcard.value={text: 'начала', disabledcard.value= {
disabled:true text: 'начала',
disabled: true,
} }
}else{ emit('changeBtn', true)
disabledcard.value={text: 'окончания', } else {
disabled:false disabledcard.value= {
text: 'окончания',
disabled: false,
} }
emit('changeBtn', false)
} }
return param return param
} }
@@ -96,7 +100,6 @@ export default {
function countDown() { function countDown() {
const timer = setInterval(() => { const timer = setInterval(() => {
const date = new Date() const date = new Date()
// console.log(dateendorStart.value);
const distance = new Date(props.voteTime[dateendorStart()]).getTime() - date.getTime() const distance = new Date(props.voteTime[dateendorStart()]).getTime() - date.getTime()
if (distance <= 1) { if (distance <= 1) {
+9 -4
View File
@@ -7,10 +7,10 @@
</v-card-text> </v-card-text>
<v-img cover :src="voteCard.pictures" /> <v-img cover :src="voteCard.pictures" />
<v-card-text class="">{{ voteCard.description }}</v-card-text> <v-card-text class="">{{ voteCard.description }}</v-card-text>
<TimerUI :voteTime="{dateend:voteCard.dateend,datestart:voteCard.datestart}" /> <TimerUI :voteTime="{dateend:voteCard.dateend,datestart:voteCard.datestart}" @changeBtn="(time) => timeChange = time"/>
<v-card-actions class="justify-space-between"> <v-card-actions class="justify-space-between mt-4 pb-2">
<v-btn <v-btn
:disabled="voteCard.is_passed || new Date(voteCard.datestart).getTime()>new Date().getTime()" :disabled="voteCard.is_passed || timeChange"
color="teal-darken-4" color="teal-darken-4"
prepend-icon="mdi-vote-outline" prepend-icon="mdi-vote-outline"
variant="outlined" variant="outlined"
@@ -29,7 +29,7 @@
<script> <script>
import TimerUI from '../secret/TimerUI.vue'; import TimerUI from '../secret/TimerUI.vue';
import { ref } from 'vue'
export default { export default {
components: { TimerUI }, components: { TimerUI },
emits: ['openVoteModal', 'openEditVoteModal', 'deleteVoting'], emits: ['openVoteModal', 'openEditVoteModal', 'deleteVoting'],
@@ -47,6 +47,11 @@ export default {
} }
} }
} }
},
setup() {
const timeChange = ref(false)
return { timeChange }
} }
} }
+5 -10
View File
@@ -17,8 +17,11 @@
<v-tabs-window-item value="active"> <v-tabs-window-item value="active">
<v-container> <v-container>
<v-row> <v-row>
<v-col v-for="voting in votes" :key="voting.id" cols="12" lg="3" md="4"> <v-col v-for="voting in votes" :key="voting.id" cols="12" xl="3" lg="4" md="6">
<VoteCardVue :voteCard="voting" @openVoteModal="openVoteModal" @openEditVoteModal="openEditVoteModal" <VoteCardVue
:voteCard="voting"
@openVoteModal="openVoteModal"
@openEditVoteModal="openEditVoteModal"
@deleteVoting="deleteVoting" /> @deleteVoting="deleteVoting" />
</v-col> </v-col>
</v-row> </v-row>
@@ -140,13 +143,6 @@ export default {
const resultsModal = ref(false); const resultsModal = ref(false);
const selectedVoting = ref(null); const selectedVoting = ref(null);
const timeRemaining = (dateend) => {
const now = new Date();
const diff = new Date(dateend) - now;
return diff > 0 ? `${Math.floor(diff / 60000)} минут` : "Завершено";
};
const formatDate = (date) => new Date(date).toLocaleString(); const formatDate = (date) => new Date(date).toLocaleString();
const openVoteModal = (voting) => { const openVoteModal = (voting) => {
@@ -194,7 +190,6 @@ export default {
voteModal, voteModal,
resultsModal, resultsModal,
selectedVoting, selectedVoting,
timeRemaining,
formatDate, formatDate,
openVoteModal, openVoteModal,
closeVoteModal, closeVoteModal,