This commit is contained in:
Denzel committed 2025-01-21 11:46:28 +03:00
1 parent d551f80c77
commit 0ef6ed21e0
2 files changed
+37 -12

No files matched your search

@@ -32,10 +32,9 @@
</v-stepper-header>
<v-stepper-window class="d-flex flex-column flex-fill">
<v-stepper-window-item v-for="(question, index) in data.questions" :key="question.numb"
:step="question.numb"
class="">
<div class="">
<h3 class="text-center">{{ question.name }}</h3>
:step="question.numb">
<div>
<h3 class="text-center">{{ question.name }} <span class="text-subtitle-1">(вариантов ответа: {{question.settings.multiChoice}})</span></h3>
<v-row>
<div class="v-col align-self-start">
<v-img :src="question.file"
@@ -63,7 +62,6 @@
</template>
</v-list-item>
</v-list>
</div>
</v-row>
</div>
+34 -7
View File
@@ -1,8 +1,23 @@
<template>
<v-container>
<v-tabs v-model="activeTab" class="mb-4">
<v-tab v-for="(question, questionIndex) in questions" :key="questionIndex">
Опрос {{ question.numb }}: {{ question.name || 'Без названия' }}
<v-tab
v-for="(question, questionIndex) in questions"
:key="questionIndex"
>
<template v-if="shouldShowTooltip(question.name || 'Без названия', 10)">
<v-tooltip bottom>
<template v-slot:activator="{ props }">
<span v-bind="props">
{{ truncateText(question.name || 'Без названия', 10) }}
</span>
</template>
<span>{{ question.name || 'Без названия' }}</span>
</v-tooltip>
</template>
<template v-else>
<span>{{ truncateText(question.name || 'Без названия', 10) }}</span>
</template>
</v-tab>
</v-tabs>
@@ -11,6 +26,7 @@
<v-row>
<!-- Победитель -->
<v-col cols="12">
<h3>{{ question.name }}</h3>
<v-card-title class="d-flex ga-2 align-center">
<h4 class="text-teal-darken-4">Победитель:</h4>
<h3>{{ getWinner(question).employee?.fio || getWinner(question).name }} 🏆</h3>
@@ -20,7 +36,6 @@
</v-card-subtitle>
</v-col>
<!-- Топ 10 -->
<v-col cols="12">
<v-card class="mb-4">
<v-card-title class="text-teal-darken-3">Топ 10</v-card-title>
@@ -31,11 +46,12 @@
:key="answerIndex"
>
<p>
<strong>{{ answer.employee ? answer.employee.fio : answer.name }}</strong>: {{ answer.count }} голосов
<strong>{{ answer.employee ? answer.employee.fio : answer.name }}</strong>: {{ answer.count }}
голосов
<template v-if="answer.employee">
<br />
<br/>
<small>Отдел: {{ answer.employee ? answer.employee.department : '' }}</small>
<br />
<br/>
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
</template>
</p>
@@ -51,7 +67,7 @@
</template>
<script>
import { computed, ref } from 'vue';
import {computed, ref} from 'vue';
export default {
name: 'VoteResult',
@@ -76,11 +92,22 @@ export default {
return [...question.answers].sort((a, b) => b.count - a.count).slice(0, 10);
};
const truncateText = (text, maxLength) => {
if (!text) return '';
return text.length > maxLength ? text.slice(0, maxLength) + '…' : text;
};
const shouldShowTooltip = (text, maxLength) => {
return text && text.length > maxLength;
};
return {
activeTab,
questions,
getWinner,
getTopResults,
truncateText,
shouldShowTooltip
};
},
};