refactor [P-36 УМТ]: страница конкретного теста
This commit is contained in:
1 parent
e6327bfcb0
commit
aed9a39a2f
5 files changed
+51
-14
No files matched your search
@@ -22,7 +22,9 @@
|
|||||||
<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-body-1 font-weight-medium mb-2">{{ cardValue.name }}</div>
|
||||||
<div class="text-body-1 text-disabled mb-2">{{ cardValue.description }}</div>
|
<div class="text-body-1 text-disabled mb-2" style="max-width: 600px">
|
||||||
|
{{ cardValue.description }}
|
||||||
|
</div>
|
||||||
<div class="d-flex ga-4">
|
<div class="d-flex ga-4">
|
||||||
<slot name="results"></slot>
|
<slot name="results"></slot>
|
||||||
<div v-for="icon in activeTabIcon">
|
<div v-for="icon in activeTabIcon">
|
||||||
@@ -33,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="auto" class="align-self-center">
|
<v-col cols="auto" class="align-self-center">
|
||||||
<slot name="buttons"></slot>
|
<slot name="buttons" :cardValue="cardValue"></slot>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</v-card>
|
</v-card>
|
||||||
|
|||||||
@@ -57,10 +57,16 @@ import BodyDetailTesting from '@/components/testing/BodyDetailTesting.vue';
|
|||||||
import QuestionBlock from '@/components/testing/QuestionBlock.vue';
|
import QuestionBlock from '@/components/testing/QuestionBlock.vue';
|
||||||
import TestResults from '@/components/testing/TestResults.vue';
|
import TestResults from '@/components/testing/TestResults.vue';
|
||||||
import { axiosApiInstance } from '@/utils/axios-api';
|
import { axiosApiInstance } from '@/utils/axios-api';
|
||||||
|
import { useRoute } from 'vue-router';
|
||||||
|
import { useAccountStore } from '../../store/AccountStore';
|
||||||
|
// import fernet from 'fernet';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { BodyDetailTesting, HeaderDetailTesting, QuestionBlock, TestResults },
|
components: { BodyDetailTesting, HeaderDetailTesting, QuestionBlock, TestResults },
|
||||||
setup() {
|
setup() {
|
||||||
|
const route = useRoute();
|
||||||
|
const accountStore = useAccountStore();
|
||||||
|
const testId = route.params.id;
|
||||||
const testStarted = ref(false);
|
const testStarted = ref(false);
|
||||||
const testFinished = ref(false);
|
const testFinished = ref(false);
|
||||||
const showFinishDialog = ref(false);
|
const showFinishDialog = ref(false);
|
||||||
@@ -74,6 +80,35 @@ export default {
|
|||||||
console.log(data.value);
|
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(() => {
|
const formattedTime = computed(() => {
|
||||||
if (!data.value?.time) return '00:00';
|
if (!data.value?.time) return '00:00';
|
||||||
|
|
||||||
@@ -147,7 +182,7 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getTestById(1);
|
getTestById(testId);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
Вопрос {{ currentQuestion + 1 }} из {{ totalQuestions }}
|
Вопрос {{ currentQuestion + 1 }} из {{ totalQuestions }}
|
||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<h3>{{ question.name }}</h3>
|
<h3 class="mb-4">{{ question.name }}</h3>
|
||||||
<v-img
|
<v-img
|
||||||
v-if="question.file"
|
v-if="question.file"
|
||||||
:src="`http://127.0.0.1:8000${question.file}`"
|
:src="`http://127.0.0.1:8000${question.file}`"
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
/>
|
/>
|
||||||
<v-radio-group v-model="answers[currentQuestion]">
|
<v-radio-group v-model="answers[currentQuestion]">
|
||||||
<v-radio
|
<v-radio
|
||||||
v-for="(option, index) in question.settings.options"
|
v-for="(option, index) in question.answers"
|
||||||
:key="index"
|
:key="index"
|
||||||
:label="option"
|
:label="option.name"
|
||||||
:value="option"
|
:value="option.name"
|
||||||
/>
|
/>
|
||||||
</v-radio-group>
|
</v-radio-group>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
<!-- Вкладка каталога -->
|
<!-- Вкладка каталога -->
|
||||||
<v-tabs-window-item class="w-75 mx-auto h-100">
|
<v-tabs-window-item class="w-75 mx-auto h-100">
|
||||||
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" title="Каталог">
|
<CatalogTest :activeTab="activeTab" :testingCard="getAllTests" title="Каталог">
|
||||||
<template #buttons>
|
<template #buttons="{ cardValue }">
|
||||||
<v-btn
|
<v-btn
|
||||||
class="mr-2 text-teal-darken-1"
|
class="mr-2 text-teal-darken-1"
|
||||||
color="#00897B1F"
|
color="#00897B1F"
|
||||||
elevation="0"
|
elevation="0"
|
||||||
@click="goToTest"
|
@click="goToTest(cardValue.id)"
|
||||||
>
|
>
|
||||||
Тренироваться
|
Тренироваться
|
||||||
</v-btn>
|
</v-btn>
|
||||||
@@ -92,7 +92,7 @@ export default {
|
|||||||
{ value: 2, title: 'Каталог' },
|
{ value: 2, title: 'Каталог' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const goToTest = () => router.push('/test/testdetail/:id');
|
const goToTest = (id) => router.push(`/test/testdetail/${id}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeTab,
|
activeTab,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<v-col class="pa-0 overflow-hidden">
|
<v-col class="pa-0 overflow-hidden">
|
||||||
<v-window v-model="currentTab" class="h-100">
|
<v-window v-model="currentTab" class="h-100">
|
||||||
<!-- Текущие голосования -->
|
<!-- Текущие голосования -->
|
||||||
<v-tabs-window-item
|
<v-window-item
|
||||||
v-for="x in ['active', 'completed']"
|
v-for="x in ['active', 'completed']"
|
||||||
:value="x"
|
:value="x"
|
||||||
class="h-100 overflow-auto"
|
class="h-100 overflow-auto"
|
||||||
@@ -29,15 +29,15 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<NoneVote v-else :current="currentTab === 'active' ? 'Текущих' : 'Завершенных'" />
|
<NoneVote v-else :current="currentTab === 'active' ? 'Текущих' : 'Завершенных'" />
|
||||||
</v-tabs-window-item>
|
</v-window-item>
|
||||||
<!-- Конструктор -->
|
<!-- Конструктор -->
|
||||||
<v-tabs-window-item
|
<v-window-item
|
||||||
v-if="accountStore.user.is_staff"
|
v-if="accountStore.user.is_staff"
|
||||||
class="h-100 overflow-auto"
|
class="h-100 overflow-auto"
|
||||||
value="constructor"
|
value="constructor"
|
||||||
>
|
>
|
||||||
<VoteConstructor @updating="updating" ref="constructor" />
|
<VoteConstructor @updating="updating" ref="constructor" />
|
||||||
</v-tabs-window-item>
|
</v-window-item>
|
||||||
</v-window>
|
</v-window>
|
||||||
|
|
||||||
<!-- Модальные окна -->
|
<!-- Модальные окна -->
|
||||||
|
|||||||
Reference in new issue
Block a user