P-126
This commit is contained in:
1 parent
271d9c4f47
commit
f85e65c89a
1 file changed
+73
-198
@@ -1,223 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-container>
|
<v-container :fluid="true">
|
||||||
<v-tabs v-model="activeTab" class="mb-4 text-teal-darken-4">
|
<v-tabs v-model="activeTab" class="mb-2 text-teal-darken-4">
|
||||||
<v-tab>Назначенные ({{ scheduledTests.length }})</v-tab>
|
<v-tab v-for="tab in tabs" :key="tab.value" :value="tab.value"> {{ tab.title }} </v-tab>
|
||||||
<v-tab>Завершенные ({{ completedTests.length }})</v-tab>
|
|
||||||
<v-tab>Каталог</v-tab>
|
|
||||||
</v-tabs>
|
</v-tabs>
|
||||||
|
<v-tabs-window v-model="activeTab" class="border-t-thin">
|
||||||
<v-tabs-window v-model="activeTab">
|
<!-- Вкладка назначенные -->
|
||||||
<!-- Назначенные -->
|
<v-tabs-window-item class="my-2 ">
|
||||||
<v-tabs-window-item>
|
<CatalogTest title="Назначенные" :activeTab="activeTab" :testingCard="getAllTests">
|
||||||
<v-card outlined>
|
<template #buttons>
|
||||||
<v-card-title>
|
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||||
Назначенные
|
Тренироваться
|
||||||
</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>
|
||||||
<v-btn color="teal-darken-4">Пройти</v-btn>
|
<v-btn color="teal-darken-1" elevation="0">
|
||||||
</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>
|
||||||
<v-btn color="teal-darken-4">Пройти</v-btn>
|
|
||||||
</template>
|
</template>
|
||||||
</v-data-table>
|
</CatalogTest>
|
||||||
</v-card>
|
</v-tabs-window-item>
|
||||||
|
<!-- Вкладка завершенных -->
|
||||||
|
<v-tabs-window-item>
|
||||||
|
<CatalogTest title="Завершенные" :activeTab="activeTab" :testingCard="getAllTests">
|
||||||
|
<!-- Здесь отобразить результат теста после того как будет готов БЭК и УМТ -->
|
||||||
|
<template #results>
|
||||||
|
<!-- <div>
|
||||||
|
<v-icon icon="mdi-calendar-clock" size="large" />
|
||||||
|
<span class="ml-1">12354</span>
|
||||||
|
</div> -->
|
||||||
|
</template>
|
||||||
|
<template #buttons>
|
||||||
|
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||||
|
Результаты
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</CatalogTest>
|
||||||
|
</v-tabs-window-item>
|
||||||
|
<!-- Вкладка каталога -->
|
||||||
|
<v-tabs-window-item>
|
||||||
|
<CatalogTest title="Каталог" :activeTab="activeTab" :testingCard="getAllTests">
|
||||||
|
<template #buttons>
|
||||||
|
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
|
||||||
|
Тренироваться
|
||||||
|
</v-btn>
|
||||||
|
</template>
|
||||||
|
</CatalogTest>
|
||||||
</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 CatalogTest from "@/components/testing/CatalogTest.vue";
|
||||||
import TestCard from "@/components/tests/TestCard.vue";
|
import { axiosApiInstance } from "@/utils/axios-api";
|
||||||
|
|
||||||
|
import { ref, computed, watch } from "vue"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {TestCard},
|
components: {
|
||||||
|
CatalogTest
|
||||||
|
},
|
||||||
setup() {
|
setup() {
|
||||||
const activeTab = ref(0);
|
const activeTab = ref(0);
|
||||||
const search = ref('');
|
const currentTest = ref('')
|
||||||
|
|
||||||
const headers = [
|
const getAllTests = ref([])
|
||||||
{text: 'Картинка', value: 'image', sortable: false},
|
|
||||||
{text: 'Название', value: 'title', align: 'start'},
|
|
||||||
{text: 'Действия', value: 'actions', sortable: false},
|
|
||||||
];
|
|
||||||
|
|
||||||
const tests = ref([
|
const getTestById = () => {
|
||||||
{
|
let status = activeTab.value == 0 ? '?status=active' : activeTab.value == 1 ? '?status=completed' : ''
|
||||||
id: 1,
|
axiosApiInstance.get(`/api/tests/gettests/${status}`).then(resp => getAllTests.value = resp.data).finally(() => {
|
||||||
title: 'Комплекс тестовых вопросов на знание в области информационно-коммуникационных технологий',
|
if (activeTab.value == 0) {
|
||||||
type: 'test',
|
currentTest.value = getAllTests.value.length
|
||||||
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();
|
getTestById()
|
||||||
|
|
||||||
const scheduledTests = computed(() => {
|
watch (() => activeTab.value,
|
||||||
return tests.value.filter(test => new Date(test.date) > currentDate);
|
() => {
|
||||||
});
|
getTestById()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const completedTests = computed(() => {
|
const tabs = computed(() => [
|
||||||
return tests.value.filter(test => new Date(test.date) <= currentDate);
|
{ value: 0, title: `Назначенные (${currentTest.value})`, },
|
||||||
});
|
{ value: 1, title: 'Завершенные', },
|
||||||
|
{ value: 2, title: 'Каталог', },
|
||||||
|
])
|
||||||
|
|
||||||
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 {
|
return {
|
||||||
activeTab,
|
activeTab,
|
||||||
search,
|
tabs,
|
||||||
headers,
|
getAllTests,
|
||||||
tests,
|
}
|
||||||
filteredTests,
|
}
|
||||||
filteredScheduledTests,
|
|
||||||
filteredCompletedTests,
|
|
||||||
scheduledTests,
|
|
||||||
completedTests,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.v-data-table__wrapper {
|
|
||||||
overflow-x: auto;
|
|
||||||
}
|
}
|
||||||
</style>
|
</script>
|
||||||
Reference in new issue
Block a user