From 1146373ca03081f62435e02e7d7eec7cc7fee978 Mon Sep 17 00:00:00 2001 From: supalerk-ar66 Date: Thu, 12 Feb 2026 16:15:09 +0700 Subject: [PATCH] feat: Implement quiz functionality with a new dedicated page and comprehensive internationalization strings. --- Frontend-Learner/i18n/locales/en.json | 2 +- Frontend-Learner/i18n/locales/th.json | 2 +- Frontend-Learner/pages/classroom/quiz.vue | 26 ++++++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Frontend-Learner/i18n/locales/en.json b/Frontend-Learner/i18n/locales/en.json index c648a957..c680a1e6 100644 --- a/Frontend-Learner/i18n/locales/en.json +++ b/Frontend-Learner/i18n/locales/en.json @@ -206,7 +206,7 @@ }, "quiz": { "exitTitle": "Exit Quiz", - "exitConfirm": "You are taking a quiz. If you leave now, your progress will be lost. Are you sure you want to exit?", + "exitConfirm": "Do you want to exit the quiz? Your quiz attempt will be cancelled.", "startTitle": "End of Chapter Quiz", "preparationTitle": "Preparation before starting", "instructionTitle": "Instructions", diff --git a/Frontend-Learner/i18n/locales/th.json b/Frontend-Learner/i18n/locales/th.json index d9e41426..9e693b98 100644 --- a/Frontend-Learner/i18n/locales/th.json +++ b/Frontend-Learner/i18n/locales/th.json @@ -224,7 +224,7 @@ "exitTitle": "ออกจากแบบทดสอบ", "timeLeft": "เวลาที่เหลือ", "submitConfirm": "คุณต้องการส่งคำตอบหรือไม่?", - "exitConfirm": "คุณต้องการออกจากแบบทดสอบหรือไม่? การทำแบบทดสอบจะถูกยกเลิก", + "exitConfirm": "คุณต้องการออกจากแบบทดสอบหรือไม่? การทำแบบทดสอบของคุณจะถูกยกเลิก", "submitValues": "ส่งคำตอบ", "question": "คำถาม", "backToLesson": "กลับไปหน้าเรียน", diff --git a/Frontend-Learner/pages/classroom/quiz.vue b/Frontend-Learner/pages/classroom/quiz.vue index 9d9b6d86..6bdf2d47 100644 --- a/Frontend-Learner/pages/classroom/quiz.vue +++ b/Frontend-Learner/pages/classroom/quiz.vue @@ -328,9 +328,29 @@ const confirmExit = () => { const target = courseId ? `/classroom/learning?course_id=${courseId}` : '/dashboard/my-courses' if (currentScreen.value === 'taking') { - if (confirm(t('quiz.exitConfirm'))) { - router.push(target) - } + $q.dialog({ + title: `
${t('quiz.exitTitle')}
`, + message: `
${t('quiz.exitConfirm')}
`, + html: true, + persistent: true, + class: 'rounded-[24px]', + ok: { + label: t('common.ok'), + color: 'primary', + unelevated: true, + rounded: true, + class: 'px-8 font-black' + }, + cancel: { + label: t('common.cancel'), + color: 'grey-7', + flat: true, + rounded: true, + class: 'font-bold' + } + }).onOk(() => { + router.push(target) + }) } else { router.push(target) }