feat: Add i18n support with English and Thai locales and implement the new classroom learning page with course curriculum and video playback.
This commit is contained in:
parent
6146d65949
commit
38e7f1bf06
3 changed files with 45 additions and 6 deletions
|
|
@ -17,6 +17,7 @@ useHead({
|
|||
})
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { t } = useI18n()
|
||||
const { user } = useAuth()
|
||||
const { fetchCourseLearningInfo, fetchLessonContent, saveVideoProgress, markLessonComplete, checkLessonAccess, fetchVideoProgress } = useCourse()
|
||||
|
|
@ -415,8 +416,26 @@ const onVideoEnded = async () => {
|
|||
const res = await markLessonComplete(courseId.value, currentLesson.value.id)
|
||||
if (res.success) {
|
||||
markLessonAsCompletedLocally(currentLesson.value.id)
|
||||
|
||||
// If course completed
|
||||
if (res.data.is_course_completed) {
|
||||
alert("ยินดีด้วย! คุณเรียนจบหลักสูตรแล้ว")
|
||||
// Refresh course data to update certificate status
|
||||
await loadCourseData()
|
||||
alert(t('course.completed') || "ยินดีด้วย! คุณเรียนจบหลักสูตรแล้ว")
|
||||
} else if (res.data.next_lesson_id) {
|
||||
// Suggest next lesson
|
||||
if (confirm(t('common.next') + '?')) {
|
||||
const nextId = res.data.next_lesson_id
|
||||
|
||||
// Update URL without reload if possible, but router.push is standard
|
||||
await router.push({
|
||||
path: '/classroom/learning',
|
||||
query: { ...route.query, lesson_id: nextId }
|
||||
})
|
||||
|
||||
// Manually load the lesson since we don't have a watcher on query
|
||||
handleLessonSelect(nextId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue