diff --git a/src/pages/course/video.tsx b/src/pages/course/video.tsx
index 8f2265d..e540291 100644
--- a/src/pages/course/video.tsx
+++ b/src/pages/course/video.tsx
@@ -44,7 +44,6 @@ const CoursePlayPage = () => {
const totalRef = useRef(0);
useEffect(() => {
- window.player && window.player.destroy();
getCourse();
getDetail();
}, [params.courseId, params.hourId]);
@@ -129,6 +128,7 @@ const CoursePlayPage = () => {
const getVideoUrl = (data: any) => {
Course.playUrl(Number(params.courseId), Number(params.hourId)).then(
(res: any) => {
+ window.player && window.player.destroy();
setPlayUrl(res.data.url);
initDPlayer(res.data.url, 0, data);
}
@@ -236,7 +236,6 @@ const CoursePlayPage = () => {
};
const playVideo = (cid: number, id: number) => {
- window.player && window.player.destroy();
navigate(`/course/${cid}/hour/${id}`, { replace: true });
};
diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx
index 733ee82..d7ff20f 100644
--- a/src/pages/index/index.tsx
+++ b/src/pages/index/index.tsx
@@ -7,6 +7,7 @@ import { useSelector } from "react-redux";
import { useNavigate, useLocation } from "react-router-dom";
import { Footer, TabBarFooter, Empty } from "../../components";
import { CoursesModel } from "./compenents/courses-model";
+import { isEmptyObject } from "../../utils/index";
type LocalUserLearnHourRecordModel = {
[key: number]: UserLearnHourRecordModel;
@@ -74,7 +75,7 @@ const IndexPage = () => {
return;
}
getData();
- }, [tabKey, currentDepId, categoryId]);
+ }, [currentDepId, categoryId]);
const getData = () => {
setLoading(true);
@@ -127,7 +128,7 @@ const IndexPage = () => {
const getParams = () => {
user.coursesCategories().then((res: any) => {
const categories = res.data.categories;
- if (JSON.stringify(categories) !== "{}") {
+ if (!isEmptyObject(categories)) {
const new_arr: any[] = checkArr(categories, 0);
new_arr.unshift({
key: 0,
@@ -204,9 +205,16 @@ const IndexPage = () => {
activeKey={tabKey}
onChange={(key: any) => {
setTabKey(key);
- navigate(
- "/?cid=" + categoryId + "&catName=" + categoryText + "&tab=" + key
- );
+ setTimeout(() => {
+ navigate(
+ "/?cid=" +
+ categoryId +
+ "&catName=" +
+ categoryText +
+ "&tab=" +
+ key
+ );
+ }, 250);
}}
style={{
"--fixed-active-line-width": "20px",
diff --git a/src/pages/study/compenents/courses-model.module.scss b/src/pages/study/compenents/courses-model.module.scss
index 4489140..40bcef5 100644
--- a/src/pages/study/compenents/courses-model.module.scss
+++ b/src/pages/study/compenents/courses-model.module.scss
@@ -4,6 +4,7 @@
display: flex;
flex-direction: row;
align-items: center;
+ margin-bottom: 20px;
.info {
flex: 1;
height: 75px;
diff --git a/src/pages/study/compenents/courses-model.tsx b/src/pages/study/compenents/courses-model.tsx
index 0a78b6d..a92a6e1 100644
--- a/src/pages/study/compenents/courses-model.tsx
+++ b/src/pages/study/compenents/courses-model.tsx
@@ -91,7 +91,6 @@ export const CoursesModel: React.FC
= ({