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