chore [X-01]: 1,3,0

This commit is contained in:
Nukeap committed 2025-10-22 15:40:05 +03:00
commit d189f1aaf6
1 file changed
+163 -26
+163 -26
View File
@@ -1,5 +1,8 @@
<template> <template>
<v-card> <v-card class="flip-card">
<div class="flip-card-inner" :class="{ 'is-flipped': isExpanded }">
<!-- Передняя сторона карточки -->
<div class="flip-card-front">
<v-card-text class="d-flex justify-space-between ga-3 text-h6"> <v-card-text class="d-flex justify-space-between ga-3 text-h6">
<v-tooltip bottom> <v-tooltip bottom>
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
@@ -16,7 +19,8 @@
<v-col> <v-col>
<v-carousel <v-carousel
cycle cycle
height="200" hide-delimiters height="200"
hide-delimiters
show-arrows="hover"> show-arrows="hover">
<v-carousel-item <v-carousel-item
v-for="(picture, index) in images" v-for="(picture, index) in images"
@@ -26,41 +30,60 @@
</v-carousel> </v-carousel>
</v-col> </v-col>
</v-row> </v-row>
<v-card-text class=""> <v-card-text class="description-container">
<v-tooltip bottom> <span>
<template v-slot:activator="{ props }"> {{ truncatedText }}
<span <span
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;" v-if="needsTruncation"
v-bind="props"> class="show-more-btn"
{{ voteCard.description }} @click="isExpanded = true"
>
...полное описание➡️
</span>
</span> </span>
</template>
<span>{{ voteCard.description }}</span>
</v-tooltip>
</v-card-text> </v-card-text>
<div class="px-2"> <div class="px-2">
<Timer v-if="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }" <Timer
@changeBtn="(time) => timeChange = time"/> v-if="!isFinished"
:voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
<div v-else class="font-weight-bold text-center"> Завершено: {{ @changeBtn="(time) => timeChange = time"
new Date(voteCard.dateend).toLocaleDateString() />
}} <div v-else class="font-weight-bold text-center">
Завершено: {{ new Date(voteCard.dateend).toLocaleDateString() }}
</div> </div>
</div> </div>
<v-card-actions class="justify-space-between mt-4 pb-2"> <v-card-actions class="justify-space-between mt-4 pb-2">
<template v-if="!isFinished"> <template v-if="!isFinished">
<v-btn :disabled="voteCard.is_passed || timeChange" color="teal-darken-4" prepend-icon="mdi-vote-outline" <v-btn
rounded="xl" size="small" variant="outlined" @click="$emit('openVoteModal', voteCard)"> :disabled="voteCard.is_passed || timeChange"
color="teal-darken-4"
prepend-icon="mdi-vote-outline"
rounded="xl"
size="small"
variant="outlined"
@click="$emit('openVoteModal', voteCard)"
>
{{ !voteCard.is_passed ? "Проголосовать" : "Уже проголосовали" }} {{ !voteCard.is_passed ? "Проголосовать" : "Уже проголосовали" }}
</v-btn> </v-btn>
</template> </template>
<template v-if="user.id === voteCard.author || isFinished"> <template v-if="user.id === voteCard.author || isFinished">
<v-btn color="teal-darken-4" prepend-icon="mdi-trophy-outline" <v-btn
rounded="xl" size="small" variant="outlined" @click="$emit('openResultModal', voteCard)"> color="teal-darken-4"
prepend-icon="mdi-trophy-outline"
rounded="xl"
size="small"
variant="outlined"
@click="$emit('openResultModal', voteCard)"
>
Результаты Результаты
</v-btn> </v-btn>
</template> </template>
<v-btn v-if="user.id === voteCard.author || user.is_superuser" color="error" size="medium" @click="youSure=true"> <v-btn
v-if="user.id === voteCard.author || user.is_superuser"
color="error"
size="medium"
@click="youSure=true"
>
<v-icon>mdi-delete</v-icon> <v-icon>mdi-delete</v-icon>
<v-dialog v-model="youSure" width="500"> <v-dialog v-model="youSure" width="500">
<v-card class="flex" max-width="450"> <v-card class="flex" max-width="450">
@@ -78,12 +101,14 @@
<v-btn-group> <v-btn-group>
<v-btn <v-btn
class="text-red" class="text-red"
@click="$emit('deleteVoting', voteCard.id), youSure = false"> @click="$emit('deleteVoting', voteCard.id), youSure = false"
>
Да Да
</v-btn> </v-btn>
<v-btn <v-btn
class="text-green" class="text-green"
@click="youSure = false"> @click="youSure = false"
>
Нет Нет
</v-btn> </v-btn>
</v-btn-group> </v-btn-group>
@@ -92,6 +117,30 @@
</v-dialog> </v-dialog>
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</div>
<!-- Задняя сторона карточки -->
<div class="flip-card-back">
<v-card-text class="text-h6">
{{ voteCard.name }}
</v-card-text>
<v-card-text class="description-full">
{{ voteCard.description }}
</v-card-text>
<v-card-actions class="justify-center mt-4 pb-2">
<v-btn
color="teal-darken-4"
prepend-icon="mdi-arrow-left"
rounded="xl"
size="small"
variant="outlined"
@click="isExpanded = false"
>
Обратно
</v-btn>
</v-card-actions>
</div>
</div>
</v-card> </v-card>
</template> </template>
@@ -131,6 +180,20 @@ export default {
const accountStore = useAccountStore(); const accountStore = useAccountStore();
const user = accountStore.user; const user = accountStore.user;
const isExpanded = ref(false);
const maxLength = 22;
const needsTruncation = computed(() => {
return props.voteCard.description.length > maxLength;
});
const truncatedText = computed(() => {
if (!needsTruncation.value) {
return props.voteCard.description;
}
return props.voteCard.description.slice(0, maxLength);
});
const images = computed(() => { const images = computed(() => {
return props.voteCard.files.length > 0 ? props.voteCard.files : [''] return props.voteCard.files.length > 0 ? props.voteCard.files : ['']
}) })
@@ -143,9 +206,83 @@ export default {
isFinished.value = true; isFinished.value = true;
} }
return {timeChange, baseURL, images, youSure, isFinished, user, defaultImage} return {
timeChange,
baseURL,
images,
youSure,
isFinished,
user,
defaultImage,
isExpanded,
truncatedText,
needsTruncation
} }
}
}
</script>
<style scoped>
.flip-card {
perspective: 1000px;
background: transparent !important;
} }
</script> .flip-card-inner {
position: relative;
width: 100%;
transition: transform 0.6s;
transform-style: preserve-3d;
}
.flip-card-inner.is-flipped {
transform: rotateY(180deg);
}
.flip-card-front,
.flip-card-back {
width: 100%;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
}
.flip-card-front {
background: white;
}
.flip-card-back {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: white;
transform: rotateY(180deg);
display: flex;
flex-direction: column;
padding: 16px;
overflow-y: auto;
}
.description-container {
word-wrap: break-word;
}
.description-full {
word-wrap: break-word;
white-space: pre-wrap;
overflow-y: auto;
}
.show-more-btn {
color: #1976d2;
cursor: pointer;
font-weight: 500;
user-select: none;
white-space: nowrap;
}
.show-more-btn:hover {
text-decoration: underline;
}
</style>