Merge pull request 'P-82 Макет тестов' (#119) from dev-denzel into develop

Reviewed-on: https://sulaco.nodered.ru:5333/COD2/PORTAL_COD2/pulls/119
Reviewed-by: Nukeap <kuroedovo@narod.ru>
This commit is contained in:
Nukeap committed 2025-01-27 09:41:33 +00:00
commit 2007a3f25c
2 files changed
+143 -26

No files matched your search

@@ -0,0 +1,35 @@
<template>
<v-card-title>{{ item.title }}</v-card-title>
<v-card-subtitle>
<div>{{ item.description }}</div>
</v-card-subtitle>
<v-card-actions class="ga-4">
<div>
<v-icon color="teal-darken-4">mdi-calendar</v-icon>
<strong> До:</strong> {{ new Date(item.date).toLocaleDateString() }}
</div>
<div>
<v-icon color="teal-darken-4">mdi-calendar-text</v-icon>
<strong> Вопросов:</strong> {{ item.questions }}
</div>
<div v-if="item.time">
<v-icon color="teal-darken-4">mdi-clock</v-icon>
<strong> Время:</strong> {{ item.time }}
</div>
<div v-if="item.attempts">
<v-icon color="deep-orange-accent-4">mdi-alert-outline</v-icon>
<strong> Попытки:</strong> {{ item.attempts }}
</div>
</v-card-actions>
</template>
<script>
export default {
props: {
item: {
type: Object,
required: true
}
}
};
</script>
+108 -26
View File
@@ -1,14 +1,15 @@
<template> <template>
<v-container> <v-container>
<v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4"> <v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4">
<v-tab>Назначенные ({{ tests.length }})</v-tab> <v-tab>Назначенные ({{ scheduledTests.length }})</v-tab>
<v-tab>Завершенные</v-tab> <v-tab>Завершенные ({{ completedTests.length }})</v-tab>
<v-tab>Каталог</v-tab> <v-tab>Каталог</v-tab>
</v-tabs> </v-tabs>
<v-tabs-window v-model="activeTab"> <v-tabs-window v-model="activeTab">
<!-- Назначенные -->
<v-tabs-window-item> <v-tabs-window-item>
<v-card class="mb-6" outlined> <v-card outlined>
<v-card-title> <v-card-title>
Назначенные Назначенные
</v-card-title> </v-card-title>
@@ -19,31 +20,22 @@
clearable clearable
label="Найти тестирование по названию" label="Найти тестирование по названию"
variant="outlined" variant="outlined"
></v-text-field> />
<v-data-table <v-data-table
:headers="headers" :headers="headers"
:items="filteredTests" :items="filteredScheduledTests"
hide-default-footer hide-default-footer
hide-default-header
item-value="id" item-value="id"
> >
<template #item.image="{ item }"> <template #item.image="{ item }">
<v-img :src="item.image" alt="Test Image" height="100" width="100"/> <v-img :src="item.image" alt="Test Image" height="100" width="100"/>
</template> </template>
<template #item.title="{ item }"> <template #item.title="{ item }">
<v-card-title> <TestCard :item="item"/>
{{ item.title }}
</v-card-title>
<v-card-subtitle>
<div>{{ item.description }}</div>
</v-card-subtitle>
<v-card-actions class="ga-4">
<div><v-icon color="teal-darken-4">mdi-calendar</v-icon><strong> До:</strong> {{ item.date }}</div>
<div><v-icon color="teal-darken-4">mdi-calendar-text</v-icon> <strong> Вопросов:</strong> {{ item.questions }}</div>
<div v-if="item.time"><v-icon color="teal-darken-4">mdi-clock</v-icon><strong> Время:</strong> {{ item.time }}</div>
<div v-if="item.attempts"><v-icon color="deep-orange-accent-4">mdi-alert-outline</v-icon><strong> Попытки:</strong> {{ item.attempts }}</div>
</v-card-actions>
</template> </template>
<template #item.actions="{ item }"> <template #item.actions="{ item }">
@@ -55,32 +47,82 @@
</v-card> </v-card>
</v-tabs-window-item> </v-tabs-window-item>
<!-- Завершенные -->
<v-tabs-window-item> <v-tabs-window-item>
<v-card class="mb-6" outlined> <v-card class="mb-6" outlined>
<v-card-title> <v-card-title>
Завершенные Завершенные
</v-card-title> </v-card-title>
<p>Список завершенных тестов будет здесь.</p> <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-card>
</v-tabs-window-item> </v-tabs-window-item>
<!-- Каталог -->
<v-tabs-window-item> <v-tabs-window-item>
<v-card class="mb-6" outlined> <v-card outlined>
<v-card-title> <v-card-title>
Каталог Каталог
</v-card-title> </v-card-title>
<p>Список доступных тестов будет здесь.</p>
<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-card>
</v-tabs-window-item> </v-tabs-window-item>
</v-tabs-window> </v-tabs-window>
</v-container> </v-container>
</template> </template>
<script> <script>
import {computed, ref} from 'vue'; import {computed, ref} from 'vue';
import TestCard from "@/components/tests/TestCard.vue";
export default { export default {
components: {TestCard},
setup() { setup() {
const activeTab = ref(0); const activeTab = ref(0);
const search = ref(''); const search = ref('');
@@ -97,7 +139,7 @@ export default {
title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий', title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
type: 'test', type: 'test',
description: 'Краткое описание тестирования', description: 'Краткое описание тестирования',
date: '28.02.2025', date: '2025-02-28',
questions: 20, questions: 20,
time: '15 минут', time: '15 минут',
attempts: 1, attempts: 1,
@@ -108,27 +150,67 @@ export default {
title: 'Удобство раздела тестирования', title: 'Удобство раздела тестирования',
type: 'survey', type: 'survey',
description: 'Опрос среди сотрудников ЦОД МФ', description: 'Опрос среди сотрудников ЦОД МФ',
date: '22.06.2025', date: '2025-06-22',
questions: 28, questions: 28,
time: null, time: null,
attempts: null, attempts: null,
image: 'https://icdn.lenta.ru/images/2024/03/27/12/20240327123127525/square_1280_63e6b3d7acbfce65d885ae4cf216dfe2.jpg', 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 filteredTests = computed(() => { const currentDate = new Date();
if (!search.value) return tests.value;
return tests.value.filter((test) => 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()) 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 { return {
activeTab, activeTab,
search, search,
headers, headers,
tests, tests,
filteredTests, filteredTests,
filteredScheduledTests,
filteredCompletedTests,
scheduledTests,
completedTests,
}; };
}, },
}; };