From c26bf2f9c5e8b34bd0d5b3701dd3ed1cfa50e0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 27 Mar 2023 16:16:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AD=A6=E4=B9=A0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=98=BE=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course.ts | 2 +- src/pages/course/index.tsx | 5 ++++- src/pages/latest-learn/index.tsx | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/api/course.ts b/src/api/course.ts index 6753c0e..603604c 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -19,7 +19,7 @@ export function record(courseId: number, hourId: number, duration: number) { //观看ping export function playPing(courseId: number, hourId: number) { - return client.get(`/api/v1/course/${courseId}/hour/${hourId}/ping`, {}); + return client.post(`/api/v1/course/${courseId}/hour/${hourId}/ping`, {}); } //最近学习课程 diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 00605be..1cebebc 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -162,7 +162,10 @@ const CoursePage = () => { title={it.title} record={learnHourRecord[it.id]} duration={it.duration} - progress={learnHourRecord[it.id].progress} + progress={ + (learnHourRecord[it.id].finished_duration * 100) / + learnHourRecord[it.id].total_duration + } onChange={() => getDetail()} > )} diff --git a/src/pages/latest-learn/index.tsx b/src/pages/latest-learn/index.tsx index 0da0605..a57e751 100644 --- a/src/pages/latest-learn/index.tsx +++ b/src/pages/latest-learn/index.tsx @@ -6,6 +6,7 @@ import { Row, Col, Empty, Spin, Image } from "antd"; const LatestLearnPage = () => { const [loading, setLoading] = useState(false); const [courses, setCourses] = useState([]); + useEffect(() => { getCourses(); @@ -14,7 +15,10 @@ const LatestLearnPage = () => { const getCourses = () => { setLoading(true); course.latestLearn().then((res: any) => { - setCourses(res.data); + + setCourses(res.data); + + setLoading(false); }); };