Merge branch 'develop' into dev-denzel

This commit is contained in:
Nukeap committed 2025-01-15 15:21:28 +03:00
commit 82cc35065e
143 files changed
+112 -8735

No files matched your search

@@ -1,32 +1,34 @@
<template>
<v-row dense class="ma-1 ">
<v-card variant="text" class="py-1">
<v-card-title class="text-body-1"> До окончания голосования осталось: </v-card-title>
<v-row dense class="align-baseline justify-center">
<v-col cols="auto" class="text-center">
<v-row class="px-2">
<v-card variant="text"
:disabled="disabledcard.disabled"
class="py-2 mx-auto">
<v-card-title class="text-body-1"> До {{ disabledcard.text }} голосования осталось: </v-card-title>
<v-row no-gutters class="align-baseline">
<v-col class="text-center">
<v-card class="bg-yellow-darken-4">
<v-card-title>{{ displayDays }}</v-card-title>
<div>{{ displayDays }}</div>
</v-card>
<span class="text-caption">{{ declOfNum(displayDays, [' день', ' дня', ' дней']) }}</span>
</v-col>
<v-col cols="auto">:</v-col>
<v-col cols="auto" class="text-center">
<v-col cols="auto" class="px-1">:</v-col>
<v-col class="text-center">
<v-card class="bg-yellow-darken-4">
<v-card-title>{{ displayHours }}</v-card-title>
<div>{{ displayHours }}</div>
</v-card>
<span class="text-caption">{{ declOfNum(displayHours, [' час', ' часа', ' часов']) }}</span>
</v-col>
<v-col cols="auto">:</v-col>
<v-col cols="auto" class="text-center">
<v-col cols="auto" class="px-1">:</v-col>
<v-col class="text-center">
<v-card class="bg-yellow-darken-4">
<v-card-title>{{ displayMinutes }}</v-card-title>
<div>{{ displayMinutes }}</div>
</v-card>
<span class="text-caption">{{ declOfNum(displayMinutes, [' минута', ' минуты', ' минут']) }}</span>
</v-col>
<v-col cols="auto">:</v-col>
<v-col cols="auto" class="text-center">
<v-col cols="auto" class="px-1">:</v-col>
<v-col class="text-center">
<v-card class="bg-yellow-darken-4">
<v-card-title>{{ displaySeconds }}</v-card-title>
<div>{{ displaySeconds }}</div>
</v-card>
<span class="text-caption">{{ declOfNum(displaySeconds, [' секунда', ' секунды', ' секунд']) }}</span>
</v-col>
@@ -39,13 +41,15 @@ import { computed, ref } from 'vue'
export default {
props: {
endTime: {
type: String,
default: () => { return new Date(props.endTime).setFullYear() }
voteTime: {
type: Object,
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);
@@ -68,14 +72,40 @@ export default {
const cases = [2, 0, 1, 1, 1, 2]
return titles[(value % 100 > 4 && value % 100 < 20) ? 2 : cases[(value % 10 < 5) ? value % 10 : 5]]
}
const disabledcard = ref({
text: 'окончания',
disabled: false
})
const dateendorStart = ()=>{
let param = 'dateend'
if (new Date().getTime() < new Date(props.voteTime.datestart).getTime()) {
param='datestart'
disabledcard.value= {
text: 'начала',
disabled: true,
}
emit('changeBtn', true)
} else {
disabledcard.value= {
text: 'окончания',
disabled: false,
}
emit('changeBtn', false)
}
return param
}
function countDown() {
const timer = setInterval(() => {
const date = new Date()
const distance = new Date(props.endTime).getTime() - date.getTime()
const distance = new Date(props.voteTime[dateendorStart()]).getTime() - date.getTime()
if (distance < 0) {
if (distance <= 1) {
clearInterval(timer)
setTimeout(()=>countDown(),1000)
return
}
@@ -100,6 +130,8 @@ export default {
displayDays,
displaySeconds,
declOfNum,
dateendorStart,
disabledcard
}
}
}
+33 -15
View File
@@ -1,16 +1,26 @@
<template>
<v-card>
<v-card-text class="d-flex justify-space-between ga-3 text-h6"> {{ voteCard.name }}
<v-card-text class=" d-flex justify-space-between ga-3 text-h6"> {{ voteCard.name }}
<v-btn flat size="medium" @click="$emit('openEditVoteModal', voteCard)">
<v-icon color="orange-lighten-1">mdi-pencil</v-icon>
</v-btn>
</v-card-text>
<v-img cover :src="voteCard.pictures" />
<v-card-text class="text-body-1">{{ voteCard.description }}</v-card-text>
<TimerUI :endTime="voteCard.dateend" />
<v-card-actions class="justify-space-between">
<v-row>
<v-col>
<v-carousel show-arrows="hover" hide-delimiters cycle height="200">
<v-carousel-item v-for="(picture, index) in images"
:key="index"
:src="`${baseURL.slice(0, -1)}${picture}`">
</v-carousel-item>
</v-carousel>
</v-col>
</v-row>
<v-card-text class="">{{ voteCard.description }}</v-card-text>
<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
v-if="!voteCard.is_passed"
:disabled="voteCard.is_passed || timeChange"
color="teal-darken-4"
prepend-icon="mdi-vote-outline"
variant="outlined"
@@ -18,9 +28,8 @@
size="medium"
class="pa-2"
@click="$emit('openVoteModal', voteCard)">
Проголосовать
{{!voteCard.is_passed?"Проголосовать":"Уже проголосовали"}}
</v-btn>
<v-btn v-else color="teal-darken-4" disabled size="medium">Уже проголосовали</v-btn>
<v-btn color="error" @click="$emit('deleteVoting', voteCard.id)" size="medium">
<v-icon>mdi-delete</v-icon>
</v-btn>
@@ -29,10 +38,11 @@
</template>
<script>
import TimerUI from '../secret/TimerUI.vue';
import Timer from "@/components/UI/Timer.vue"
import { baseURL } from "@/utils/axios-api";
import { ref, computed } from 'vue'
export default {
components: { TimerUI },
components: { Timer },
emits: ['openVoteModal', 'openEditVoteModal', 'deleteVoting'],
props: {
voteCard: {
@@ -40,15 +50,23 @@ export default {
default: () => {
return {
id: 0,
name: "Допустим, здесь могла быть ваша реклама",
description: "Но таких денег у вас нет, чтобы получить ее на нашем прекрасном голосовании",
pictures: "https://cdn.vuetifyjs.com/images/parallax/material.jpg",
name: "",
description: "",
files: [],
dateend: new Date(new Date().getTime() + 600000),
is_passed: false,
is_passed: true,
}
}
}
},
setup(props) {
const timeChange = ref(false)
const images = computed(()=>{
return props.voteCard.files.length>0? props.voteCard.files:['/media/defaultimg/vote.png']
})
return { timeChange, baseURL ,images}
}
}
</script>
+2 -2
View File
@@ -1,5 +1,5 @@
<template>
<v-container>
<v-container class="py-0">
<v-toolbar color="transparent">
<v-toolbar-title>Голосования</v-toolbar-title>
<template v-slot:extension>
@@ -84,7 +84,7 @@
</v-card-text>
</v-card>
</v-dialog>
{{res}}
<v-dialog v-model="editVoteModal" max-width="1200px" @click:outside="closeModal">
<v-card>
<v-card-title>Редактировать голосование: {{ selectedVoting?.title }}</v-card-title>