From 1b93895b52e0d4882f86517c59f5b04da5789522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Wed, 5 Jul 2023 11:13:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/video.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx index e540291..9567eeb 100644 --- a/src/pages/course/video.tsx +++ b/src/pages/course/video.tsx @@ -85,11 +85,14 @@ const CoursePlayPage = () => { setTotalHours(arr); totalHours = arr; } + //判断是否是最后的课时 const index = totalHours.findIndex( (i: any) => i.id === Number(params.hourId) ); if (index === totalHours.length - 1) { setIsLastpage(true); + } else { + setIsLastpage(false); } }); }; @@ -186,11 +189,11 @@ const CoursePlayPage = () => { window.player.seek(playRef.current); return; } + setPlayendedStatus(true); setPlayingTime(0); playTimeUpdate(parseInt(window.player.video.currentTime), true); exitFullscreen(); window.player && window.player.destroy(); - setPlayendedStatus(true); }); setLoading(false); }; @@ -217,6 +220,7 @@ const CoursePlayPage = () => { setIsLastpage(true); Toast.show("已经是最后一节了!"); } else if (index < totalHours.length - 1) { + setIsLastpage(false); navigate(`/course/${params.courseId}/hour/${totalHours[index + 1].id}`, { replace: true, }); @@ -251,7 +255,11 @@ const CoursePlayPage = () => { }} />