视频详情优化

This commit is contained in:
禺狨 2023-07-05 09:44:52 +08:00
parent 25867876d4
commit 00b74f5ab0
2 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import styles from "./index.module.scss";
import { useNavigate, useParams } from "react-router-dom";
import backIcon from "../../assets/images/commen/icon-back-n.png";
import { course as vod } from "../../api/index";
import { isEmptyObject } from "../../utils/index";
import { Empty } from "../../components";
import { HourCompenent } from "./compenents/hour";
@ -68,7 +69,7 @@ const CoursePage = () => {
useEffect(() => {
if (learnRecord?.progress) {
setUserCourseProgress(Math.floor(learnRecord.progress / 100));
} else if (learnHourRecord && JSON.stringify(learnHourRecord) !== "{}") {
} else if (learnHourRecord && !isEmptyObject(learnHourRecord)) {
setUserCourseProgress(1);
} else {
setUserCourseProgress(0);

View File

@ -76,3 +76,7 @@ export function isMobile() {
);
return flag;
}
export function isEmptyObject(obj: Object) {
return Object.keys(obj).length === 0;
}