224 lines
6.9 KiB
Vue
224 lines
6.9 KiB
Vue
<template>
|
|
<v-container>
|
|
<v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4">
|
|
<v-tab>Назначенные ({{ scheduledTests.length }})</v-tab>
|
|
<v-tab>Завершенные ({{ completedTests.length }})</v-tab>
|
|
<v-tab>Каталог</v-tab>
|
|
</v-tabs>
|
|
|
|
<v-tabs-window v-model="activeTab">
|
|
<!-- Назначенные -->
|
|
<v-tabs-window-item>
|
|
<v-card outlined>
|
|
<v-card-title>
|
|
Назначенные
|
|
</v-card-title>
|
|
|
|
<v-text-field
|
|
v-model="search"
|
|
class="mx-4"
|
|
clearable
|
|
label="Найти тестирование по названию"
|
|
variant="outlined"
|
|
/>
|
|
|
|
<v-data-table
|
|
:headers="headers"
|
|
:items="filteredScheduledTests"
|
|
hide-default-footer
|
|
hide-default-header
|
|
item-value="id"
|
|
>
|
|
|
|
<template #item.image="{ item }">
|
|
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
|
</template>
|
|
|
|
<template #item.title="{ item }">
|
|
<TestCard :item="item"/>
|
|
</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>
|
|
<v-data-table
|
|
:headers="headers"
|
|
:items="filteredCompletedTests"
|
|
hide-default-footer
|
|
hide-default-header
|
|
item-value="id"
|
|
>
|
|
<template #item.image="{ item }">
|
|
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
|
</template>
|
|
|
|
<template #item.title="{ item }">
|
|
<TestCard :item="item"/>
|
|
</template>
|
|
|
|
<template #item.actions="{ item }">
|
|
<v-btn color="teal-darken-4">Посмотреть результаты</v-btn>
|
|
</template>
|
|
</v-data-table>
|
|
</v-card>
|
|
</v-tabs-window-item>
|
|
|
|
<!-- Каталог -->
|
|
<v-tabs-window-item>
|
|
<v-card outlined>
|
|
<v-card-title>
|
|
Каталог
|
|
</v-card-title>
|
|
|
|
<v-text-field
|
|
v-model="search"
|
|
class="mx-4"
|
|
clearable
|
|
label="Найти тестирование по названию"
|
|
variant="outlined"
|
|
/>
|
|
|
|
<v-data-table
|
|
:headers="headers"
|
|
:items="filteredTests"
|
|
hide-default-footer
|
|
hide-default-header
|
|
item-value="id"
|
|
>
|
|
<template #item.image="{ item }">
|
|
<v-img :src="item.image" alt="Test Image" height="100" width="100"/>
|
|
</template>
|
|
|
|
<template #item.title="{ item }">
|
|
<TestCard :item="item"/>
|
|
</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>
|
|
</v-container>
|
|
</template>
|
|
|
|
<script>
|
|
import {computed, ref} from 'vue';
|
|
import TestCard from "@/components/tests/TestCard.vue";
|
|
|
|
export default {
|
|
components: {TestCard},
|
|
setup() {
|
|
const activeTab = ref(0);
|
|
const search = ref('');
|
|
|
|
const headers = [
|
|
{text: 'Картинка', value: 'image', sortable: false},
|
|
{text: 'Название', value: 'title', align: 'start'},
|
|
{text: 'Действия', value: 'actions', sortable: false},
|
|
];
|
|
|
|
const tests = ref([
|
|
{
|
|
id: 1,
|
|
title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
|
|
type: 'test',
|
|
description: 'Краткое описание тестирования',
|
|
date: '2025-02-28',
|
|
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: '2025-06-22',
|
|
questions: 28,
|
|
time: null,
|
|
attempts: null,
|
|
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
|
},
|
|
{
|
|
id: 3,
|
|
title: 'Законченная карточка законченного тестирования',
|
|
type: 'survey',
|
|
description: 'законченное описание законченного тестирования',
|
|
date: '2024-06-22',
|
|
questions: 1,
|
|
time: null,
|
|
attempts: null,
|
|
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg',
|
|
},
|
|
]);
|
|
|
|
const currentDate = new Date();
|
|
|
|
const scheduledTests = computed(() => {
|
|
return tests.value.filter(test => new Date(test.date) > currentDate);
|
|
});
|
|
|
|
const completedTests = computed(() => {
|
|
return tests.value.filter(test => new Date(test.date) <= currentDate);
|
|
});
|
|
|
|
const filteredScheduledTests = computed(() => {
|
|
if (!search.value) return scheduledTests.value;
|
|
return scheduledTests.value.filter(test =>
|
|
test.title.toLowerCase().includes(search.value.toLowerCase())
|
|
);
|
|
});
|
|
|
|
const filteredCompletedTests = computed(() => {
|
|
if (!search.value) return completedTests.value;
|
|
return completedTests.value.filter(test =>
|
|
test.title.toLowerCase().includes(search.value.toLowerCase())
|
|
);
|
|
});
|
|
|
|
const filteredTests = computed(() => {
|
|
if (!search.value) return tests.value.filter(test => new Date(test.date) > currentDate);
|
|
return tests.value.filter(test => new Date(test.date) > currentDate)
|
|
.filter((test) =>
|
|
test.title.toLowerCase().includes(search.value.toLowerCase())
|
|
);
|
|
});
|
|
|
|
return {
|
|
activeTab,
|
|
search,
|
|
headers,
|
|
tests,
|
|
filteredTests,
|
|
filteredScheduledTests,
|
|
filteredCompletedTests,
|
|
scheduledTests,
|
|
completedTests,
|
|
};
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style>
|
|
.v-data-table__wrapper {
|
|
overflow-x: auto;
|
|
}
|
|
</style>
|