课程学习记录显示优化

This commit is contained in:
禺狨 2023-03-27 16:16:54 +08:00
parent 7afb99751f
commit c26bf2f9c5
3 changed files with 10 additions and 3 deletions

View File

@ -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`, {});
}
//最近学习课程

View File

@ -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()}
></HourCompenent>
)}

View File

@ -6,6 +6,7 @@ import { Row, Col, Empty, Spin, Image } from "antd";
const LatestLearnPage = () => {
const [loading, setLoading] = useState<boolean>(false);
const [courses, setCourses] = useState<any>([]);
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);
});
};