Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | <!-- Раздел с назначенным тестированием -->
<template>
<div class="my-4 text-h5">{{ title }}</div>
<v-container :fluid="true">
<v-row>
<v-text-field
v-model="search"
append-inner-icon="mdi-magnify"
label="Найти тестирование по названию"
variant="solo"
@click:append-inner="searchTest"
clearable
/>
</v-row>
</v-container>
<!-- Карточка где буду отрисовываться тесты в цикле -->
<v-card v-for="cardValue in searchTest" :key="cardValue.id" class="my-2 border-sm">
<v-row class="pa-2">
<v-col cols="2" class="justify-center">
<v-img :src="cardValue.file" class="mx-auto" />
</v-col>
<v-col cols="auto" class="d-flex flex-grow-1">
<div class="d-flex flex-column justify-center flex-grow-1">
<div class="text-body-1 font-weight-medium mb-2">{{ cardValue.name }}</div>
<div class="text-body-1 text-disabled mb-2">{{ cardValue.description }}</div>
<div class="d-flex ga-4">
<slot name="results"></slot>
<div v-for="icon in activeTabIcon">
<v-icon :color="icon.color" :icon="icon.icon" size="large" />
<span class="ml-1">{{ momenter(cardValue[icon.field], icon.field) }}</span>
</div>
</div>
</div>
</v-col>
<v-col cols="auto" class="align-self-center">
<slot name="buttons"></slot>
</v-col>
</v-row>
</v-card>
<!-- Если данные отсутствуют, выводим сообщение об этом -->
<v-container v-if="!searchTest.length" :fluid="true" class="h-100">
<v-row class="align-center flex-column">
<v-icon icon="mdi-note-off-outline" color="grey-lighten-1" size="x-large" />
<v-card-title class="text-h4 text-grey-lighten-1">Данные не найдены</v-card-title>
</v-row>
</v-container>
</template>
<script>
import moment from 'moment';
import { declOfNum } from '@/utils/universal_functions';
import { baseURL } from '@/utils/axios-api';
import { ref, computed } from 'vue';
export default {
props: {
title: {
type: String,
default: 'Не забыть передать тайтл сюда!',
},
activeTab: {
type: Number,
default: 0,
},
testingCard: {
type: Array,
default: () => [
{
id: 1,
name: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
type: 'test',
description: 'Краткое описание тестирования',
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
dateend: new Date(),
question_count: 20,
time: 20,
attemps_number: 3,
},
{
id: 2,
name: 'Удобство раздела тестирования',
type: 'test',
description: 'Опрос среди сотрудников ЦОД МФ',
file: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
dateend: new Date(),
question_count: 28,
time: 15,
attemps_number: 1,
},
],
},
},
setup(props) {
const search = ref('');
const searchTest = computed(() => {
if (!search.value) return props.testingCard;
return props.testingCard.filter((item) =>
item.name.toLowerCase().includes(search.value.toLowerCase()),
);
});
const activeTabIcon = computed(() => {
let icons = [
// иконки для использования в карточках
{
icon: 'mdi-calendar-clock',
field: 'dateend',
color: 'teal-darken-1',
},
{
icon: 'mdi-clipboard-list-outline',
field: 'question_count',
color: 'teal-darken-1',
},
{
icon: 'mdi-timer-outline',
field: 'time',
color: 'teal-darken-1',
},
{
icon: 'mdi-fire',
field: 'attemps_number',
color: '#FF9800',
},
];
if (props.activeTab === 0) {
return icons;
} else {
return icons.splice(1, 2);
}
});
const momenter = (val, field) => {
if (field === 'dateend') {
return 'до ' + moment(val).format('DD.MM.YYYY, HH:mm');
} else if (field === 'question_count') {
return val + declOfNum(val, [' вопрос', ' вопроса', ' вопросов']);
} else if (field === 'time') {
return val + declOfNum(val, [' минута', ' минуты', ' минут']);
}
return val;
};
return { search, searchTest, momenter, activeTabIcon, baseURL };
},
};
</script>
|