feat: Add core e-learning pages for authentication, course discovery, learning, and user dashboard.

This commit is contained in:
supalerk-ar66 2026-01-30 14:42:08 +07:00
parent c4f68eb927
commit 9629f79c52
5 changed files with 13 additions and 65 deletions

View file

@ -20,7 +20,7 @@ const route = useRoute()
const router = useRouter()
const { t } = useI18n()
const { user } = useAuth()
const { fetchCourseLearningInfo, fetchLessonContent, saveVideoProgress, markLessonComplete, checkLessonAccess, fetchVideoProgress } = useCourse()
const { fetchCourseLearningInfo, fetchLessonContent, saveVideoProgress, checkLessonAccess, fetchVideoProgress } = useCourse()
// Media Prefs (Global Volume)
const { volume, muted: isMuted, setVolume, setMuted, applyTo } = useMediaPrefs()
@ -44,7 +44,7 @@ const isPlaying = ref(false)
const videoProgress = ref(0)
const currentTime = ref(0)
const duration = ref(0)
const saveProgressInterval = ref<any>(null) // setInterval
// const saveProgressInterval = ref<any>(null) // Removed unused interval
// Helper for localization
const getLocalizedText = (text: any) => {
@ -351,7 +351,7 @@ const videoSrc = computed(() => {
// 3. (Progress Tracking)
// ==========================================
// 10
// 10
// Event Listeners for Robustness
onMounted(() => {
// Page/Tab Visibility Logic
@ -404,31 +404,15 @@ watch(isPlaying, (playing) => {
})
// (Complete)
// (Complete)
const onVideoEnded = async () => {
isPlaying.value = false
// Force save progress at 100%
await performSaveProgress(true, false)
// Call explicit complete endpoint if exists
// Call explicit complete endpoint if exists
// REMOVED: User requested to remove explicit complete call
/*
if (currentLesson.value) {
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) {
// Refresh course data to update certificate status
await loadCourseData()
alert(t('course.completed') || "ยินดีด้วย! คุณเรียนจบหลักสูตรแล้ว")
}
}
}
*/
// Just refresh local state assuming server handles completion via progress
if (currentLesson.value) {
@ -457,7 +441,7 @@ onMounted(() => {
})
onBeforeUnmount(() => {
clearInterval(saveProgressInterval.value)
})
</script>