Files
PORTAL_COD2/src/front/src/views/TestHomePage.vue
T
2025-01-27 09:06:05 +03:00

129 lines
3.8 KiB
Vue

<template>
<v-container>
<v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4">
<v-tab>Назначенные ({{ tests.length }})</v-tab>
<v-tab>Завершенные</v-tab>
<v-tab>Каталог</v-tab>
</v-tabs>
<v-tabs-window v-model="activeTab">
<v-tabs-window-item>
<v-card class="mb-6" outlined>
<v-card-title>
Назначенные
</v-card-title>
<v-text-field
v-model="search"
class="mb-4 mx-4"
clearable
label="Найти тестирование по названию"
variant="outlined"
></v-text-field>
<v-data-table
:headers="headers"
:items="filteredTests"
class="elevation-1"
hide-default-footer
item-value="id"
>
<template #item.image="{ item }">
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
</template>
<template #item.actions="{ item }">
<v-btn v-if="item.type === 'test'" class="mr-4" color="teal-darken-4" variant="tonal">Тренироваться
</v-btn>
<v-btn color="teal-darken-4">Пройти</v-btn>
</template>
</v-data-table>
</v-card>
</v-tabs-window-item>
<v-tabs-window-item>
<v-card class="mb-6" outlined>
<v-card-title>
Завершенные
</v-card-title>
<p>Список завершенных тестов будет здесь.</p>
</v-card>
</v-tabs-window-item>
<v-tabs-window-item>
<v-card class="mb-6" outlined>
<v-card-title>
Каталог
</v-card-title>
<p>Список доступных тестов будет здесь.</p>
</v-card>
</v-tabs-window-item>
</v-tabs-window>
</v-container>
</template>
<script>
import {computed, ref} from 'vue';
export default {
setup() {
const activeTab = ref(0);
const search = ref('');
const headers = [
{text: 'Картинка', value: 'image', sortable: false},
{text: 'Название', value: 'title', align: 'start'},
{text: 'Описание', value: 'description'},
{text: 'Дата', value: 'date'},
{text: 'Действия', value: 'actions', sortable: false},
];
const tests = ref([
{
id: 1,
title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
type: 'test',
description: 'Краткое описание тестирования',
date: '22.06.2024',
questions: 20,
time: '15 минут',
attempts: 1,
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
},
{
id: 2,
title: 'Удобство раздела тестирования',
type: 'survey',
description: 'Опрос среди сотрудников ЦОД МФ',
date: '22.06.2024',
questions: 28,
time: null,
attempts: null,
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
},
]);
const filteredTests = computed(() => {
if (!search.value) return tests.value;
return tests.value.filter((test) =>
test.title.toLowerCase().includes(search.value.toLowerCase())
);
});
return {
activeTab,
search,
headers,
tests,
filteredTests,
};
},
};
</script>
<style>
.v-data-table__wrapper {
overflow-x: auto;
}
</style>