Merge branch 'Alex' into develop

This commit is contained in:
Nukeap committed 2025-01-31 13:40:00 +03:00
commit f99d7463a9
6 files changed
+156 -217

No files matched your search

@@ -0,0 +1,18 @@
<template>
<v-container>
<HeaderDetailTesting />
</v-container>
</template>
<script>
import HeaderDetailTesting from './HeaderDetailTesting.vue';
export default {
components: {
HeaderDetailTesting,
}
}
</script>
@@ -0,0 +1,36 @@
<template>
<v-row class="ma-0 border-b-thin">
<v-col cols="auto" class="flex-grow-1">
<div class="text-subtitle-1 text-grey-lighten-1">Тест</div>
<div class="text-h5">{{ title }}</div>
</v-col>
<v-col cols="auto" class="d-flex flex-column">
<div class="align-self-end text-grey-lighten-1">!!!</div>
<div class="text-h4 text-grey-lighten-1">{{ time }}Таймер сюдаааа!!!</div>
</v-col>
</v-row>
<v-row class="ma-0 border-b-thin">
<v-col cols="auto" class="flex-grow-1">
<v-btn elevation="1" color="teal-darken-1" size="x-small" rounded icon="mdi-information-outline"/>
</v-col>
<v-col cols="auto" class="align-self-center">
<v-btn elevation="0" color="#0000001F" rounded="1">Выйти</v-btn>
</v-col>
</v-row>
</template>
<script>
export default {
props: {
title: {
type: String,
default: 'Название теста здесь',
},
time: {
}
}
}
</script>
+6
View File
@@ -177,6 +177,12 @@ const routes = [
ico: "mdi-account",
},
},
{
path: "/test/testdetail/:id",
name: "TestDetail",
component: () =>
import("@/components/testing/DetailCardTest.vue")
},
{
path: '/secret',
name: 'Secret Page',
+88 -213
View File
@@ -1,223 +1,98 @@
<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 :fluid="true">
<v-tabs v-model="activeTab" class="mb-2 text-teal-darken-4">
<v-tab v-for="tab in tabs" :key="tab.value" :value="tab.value"> {{ tab.title }} </v-tab>
</v-tabs>
<v-tabs-window v-model="activeTab" class="border-t-thin">
<!-- Вкладка назначенные -->
<v-tabs-window-item class="my-2 ">
<CatalogTest title="Назначенные" :activeTab="activeTab" :testingCard="getAllTests">
<template #buttons>
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
Тренироваться
</v-btn>
<v-btn color="teal-darken-1" elevation="0">
Пройти
</v-btn>
</template>
</CatalogTest>
</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>
</v-container>
</template>
<script>
import {computed, ref} from 'vue';
import TestCard from "@/components/tests/TestCard.vue";
import CatalogTest from "@/components/testing/CatalogTest.vue";
import { axiosApiInstance } from "@/utils/axios-api";
import { ref, computed, watch } from "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,
};
components: {
CatalogTest
},
};
</script>
setup() {
const activeTab = ref(0);
const currentTest = ref('')
const getAllTests = ref([])
<style>
.v-data-table__wrapper {
overflow-x: auto;
const getTestById = () => {
let status = activeTab.value == 0 ? '?status=active' : activeTab.value == 1 ? '?status=completed' : ''
axiosApiInstance.get(`/api/tests/gettests/${status}`).then(resp => getAllTests.value = resp.data).finally(() => {
if (activeTab.value == 0) {
currentTest.value = getAllTests.value.length
}
})
}
getTestById()
watch (() => activeTab.value,
() => {
getTestById()
}
)
const tabs = computed(() => [
{ value: 0, title: `Назначенные (${currentTest.value})`, },
{ value: 1, title: 'Завершенные', },
{ value: 2, title: 'Каталог', },
])
return {
activeTab,
tabs,
getAllTests,
}
}
}
</style>
</script>
+3 -3
View File
@@ -20,11 +20,12 @@
<!-- Вкладка завершенных -->
<v-tabs-window-item>
<CatalogTest title="Завершенные" :activeTab="activeTab" :testingCard="getAllTests">
<!-- Здесь отобразить результат теста после того как будет готов БЭК и УМТ -->
<template #results>
<div>
<!-- <div>
<v-icon icon="mdi-calendar-clock" size="large" />
<span class="ml-1">12354</span>
</div>
</div> -->
</template>
<template #buttons>
<v-btn color="#00897B1F" class="mr-2 text-teal-darken-1" elevation="0">
@@ -44,7 +45,6 @@
</CatalogTest>
</v-tabs-window-item>
</v-tabs-window>
{{ getAllTests }}
</v-container>
</template>