feat [P-227]: поправил стили

This commit is contained in:
Denis Voinovich committed 2025-05-29 16:25:12 +03:00
1 parent 57e144d1d5
commit 7108b2f393
5 files changed
+296 -49

No files matched your search

@@ -1,18 +1,21 @@
<template> <template>
<v-container class="pa-4"> <v-container :class="{ 'pa-4': !isDialog, 'pa-0': isDialog }">
<v-row class="justify-center mt-6"> <v-row class="justify-center" :class="{ 'mt-6': !isDialog, 'ma-0': isDialog }">
<v-col cols="12" md="8" lg="6"> <v-col :cols="isDialog ? 12 : '12'" :md="isDialog ? 12 : '8'" :lg="isDialog ? 12 : '6'" class="pa-0">
<v-card elevation="2"> <v-card :elevation="isDialog ? 0 : 2" class="rounded-lg">
<v-card-title class="text-h6 font-weight-bold">Информация</v-card-title> <v-card-title v-if="!isDialog" class="text-h6 font-weight-bold">Информация</v-card-title>
<v-card-text class="d-flex flex-lg-column ga-6 border-b-thin"> <v-card-text :class="[
<p> 'd-flex flex-lg-column ga-6',
{ 'border-b-thin': !isDialog, 'pa-0': isDialog }
]">
<p class="text-body-1">
{{ data?.description }} {{ data?.description }}
</p> </p>
<p> <p v-if="!isDialog">
<strong>Время на прохождение — {{ data?.time }} минут</strong> <strong>Время на прохождение — {{ data?.time }} минут</strong>
</p> </p>
</v-card-text> </v-card-text>
<v-card-actions class="mx-2 my-4"> <v-card-actions v-if="!isDialog" class="mx-2 my-4">
<v-btn <v-btn
color="white" color="white"
class="ml-auto bg-teal-darken-1 px-9" class="ml-auto bg-teal-darken-1 px-9"
@@ -35,6 +38,10 @@ export default {
props: { props: {
startTest: Function, startTest: Function,
data: Object, data: Object,
isDialog: {
type: Boolean,
default: false
}
}, },
setup() { setup() {
const route = useRoute(); const route = useRoute();
@@ -1,63 +1,73 @@
<!-- Раздел с назначенным тестированием --> <!-- Раздел с назначенным тестированием -->
<template> <template>
<div class="my-4 text-h5">{{ title }}</div> <div class="my-4 text-h5 font-weight-medium">{{ title }}</div>
<v-container :fluid="true"> <v-container :fluid="true">
<v-row> <v-row>
<v-text-field <v-text-field
v-model="search" v-model="search"
append-inner-icon="mdi-magnify" append-inner-icon="mdi-magnify"
label="Найти тестирование по названию" label="Найти тестирование по названию"
variant="solo" variant="outlined"
density="comfortable"
bg-color="grey-lighten-4"
class="search-field"
hide-details
@click:append-inner="searchTest" @click:append-inner="searchTest"
clearable clearable
/> />
</v-row> </v-row>
</v-container> </v-container>
<!-- Карточка где буду отрисовываться тесты в цикле --> <!-- Карточка где буду отрисовываться тесты в цикле -->
<v-card v-for="cardValue in searchTest" :key="cardValue.id" class="my-2 border-sm"> <v-card
<v-row class="pa-2"> v-for="cardValue in searchTest"
:key="cardValue.id"
class="my-4 test-card"
elevation="2"
:class="{ 'passed-test': activeTab === 0 && cardValue.is_passed }"
>
<v-row class="pa-4">
<v-col cols="2" class="justify-center my-auto"> <v-col cols="2" class="justify-center my-auto">
<v-img :src="cardValue.file" class="mx-auto" /> <v-img :src="cardValue.file" class="mx-auto rounded-lg" max-height="120" contain />
</v-col> </v-col>
<v-col cols="auto" class="d-flex flex-grow-1"> <v-col cols="auto" class="d-flex flex-grow-1">
<div class="d-flex flex-column justify-center flex-grow-1"> <div class="d-flex flex-column justify-center flex-grow-1">
<div class="text-body-1 font-weight-medium mb-2">{{ cardValue.name }}</div> <div class="text-h6 font-weight-bold mb-2">{{ cardValue.name }}</div>
<div class="text-body-1 text-disabled mb-2" style="max-width: 600px"> <div class="text-body-1 text-grey-darken-1 mb-4" style="max-width: 600px">
{{ cardValue.description }} {{ cardValue.description }}
</div> </div>
<div class="d-flex ga-4"> <div class="d-flex flex-wrap gap-4">
<slot name="results"></slot> <slot name="results"></slot>
<div v-for="icon in activeTabIcon"> <div v-for="icon in activeTabIcon" class="d-inline-flex align-center test-info-item">
<v-icon :color="icon.color" :icon="icon.icon" size="large" /> <v-icon :color="icon.color" :icon="icon.icon" size="small" class="mr-2" />
<span class="ml-1">{{ momenter(cardValue[icon.field], icon.field) }}</span> <span class="text-body-2">{{ momenter(cardValue[icon.field], icon.field) }}</span>
</div> </div>
</div> </div>
</div> </div>
</v-col> </v-col>
<v-col cols="auto" class="align-self-center"> <v-col cols="auto" class="align-self-center">
<template v-if="activeTab === 0 && cardValue.is_passed"> <template v-if="activeTab === 0 && cardValue.is_passed">
<div class="d-flex align-center"> <div class="d-flex align-center status-badge success">
<v-icon color="teal-darken-1" icon="mdi-check-circle-outline" size="large" class="mr-2" /> <v-icon color="teal-darken-1" icon="mdi-check-circle-outline" size="small" class="mr-2" />
<span class="text-teal-darken-1 text-body-1 font-weight-medium">Сдано успешно</span> <span class="text-teal-darken-1 text-body-2 font-weight-medium">Сдано успешно</span>
</div> </div>
</template> </template>
<template v-else-if="cardValue.attemps_number > 0"> <template v-else-if="cardValue.attemps_number > 0">
<slot name="buttons" :cardValue="cardValue"></slot> <slot name="buttons" :cardValue="cardValue"></slot>
</template> </template>
<template v-else> <template v-else>
<div class="d-flex align-center"> <div class="d-flex align-center status-badge error">
<v-icon color="red-darken-1" icon="mdi-alert-circle-outline" size="large" class="mr-2" /> <v-icon color="red-darken-1" icon="mdi-alert-circle-outline" size="small" class="mr-2" />
<span class="text-red-darken-1 text-body-1 font-weight-medium">Попытки закончились</span> <span class="text-red-darken-1 text-body-2 font-weight-medium">Попытки закончились</span>
</div> </div>
</template> </template>
</v-col> </v-col>
</v-row> </v-row>
</v-card> </v-card>
<!-- Если данные отсутствуют, выводим сообщение об этом --> <!-- Если данные отсутствуют, выводим сообщение об этом -->
<v-container v-if="!searchTest.length" :fluid="true" class="h-100"> <v-container v-if="!searchTest.length" :fluid="true" class="empty-state">
<v-row class="align-center flex-column"> <v-row class="align-center flex-column pa-8">
<v-icon icon="mdi-note-off-outline" color="grey-lighten-1" size="x-large" /> <v-icon icon="mdi-note-off-outline" color="grey-lighten-1" size="64" class="mb-4" />
<v-card-title class="text-h4 text-grey-lighten-1">Данные не найдены</v-card-title> <v-card-title class="text-h5 text-grey-darken-1 font-weight-medium text-center">Данные не найдены</v-card-title>
</v-row> </v-row>
</v-container> </v-container>
</template> </template>
@@ -146,3 +156,51 @@ export default {
}, },
}; };
</script> </script>
<style scoped>
.test-card {
transition: all 0.3s ease;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.test-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}
.passed-test {
border-left: 4px solid rgb(0, 150, 136);
}
.search-field {
max-width: 400px;
}
.test-info-item {
padding: 4px 12px;
background: rgba(0, 150, 136, 0.05);
border-radius: 16px;
}
.status-badge {
padding: 8px 16px;
border-radius: 20px;
}
.status-badge.success {
background: rgba(0, 150, 136, 0.1);
}
.status-badge.error {
background: rgba(244, 67, 54, 0.1);
}
.empty-state {
min-height: 300px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(0, 0, 0, 0.02);
border-radius: 8px;
}
</style>
@@ -45,8 +45,14 @@
<v-card-title class="text-h6">Завершить тест?</v-card-title> <v-card-title class="text-h6">Завершить тест?</v-card-title>
<v-card-text>Вы уверены, что хотите завершить тестирование?</v-card-text> <v-card-text>Вы уверены, что хотите завершить тестирование?</v-card-text>
<v-card-actions class="d-flex justify-end"> <v-card-actions class="d-flex justify-end">
<v-btn color="teal-darken-4" @click="finishTest">Да, завершить</v-btn> <v-btn variant="tonal" color="teal-darken-4" @click="finishTest">
<v-btn color="grey" @click="showFinishDialog = false">Отмена</v-btn> <v-icon start>mdi-check</v-icon>
Да, завершить
</v-btn>
<v-btn variant="outlined" color="grey" @click="showFinishDialog = false">
<v-icon start>mdi-close</v-icon>
Отмена
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -286,3 +292,71 @@ export default {
}, },
}; };
</script> </script>
<style>
/* Общие стили компонента */
.v-container {
background-color: #f5f5f5;
border-radius: 8px;
}
/* Стили для кнопок */
.v-btn {
transition: transform 0.2s;
}
.v-btn:hover {
transform: translateY(-2px);
}
/* Стили для диалогового окна */
.v-dialog .v-card {
border-radius: 8px;
}
.v-dialog .v-card-title {
background-color: #004d40;
color: white;
padding: 16px;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
}
.v-dialog .v-card-actions {
padding: 16px;
background-color: #f5f5f5;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
:deep(.v-label) {
margin-bottom: 8px;
color: #004d40;
}
:deep(.v-img) {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.timer {
font-size: 1.2rem;
color: #004d40;
font-weight: bold;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.question-enter-active {
animation: fadeIn 0.3s ease-out;
}
</style>
@@ -1,27 +1,38 @@
<template> <template>
<v-container class="pa-4"> <v-container class="pa-4">
<v-row align="center" class="border-b-thin"> <v-row align="center" class="border-b-thin mb-4">
<v-col class="text-h6 font-weight-regular"> <v-col class="text-h5 font-weight-medium text-teal-darken-2">
{{ data?.name }} {{ data?.name }}
</v-col> </v-col>
<span class="text-h6 text-grey-darken-1 font-weight-bold mr-4">{{ formattedTime }}</span> <span class="text-h6 text-grey-darken-1 font-weight-medium mr-4">{{ formattedTime }}</span>
</v-row> </v-row>
<v-row align="center" class="border-b-thin pa-2"> <v-row align="center" class="border-b-thin pa-2">
<v-btn <v-btn
elevation="1" elevation="1"
color="teal-darken-1" color="teal-darken-2"
size="x-small" size="small"
rounded rounded
class="mr-4"
icon="mdi-information-outline" icon="mdi-information-outline"
/> @click="showInfoDialog = true"
>
<v-icon icon="mdi-information-outline" />
<v-tooltip
activator="parent"
location="top"
>
Информация о тесте
</v-tooltip>
</v-btn>
<!-- Пагинация только при запущенном тесте -->
<v-pagination <v-pagination
v-if="testStarted" v-if="testStarted"
:length="totalQuestions" :length="totalQuestions"
:total-visible="5" :total-visible="5"
active-color="teal-darken-4" active-color="teal-darken-2"
density="comfortable"
class="mx-4"
:model-value="currentQuestion + 1" :model-value="currentQuestion + 1"
@update:model-value="changePage" @update:model-value="changePage"
></v-pagination> ></v-pagination>
@@ -30,8 +41,10 @@
v-if="testStarted" v-if="testStarted"
elevation="0" elevation="0"
color="red-darken-1" color="red-darken-1"
variant="tonal"
rounded="lg" rounded="lg"
class="ml-auto" class="ml-auto px-6"
prepend-icon="mdi-close-circle"
@click="finishTest" @click="finishTest"
> >
Завершить Завершить
@@ -39,22 +52,60 @@
<v-btn <v-btn
v-else v-else
elevation="0" elevation="0"
color="grey-lighten-3" color="grey-darken-1"
variant="tonal"
rounded="lg" rounded="lg"
class="ml-auto" class="ml-auto px-6"
prepend-icon="mdi-exit-to-app"
@click="showExitDialog = true" @click="showExitDialog = true"
> >
Выйти Выйти
</v-btn> </v-btn>
</v-row> </v-row>
<!-- Диалоговое окно информации -->
<v-dialog v-model="showInfoDialog" width="600">
<v-card class="rounded-lg">
<v-card-title class="d-flex justify-space-between align-center px-4 py-3 bg-teal-darken-2">
<span class="text-white font-weight-medium">Информация о тесте</span>
<v-btn
icon="mdi-close"
variant="text"
color="white"
size="small"
@click="showInfoDialog = false"
/>
</v-card-title>
<v-card-text class="px-4 py-4">
<BodyDetailTesting
:data="data"
:startTest="startTest"
:isDialog="true"
/>
</v-card-text>
</v-card>
</v-dialog>
<!-- Диалоговое окно выхода --> <!-- Диалоговое окно выхода -->
<v-dialog v-model="showExitDialog" width="400"> <v-dialog v-model="showExitDialog" width="400">
<v-card> <v-card class="rounded-lg">
<v-card-title class="text-h6">Вы действительно хотите выйти?</v-card-title> <v-card-title class="text-h6 pa-4 bg-grey-lighten-4">Вы действительно хотите выйти?</v-card-title>
<v-card-actions> <v-card-actions class="pa-4">
<v-btn color="red" @click="exitTest">Да</v-btn> <v-spacer></v-spacer>
<v-btn color="grey" @click="showExitDialog = false">Отмена</v-btn> <v-btn
color="grey-darken-1"
variant="text"
@click="showExitDialog = false"
>
Отмена
</v-btn>
<v-btn
color="red-darken-1"
variant="tonal"
@click="exitTest"
>
Да, выйти
</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -63,8 +114,12 @@
<script> <script>
import { ref } from 'vue'; import { ref } from 'vue';
import BodyDetailTesting from '@/components/testing/BodyDetailTesting.vue';
export default { export default {
components: {
BodyDetailTesting
},
props: { props: {
testStarted: Boolean, testStarted: Boolean,
formattedTime: String, formattedTime: String,
@@ -77,10 +132,12 @@ export default {
default: 'Тест', default: 'Тест',
}, },
}, },
startTest: Function,
}, },
emits: ['change-question'], emits: ['change-question'],
setup(props, { emit }) { setup(props, { emit }) {
const showExitDialog = ref(false); const showExitDialog = ref(false);
const showInfoDialog = ref(false);
const exitTest = () => { const exitTest = () => {
showExitDialog.value = false; showExitDialog.value = false;
@@ -91,7 +148,7 @@ export default {
emit('change-question', newPage - 1); emit('change-question', newPage - 1);
}; };
return { showExitDialog, exitTest, changePage }; return { showExitDialog, showInfoDialog, exitTest, changePage };
}, },
}; };
</script> </script>
@@ -167,4 +167,55 @@ export default {
.text-error { .text-error {
color: #FF5252 !important; color: #FF5252 !important;
} }
.v-card {
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}
.v-card-title {
background-color: #009688;
color: white;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
padding: 16px !important;
}
.v-radio-group :deep(.v-radio),
.v-checkbox {
margin-bottom: 12px;
transition: transform 0.2s;
}
.v-radio-group :deep(.v-radio:hover),
.v-checkbox:hover {
transform: translateX(4px);
}
.v-btn {
text-transform: none;
font-weight: 500;
border-radius: 8px;
transition: transform 0.2s;
}
.v-btn:hover {
transform: translateY(-2px);
}
.v-card-actions {
padding: 16px;
background-color: #f5f5f5;
border-bottom-left-radius: 12px;
border-bottom-right-radius: 12px;
}
:deep(.v-label) {
margin-bottom: 8px;
}
:deep(.v-img) {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
</style> </style>