diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index 8b5145784..46bab2575 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -5,15 +5,40 @@ Информация -

- {{ data?.description }} -

-

- Время на прохождение — {{ data?.time }} минут -

+
+
+ +
+ + + Время на прохождение: {{ data?.time }} {{ timeWordDeclension }} + +
+ +
+ + + Количество вопросов: {{ data?.question_count }} + +
+ +
+ + + Количество попыток: {{ data?.attemps_number }} + +
+ +
+ + + Проходной балл: {{ data?.pass_perc }}% + +
+
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, '
'); + }; + return { - isExamMode + isExamMode, + timeWordDeclension, + formatDescription }; } }; + + diff --git a/src/front/src/components/testing/CatalogTest.vue b/src/front/src/components/testing/CatalogTest.vue index 4890db2ba..1e0e9b087 100644 --- a/src/front/src/components/testing/CatalogTest.vue +++ b/src/front/src/components/testing/CatalogTest.vue @@ -32,9 +32,7 @@
{{ cardValue.name }}
-
- {{ cardValue.description }} -
+
@@ -152,7 +150,13 @@ export default { return val; }; - return { search, searchTest, momenter, activeTabIcon, baseURL }; + const formatDescription = (text) => { + if (!text) return ''; + // Заменяем \r\n и \n на
+ return text.replace(/\r?\n/g, '
'); + }; + + return { search, searchTest, momenter, activeTabIcon, baseURL, formatDescription }; }, }; @@ -197,4 +201,9 @@ export default { background: rgba(0, 0, 0, 0.02); border-radius: 8px; } + +.test-description { + white-space: pre-wrap; + word-wrap: break-word; +} diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue index d2c62ab89..19e223465 100644 --- a/src/front/src/components/testing/DetailCardTest.vue +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -33,7 +33,7 @@ :correctAnswers="correctAnswers" :answeredQuestions="answeredQuestions" :totalQuestions="data.question_count" - :formattedTime="formattedTime" + :formattedTime="formatSpentTime" :questions="data?.questions" :userAnswers="answers" @restart="startTest" @@ -81,6 +81,13 @@ export default { const data = ref(null); const testingId = ref(null); const testResults = ref(null); + const spentTime = ref(0); + + const formatSpentTime = computed(() => { + const minutes = Math.floor(spentTime.value / 60); + const seconds = spentTime.value % 60; + return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; + }); const getTestById = async (id) => { const resp = await axiosApiInstance.get(`/api/tests/testdetail/${id}`); @@ -131,7 +138,9 @@ export default { answers.value = Array(data.value.questions.length).fill(null); - data.value = { ...data.value, time: data.value.time * 60 }; + const initialTime = data.value.time * 60; + data.value = { ...data.value, time: initialTime }; + spentTime.value = 0; if (timer) { clearInterval(timer); @@ -140,6 +149,7 @@ export default { timer = setInterval(() => { if (data.value?.time > 0) { data.value = { ...data.value, time: data.value.time - 1 }; + spentTime.value += 1; } else { finishTest(); } @@ -253,6 +263,7 @@ export default { testStarted, testFinished, formattedTime, + formatSpentTime, startTest, finishTest, answers, diff --git a/src/front/src/components/testing/QuestionBlock.vue b/src/front/src/components/testing/QuestionBlock.vue index 5d6cd7343..afb2bf184 100644 --- a/src/front/src/components/testing/QuestionBlock.vue +++ b/src/front/src/components/testing/QuestionBlock.vue @@ -1,7 +1,7 @@