From aed9a39a2fdc1b9f3b6e0a99f48d1d6eae7660d1 Mon Sep 17 00:00:00 2001 From: Denzel Date: Tue, 18 Feb 2025 13:55:59 +0300 Subject: [PATCH] =?UTF-8?q?refactor=20[P-36=20=D0=A3=D0=9C=D0=A2]:=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D0=BA=D1=80=D0=B5=D1=82=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/testing/CatalogTest.vue | 6 ++- .../src/components/testing/DetailCardTest.vue | 37 ++++++++++++++++++- .../src/components/testing/QuestionBlock.vue | 8 ++-- src/front/src/views/TestHomePage.vue | 6 +-- src/front/src/views/VoteHomePage.vue | 8 ++-- 5 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/front/src/components/testing/CatalogTest.vue b/src/front/src/components/testing/CatalogTest.vue index 7f519d3b8..563605fa2 100644 --- a/src/front/src/components/testing/CatalogTest.vue +++ b/src/front/src/components/testing/CatalogTest.vue @@ -22,7 +22,9 @@
{{ cardValue.name }}
-
{{ cardValue.description }}
+
+ {{ cardValue.description }} +
@@ -33,7 +35,7 @@
- + diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue index 670c0009f..737127e09 100644 --- a/src/front/src/components/testing/DetailCardTest.vue +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -57,10 +57,16 @@ import BodyDetailTesting from '@/components/testing/BodyDetailTesting.vue'; import QuestionBlock from '@/components/testing/QuestionBlock.vue'; import TestResults from '@/components/testing/TestResults.vue'; import { axiosApiInstance } from '@/utils/axios-api'; +import { useRoute } from 'vue-router'; +import { useAccountStore } from '../../store/AccountStore'; +// import fernet from 'fernet'; export default { components: { BodyDetailTesting, HeaderDetailTesting, QuestionBlock, TestResults }, setup() { + const route = useRoute(); + const accountStore = useAccountStore(); + const testId = route.params.id; const testStarted = ref(false); const testFinished = ref(false); const showFinishDialog = ref(false); @@ -74,6 +80,35 @@ export default { console.log(data.value); }; + // const userLogin = accountStore.user; + // const encryptedData = + // 'gAAAAABntEv1Gi_kxhY4EJTyxFetzeiNaE5uu4w43lzljCw9_2xJzLkFM7Gj08cS5eZ0ULw_s_eLAI_Jxf2nVYh_fK4Z5EAhVA=='; + // + // async function decryptData(encryptedData, userLogin) { + // const encoder = new TextEncoder(); + // const userKeyBuffer = await crypto.subtle.digest('SHA-256', encoder.encode(userLogin)); + // + // // Конвертация ArrayBuffer в Base64 + // const userKeyArray = Array.from(new Uint8Array(userKeyBuffer)); + // const base64Key = btoa(String.fromCharCode(...userKeyArray)); + // + // // Создаём секретный ключ + // const secret = new fernet.Secret(base64Key); + // + // // Расшифровываем данные + // const token = new fernet.Token({ + // secret: secret, + // token: encryptedData, + // ttl: 0, + // }); + // + // return token.decode(); + // } + // + // decryptData(encryptedData, userLogin) + // .then((decrypted) => console.log('Расшифрованное значение:', decrypted)) + // .catch((err) => console.error('Ошибка расшифровки:', err)); + const formattedTime = computed(() => { if (!data.value?.time) return '00:00'; @@ -147,7 +182,7 @@ export default { }); onMounted(() => { - getTestById(1); + getTestById(testId); }); return { diff --git a/src/front/src/components/testing/QuestionBlock.vue b/src/front/src/components/testing/QuestionBlock.vue index bd4b41ad0..0fbef3432 100644 --- a/src/front/src/components/testing/QuestionBlock.vue +++ b/src/front/src/components/testing/QuestionBlock.vue @@ -4,7 +4,7 @@ Вопрос {{ currentQuestion + 1 }} из {{ totalQuestions }} -

{{ question.name }}

+

{{ question.name }}

diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 3b01ea513..386eef477 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -30,12 +30,12 @@ -