feat: implement online classroom page with curriculum sidebar, video player, and announcement system
This commit is contained in:
parent
41089dd5ea
commit
438bc6cd23
2 changed files with 8 additions and 3 deletions
|
|
@ -85,7 +85,7 @@ const getLocalizedText = (text: any) => {
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
||||||
<q-item-section side>
|
<q-item-section side>
|
||||||
<q-icon v-if="lesson.is_completed" name="check_circle" color="positive" size="xs" />
|
<q-icon v-if="lesson.is_completed || lesson.progress?.is_completed" name="check_circle" color="positive" size="xs" />
|
||||||
<q-icon v-else-if="currentLessonId === lesson.id" name="play_circle" color="primary" size="xs" />
|
<q-icon v-else-if="currentLessonId === lesson.id" name="play_circle" color="primary" size="xs" />
|
||||||
<q-icon v-else name="radio_button_unchecked" color="grey-4" size="xs" />
|
<q-icon v-else name="radio_button_unchecked" color="grey-4" size="xs" />
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,7 @@ const loadLesson = async (lessonId: number) => {
|
||||||
if (lesson) {
|
if (lesson) {
|
||||||
if (!lesson.progress) lesson.progress = {}
|
if (!lesson.progress) lesson.progress = {}
|
||||||
lesson.progress.is_completed = true
|
lesson.progress.is_completed = true
|
||||||
|
lesson.is_completed = true // Standardize completion property
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -372,8 +373,12 @@ const performSaveProgress = async (force: boolean = false, keepalive: boolean =
|
||||||
try {
|
try {
|
||||||
const res = await saveVideoProgress(lesson.id, maxSec, durationSec, keepalive)
|
const res = await saveVideoProgress(lesson.id, maxSec, durationSec, keepalive)
|
||||||
|
|
||||||
// Handle Completion (Rely on Backend's auto-complete response)
|
// Handle Completion (Frontend-only strategy: 95% threshold)
|
||||||
if (res.success && res.data?.is_completed) {
|
// This ensures the checkmark appears at 95% to match backend.
|
||||||
|
const progressPercentage = durationSec > 0 ? (maxSec / durationSec) : 0
|
||||||
|
const isCompletedNow = res.success && (res.data?.is_completed || progressPercentage >= 0.95)
|
||||||
|
|
||||||
|
if (isCompletedNow) {
|
||||||
markLessonAsCompletedLocally(lesson.id)
|
markLessonAsCompletedLocally(lesson.id)
|
||||||
if (lesson.progress) lesson.progress.is_completed = true
|
if (lesson.progress) lesson.progress.is_completed = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue