108 lines
3.6 KiB
Vue
108 lines
3.6 KiB
Vue
<template>
|
|
<v-container :class="{ 'pa-4': !isDialog, 'pa-0': isDialog }">
|
|
<v-row class="justify-center" :class="{ 'mt-6': !isDialog, 'ma-0': isDialog }">
|
|
<v-col :cols="isDialog ? 12 : '12'" :md="isDialog ? 12 : '8'" :lg="isDialog ? 12 : '6'" class="pa-0">
|
|
<v-card :elevation="isDialog ? 0 : 2" class="rounded-lg">
|
|
<v-card-title v-if="!isDialog" class="text-h6 font-weight-bold">Информация</v-card-title>
|
|
<v-card-text :class="[
|
|
'd-flex flex-column ga-6',
|
|
{ 'border-b-thin': !isDialog, 'pa-0': isDialog }
|
|
]">
|
|
<div class="test-info">
|
|
<div class="text-body-1 mb-4" v-html="formatDescription(data?.description)"></div>
|
|
|
|
<div class="d-flex align-center mb-3">
|
|
<v-icon icon="mdi-clock-outline" color="teal-darken-2" class="mr-2" />
|
|
<span class="text-body-1">
|
|
<strong>Время на прохождение:</strong> {{ data?.time }} {{ timeWordDeclension }}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="d-flex align-center mb-3">
|
|
<v-icon icon="mdi-format-list-numbered" color="teal-darken-2" class="mr-2" />
|
|
<span class="text-body-1">
|
|
<strong>Количество вопросов:</strong> {{ data?.question_count }}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="d-flex align-center mb-3">
|
|
<v-icon icon="mdi-refresh" color="teal-darken-2" class="mr-2" />
|
|
<span class="text-body-1">
|
|
<strong>Количество попыток:</strong> {{ data?.attemps_number }}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="d-flex align-center">
|
|
<v-icon icon="mdi-percent" color="teal-darken-2" class="mr-2" />
|
|
<span class="text-body-1">
|
|
<strong>Проходной балл:</strong> {{ data?.pass_perc }}%
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</v-card-text>
|
|
<v-card-actions v-if="!isDialog" class="mx-2 my-4">
|
|
<v-btn
|
|
color="white"
|
|
class="ml-auto bg-teal-darken-1 px-9"
|
|
@click="startTest"
|
|
>
|
|
{{ isExamMode ? 'Начать' : 'Тренироваться' }}
|
|
</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-col>
|
|
</v-row>
|
|
</v-container>
|
|
</template>
|
|
|
|
<script>
|
|
import { useRoute } from 'vue-router';
|
|
import { computed } from 'vue';
|
|
|
|
export default {
|
|
props: {
|
|
startTest: Function,
|
|
data: Object,
|
|
isDialog: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
},
|
|
setup(props) {
|
|
const route = useRoute();
|
|
const isExamMode = computed(() => route.query.mode === 'exam');
|
|
|
|
const timeWordDeclension = computed(() => {
|
|
if (!props.data?.time) return 'минут';
|
|
|
|
const lastDigit = props.data.time % 10;
|
|
const lastTwoDigits = props.data.time % 100;
|
|
|
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 14) return 'минут';
|
|
if (lastDigit === 1) return 'минута';
|
|
if (lastDigit >= 2 && lastDigit <= 4) return 'минуты';
|
|
return 'минут';
|
|
});
|
|
|
|
const formatDescription = (text) => {
|
|
if (!text) return '';
|
|
return text.replace(/\r?\n/g, '<br>');
|
|
};
|
|
|
|
return {
|
|
isExamMode,
|
|
timeWordDeclension,
|
|
formatDescription
|
|
};
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped>
|
|
.test-info {
|
|
padding: 16px;
|
|
border-radius: 8px;
|
|
background-color: rgba(0, 150, 136, 0.05);
|
|
}
|
|
</style>
|