mirror of
https://github.com/PlayEdu/h5.git
synced 2025-06-09 04:44:25 +08:00
视频详情优化
This commit is contained in:
parent
25867876d4
commit
00b74f5ab0
@ -4,6 +4,7 @@ import styles from "./index.module.scss";
|
|||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import backIcon from "../../assets/images/commen/icon-back-n.png";
|
import backIcon from "../../assets/images/commen/icon-back-n.png";
|
||||||
import { course as vod } from "../../api/index";
|
import { course as vod } from "../../api/index";
|
||||||
|
import { isEmptyObject } from "../../utils/index";
|
||||||
import { Empty } from "../../components";
|
import { Empty } from "../../components";
|
||||||
import { HourCompenent } from "./compenents/hour";
|
import { HourCompenent } from "./compenents/hour";
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ const CoursePage = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (learnRecord?.progress) {
|
if (learnRecord?.progress) {
|
||||||
setUserCourseProgress(Math.floor(learnRecord.progress / 100));
|
setUserCourseProgress(Math.floor(learnRecord.progress / 100));
|
||||||
} else if (learnHourRecord && JSON.stringify(learnHourRecord) !== "{}") {
|
} else if (learnHourRecord && !isEmptyObject(learnHourRecord)) {
|
||||||
setUserCourseProgress(1);
|
setUserCourseProgress(1);
|
||||||
} else {
|
} else {
|
||||||
setUserCourseProgress(0);
|
setUserCourseProgress(0);
|
||||||
|
@ -76,3 +76,7 @@ export function isMobile() {
|
|||||||
);
|
);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isEmptyObject(obj: Object) {
|
||||||
|
return Object.keys(obj).length === 0;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user