|
|
|
@ -14,6 +14,9 @@ const VideoInfo: FC = () => { |
|
|
|
|
const [preview, setPreview] = useState(false) |
|
|
|
|
const [playing, setPlaying] = useState(false) |
|
|
|
|
|
|
|
|
|
// Taro.useSaveExitState(() => ({
|
|
|
|
|
// data: {playId}
|
|
|
|
|
// }))
|
|
|
|
|
|
|
|
|
|
const getData = useCallback(async () => { |
|
|
|
|
const res = await curriculum.courseDep(id, depId) |
|
|
|
@ -25,10 +28,10 @@ const VideoInfo: FC = () => { |
|
|
|
|
} |
|
|
|
|
}, [playing]) |
|
|
|
|
|
|
|
|
|
function curEnd() { |
|
|
|
|
const curEnd = useCallback(() => { |
|
|
|
|
setPlaying(false) |
|
|
|
|
getData().then() |
|
|
|
|
} |
|
|
|
|
}, [data, playing, playId]) |
|
|
|
|
|
|
|
|
|
function setHors(is_complete: boolean, play_id: number) { |
|
|
|
|
setPlaying(true) |
|
|
|
@ -38,7 +41,7 @@ const VideoInfo: FC = () => { |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
getData() |
|
|
|
|
}, []) |
|
|
|
|
}, [id]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 播放下一个视频 */ |
|
|
|
@ -75,7 +78,9 @@ const VideoInfo: FC = () => { |
|
|
|
|
const courseHourRecordsFinish = data?.learn_hour_records.find(d => d.id === playId)?.courseHourRecordsFinish |
|
|
|
|
if (typeof courseHourRecordsFinish === 'number') { |
|
|
|
|
if (courseHourRecordsFinish === 1) { |
|
|
|
|
if (!playing) { |
|
|
|
|
playNext() |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Taro.showModal({ |
|
|
|
|
title: '有考卷还未完成', |
|
|
|
|