chore [X-01]: пулл
This commit is contained in:
1 parent
867f120c5f
commit
fa07dd83ef
1 file changed
+231
-94
@@ -1,97 +1,146 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card>
|
<v-card class="flip-card">
|
||||||
<v-card-text class="d-flex justify-space-between ga-3 text-h6">
|
<div class="flip-card-inner" :class="{ 'is-flipped': isExpanded }">
|
||||||
<v-tooltip bottom>
|
<!-- Передняя сторона карточки -->
|
||||||
<template v-slot:activator="{ props }">
|
<div class="flip-card-front">
|
||||||
<span
|
<v-card-text class="d-flex justify-space-between ga-3 text-h6">
|
||||||
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
<v-tooltip bottom>
|
||||||
v-bind="props">
|
<template v-slot:activator="{ props }">
|
||||||
{{ voteCard.name }}
|
<span
|
||||||
</span>
|
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
||||||
</template>
|
v-bind="props">
|
||||||
<span>{{ voteCard.name }}</span>
|
{{ voteCard.name }}
|
||||||
</v-tooltip>
|
</span>
|
||||||
</v-card-text>
|
|
||||||
<v-row>
|
|
||||||
<v-col>
|
|
||||||
<v-carousel
|
|
||||||
cycle
|
|
||||||
height="200" hide-delimiters
|
|
||||||
show-arrows="hover">
|
|
||||||
<v-carousel-item
|
|
||||||
v-for="(picture, index) in images"
|
|
||||||
:key="index"
|
|
||||||
:src="images[index].length < 1 ? defaultImage : `${baseURL.slice(0, -1)}${picture}`">
|
|
||||||
</v-carousel-item>
|
|
||||||
</v-carousel>
|
|
||||||
</v-col>
|
|
||||||
</v-row>
|
|
||||||
<v-card-text class="">
|
|
||||||
<v-tooltip bottom>
|
|
||||||
<template v-slot:activator="{ props }">
|
|
||||||
<span
|
|
||||||
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"
|
|
||||||
v-bind="props">
|
|
||||||
{{ voteCard.description }}
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
<span>{{ voteCard.description }}</span>
|
|
||||||
</v-tooltip>
|
|
||||||
</v-card-text>
|
|
||||||
<div class="px-2">
|
|
||||||
<Timer v-if="!isFinished" :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
|
|
||||||
@changeBtn="(time) => timeChange = time"/>
|
|
||||||
|
|
||||||
<div v-else class="font-weight-bold text-center"> Завершено: {{
|
|
||||||
new Date(voteCard.dateend).toLocaleDateString()
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<v-card-actions class="justify-space-between mt-4 pb-2">
|
|
||||||
<template v-if="!isFinished">
|
|
||||||
<v-btn :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 ? "Проголосовать" : "Уже проголосовали" }}
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<template v-if="user.id === voteCard.author || isFinished">
|
|
||||||
<v-btn color="teal-darken-4" prepend-icon="mdi-trophy-outline"
|
|
||||||
rounded="xl" size="small" variant="outlined" @click="$emit('openResultModal', voteCard)">
|
|
||||||
Результаты
|
|
||||||
</v-btn>
|
|
||||||
</template>
|
|
||||||
<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-dialog v-model="youSure" width="500">
|
|
||||||
<v-card class="flex" max-width="450">
|
|
||||||
<v-btn
|
|
||||||
class="align-self-end ma-2 text-red"
|
|
||||||
icon="mdi-close"
|
|
||||||
size="medium"
|
|
||||||
variant="text"
|
|
||||||
@click="youSure = false"
|
|
||||||
/>
|
|
||||||
<div class="ml-5 text-h6">
|
|
||||||
Вы действительно хотите удалить голосование?
|
|
||||||
</div>
|
|
||||||
<template v-slot:actions>
|
|
||||||
<v-btn-group>
|
|
||||||
<v-btn
|
|
||||||
class="text-red"
|
|
||||||
@click="$emit('deleteVoting', voteCard.id), youSure = false">
|
|
||||||
Да
|
|
||||||
</v-btn>
|
|
||||||
<v-btn
|
|
||||||
class="text-green"
|
|
||||||
@click="youSure = false">
|
|
||||||
Нет
|
|
||||||
</v-btn>
|
|
||||||
</v-btn-group>
|
|
||||||
</template>
|
</template>
|
||||||
</v-card>
|
<span>{{ voteCard.name }}</span>
|
||||||
</v-dialog>
|
</v-tooltip>
|
||||||
</v-btn>
|
</v-card-text>
|
||||||
</v-card-actions>
|
<v-row>
|
||||||
|
<v-col>
|
||||||
|
<v-carousel
|
||||||
|
cycle
|
||||||
|
height="200"
|
||||||
|
hide-delimiters
|
||||||
|
show-arrows="hover">
|
||||||
|
<v-carousel-item
|
||||||
|
v-for="(picture, index) in images"
|
||||||
|
:key="index"
|
||||||
|
:src="images[index].length < 1 ? defaultImage : `${baseURL.slice(0, -1)}${picture}`">
|
||||||
|
</v-carousel-item>
|
||||||
|
</v-carousel>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-card-text class="description-container">
|
||||||
|
<span>
|
||||||
|
{{ truncatedText }}
|
||||||
|
<span
|
||||||
|
v-if="needsTruncation"
|
||||||
|
class="show-more-btn"
|
||||||
|
@click="isExpanded = true"
|
||||||
|
>
|
||||||
|
...полное описание➡️
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</v-card-text>
|
||||||
|
<div class="px-2">
|
||||||
|
<Timer
|
||||||
|
v-if="!isFinished"
|
||||||
|
:voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
|
||||||
|
@changeBtn="(time) => timeChange = time"
|
||||||
|
/>
|
||||||
|
<div v-else class="font-weight-bold text-center">
|
||||||
|
Завершено: {{ new Date(voteCard.dateend).toLocaleDateString() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<v-card-actions class="justify-space-between mt-4 pb-2">
|
||||||
|
<template v-if="!isFinished">
|
||||||
|
<v-btn
|
||||||
|
: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 ? "Проголосовать" : "Уже проголосовали" }}
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<template v-if="user.id === voteCard.author || isFinished">
|
||||||
|
<v-btn
|
||||||
|
color="teal-darken-4"
|
||||||
|
prepend-icon="mdi-trophy-outline"
|
||||||
|
rounded="xl"
|
||||||
|
size="small"
|
||||||
|
variant="outlined"
|
||||||
|
@click="$emit('openResultModal', voteCard)"
|
||||||
|
>
|
||||||
|
Результаты
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
<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-dialog v-model="youSure" width="500">
|
||||||
|
<v-card class="flex" max-width="450">
|
||||||
|
<v-btn
|
||||||
|
class="align-self-end ma-2 text-red"
|
||||||
|
icon="mdi-close"
|
||||||
|
size="medium"
|
||||||
|
variant="text"
|
||||||
|
@click="youSure = false"
|
||||||
|
/>
|
||||||
|
<div class="ml-5 text-h6">
|
||||||
|
Вы действительно хотите удалить голосование?
|
||||||
|
</div>
|
||||||
|
<template v-slot:actions>
|
||||||
|
<v-btn-group>
|
||||||
|
<v-btn
|
||||||
|
class="text-red"
|
||||||
|
@click="$emit('deleteVoting', voteCard.id), youSure = false"
|
||||||
|
>
|
||||||
|
Да
|
||||||
|
</v-btn>
|
||||||
|
<v-btn
|
||||||
|
class="text-green"
|
||||||
|
@click="youSure = false"
|
||||||
|
>
|
||||||
|
Нет
|
||||||
|
</v-btn>
|
||||||
|
</v-btn-group>
|
||||||
|
</template>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</v-btn>
|
||||||
|
</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>
|
||||||
Reference in new issue
Block a user