diff --git a/src/pages/business/videoInfo/components/catalogue.tsx b/src/pages/business/videoInfo/components/catalogue.tsx index 7bcf800..132bda6 100644 --- a/src/pages/business/videoInfo/components/catalogue.tsx +++ b/src/pages/business/videoInfo/components/catalogue.tsx @@ -85,7 +85,7 @@ const Catalogue: FC = ({data, setHors, id}) => { if (flat.id === lastTimeId) { const next = flats[index + 1] if (next) { - setHors(true, lastTimeId) + setHors(true, next.id) } } } diff --git a/src/pages/business/videoInfo/components/course.tsx b/src/pages/business/videoInfo/components/course.tsx index e6dadd4..b1340c4 100644 --- a/src/pages/business/videoInfo/components/course.tsx +++ b/src/pages/business/videoInfo/components/course.tsx @@ -32,7 +32,7 @@ const Course: FC = ({id, courseId, preview, curEnd}: Props) => { const [count, setCount] = useState | null>(null) const [frequency, setFrequency] = useState(1) // 次数 const [testId, setTestId] = useState(null) - const [startRecording, setStartRecording] = useState(null) // 开始记录 + const [startRecording, setStartRecording] = useState(null) // 视频开始记录 const {user} = Profile.useContainer() @@ -179,7 +179,7 @@ const Course: FC = ({id, courseId, preview, curEnd}: Props) => { setTime={videoSeek} /> - + = ({id, courseId, preview, curEnd}: Props) => { {frequency === 0 && validate && } - + ) diff --git a/src/pages/business/videoInfo/videoInfo.tsx b/src/pages/business/videoInfo/videoInfo.tsx index 958e020..ebe0377 100644 --- a/src/pages/business/videoInfo/videoInfo.tsx +++ b/src/pages/business/videoInfo/videoInfo.tsx @@ -1,5 +1,5 @@ import {Image, Text, View} from "@tarojs/components"; -import {FC, useEffect, useState} from "react"; +import {FC, useCallback, useEffect, useState} from "react"; import {CourseDepData, curriculum} from "@/api"; import './videoInfo.scss' import {Profile} from '@/store' @@ -24,7 +24,7 @@ const VideoInfo: FC = () => { } /** 用于自动播放 判断当前课程是否完成 */ if (playId) { - currentVideo() + currentVideo(res) } } @@ -37,8 +37,9 @@ const VideoInfo: FC = () => { getData() }, []) + /** 播放下一个视频 */ - function playNext() { + const playNext = useCallback(() => { const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] if (playId === flats?.[flats.length - 1]?.id) { Taro.showModal({title: '当前课程结束'}) @@ -61,12 +62,12 @@ const VideoInfo: FC = () => { return } } - } + }, [playId, data]) /** * 判断当前课程是否完成 */ - function currentVideo() { + const currentVideo = useCallback((data: CourseDepData) => { const courseHourRecordsFinish = data?.learn_hour_records.find(d => d.id === playId)?.courseHourRecordsFinish if (typeof courseHourRecordsFinish === 'number') { if (courseHourRecordsFinish === 1) { @@ -82,7 +83,7 @@ const VideoInfo: FC = () => { }) } } - } + }, [playId, data]) Taro.useDidShow(() => { data && getData() diff --git a/src/static/img/curRecord.png b/src/static/img/curRecord.png new file mode 100644 index 0000000..02d6ac5 Binary files /dev/null and b/src/static/img/curRecord.png differ diff --git a/src/static/img/hourRecord.png b/src/static/img/hourRecord.png new file mode 100644 index 0000000..c87a275 Binary files /dev/null and b/src/static/img/hourRecord.png differ