From 97b8d5dab9fc1b99a385246fbe316ac0a4032dce Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Mon, 15 Dec 2025 20:14:54 +0100 Subject: [PATCH] question timers, little fixes to nav/store --- README.md | 2 +- components/MediaBox.vue | 27 +++++- components/ResultModal.vue | 6 +- components/bar/right/Exam.vue | 53 ++++++----- components/bar/right/Result.vue | 25 +++-- package.json | 1 + pages/anomaly.vue | 11 ++- pages/exam.vue | 163 ++++++++++++++++++++++---------- pages/index.vue | 6 +- pages/result.vue | 11 ++- pnpm-lock.yaml | 34 +++++++ store/examStore.ts | 10 +- 12 files changed, 242 insertions(+), 107 deletions(-) diff --git a/README.md b/README.md index 4e36209..fcd1e0b 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ You also need the exam media files from the (Ministry of Infrasture)[https://www - [x] beautify website (good for now) - [x] Fixed? Needs testing, but should be fine question-mark? - fix pinia middleware between pages, MAJOR ISSUE - finishing exam sometimes redirects to homepage instead of results, help appreciated - [x] (scrapped - lazy loading) +- [x] question timers - [ ] exam (& results?) warning leave message on exit and timer end (and definitely on refresh) -- [ ] question timers - [ ] i18n - pl, en, de, ua (not all questions are available in ua, api handle) - UI i18n - db: examstore add language field, api handle languages diff --git a/components/MediaBox.vue b/components/MediaBox.vue index 58f7c58..7cc0c59 100644 --- a/components/MediaBox.vue +++ b/components/MediaBox.vue @@ -6,8 +6,11 @@ const cdnUrl = runtimeConfig.public.cdn_url; const route = useRoute(); +const emit = defineEmits(['mediaload']); + const props = defineProps<{ mediaPath: string | null | undefined; + phase: string; }>(); const media = computed(() => { @@ -21,6 +24,21 @@ const media = computed(() => { } return { name: dotSplit?.join('.'), type }; }); + +const video = ref(); + +function onVideoLoad() { + if (route.path === '/exam') { + video.value.play(); + let duration = video.value.duration; + if (isNaN(duration) || duration == Infinity) { + duration = 0; + } + setTimeout(() => { + emit('mediaload'); + }, duration * 1000); + } +} diff --git a/components/ResultModal.vue b/components/ResultModal.vue index 65e4b7c..cd97fe9 100644 --- a/components/ResultModal.vue +++ b/components/ResultModal.vue @@ -5,7 +5,7 @@ onMounted(() => { myModal.value?.showModal(); }); -defineEmits(['again']); +defineEmits(['again', 'home']); diff --git a/components/bar/right/Result.vue b/components/bar/right/Result.vue index e07b057..277793f 100644 --- a/components/bar/right/Result.vue +++ b/components/bar/right/Result.vue @@ -12,6 +12,7 @@ const emit = defineEmits<{ changeNow: [value: string]; changeCount: [num: number]; again: []; + home: []; }>(); @@ -19,9 +20,9 @@ const emit = defineEmits<{
- +
Wróć na stronę główną - +