diff --git a/src/components/custom-page-container/custom-page-container.tsx b/src/components/custom-page-container/custom-page-container.tsx index 339f6f7..9b32f3b 100644 --- a/src/components/custom-page-container/custom-page-container.tsx +++ b/src/components/custom-page-container/custom-page-container.tsx @@ -5,13 +5,23 @@ import Taro from "@tarojs/taro"; const PageContainerInner: FC = (props) => { const [visible, setVisible] = useState(props.show) + const [playing, setPlaying] = useState(false) + useEffect(() => { if (visible !== props) { if (props.show) { - setVisible(props.show) + if (playing) { + setTimeout(() => { + setVisible(props.show) + },300) + } else { + setVisible(props.show) + } } else { + setPlaying(true) setTimeout(() => { + setPlaying(false) setVisible(props.show) }, 300) } @@ -78,6 +88,9 @@ const PageContainerInner: FC = (props) => { } const CustomPageContainer: FC = (props) => { + if (props.position === 'center') { + return + } if (process.env.TARO_ENV !== 'h5') { return () } diff --git a/src/components/showModel/showModel.module.scss b/src/components/showModel/showModel.module.scss index cc79a1c..f0473d4 100644 --- a/src/components/showModel/showModel.module.scss +++ b/src/components/showModel/showModel.module.scss @@ -4,16 +4,17 @@ width: 100%; border-top: 1px solid #eee; - & > * { - padding: 20px 0; - flex: 1; - width: 50%; - text-align: center; - color: #45D4A8; +} + +.cancel { + padding: 30px 0; + flex: 1; + width: 50%; + text-align: center; + color: #45D4A8; - &:first-child { - color: #000; - border-right: 1px solid #ddd; - } + &:first-child { + color: #000; + border-right: 1px solid #ddd; } } diff --git a/src/components/showModel/showModel.tsx b/src/components/showModel/showModel.tsx index 3a31772..198b8d2 100644 --- a/src/components/showModel/showModel.tsx +++ b/src/components/showModel/showModel.tsx @@ -19,7 +19,7 @@ const ShowModel: FC = (pros) => { {pros.children} 取消 - {pros.okText || '确定'} + {pros.okText || '确定'} ) diff --git a/src/components/video/video.tsx b/src/components/video/video.tsx index f845868..955375c 100644 --- a/src/components/video/video.tsx +++ b/src/components/video/video.tsx @@ -52,7 +52,7 @@ const HVideo: FC = (opt: HVideoOptions) => { } } - Taro.useUnload(() => { + Taro.useDidHide(() => { video?.stop() unique_ident.put(Number(currentTime.toFixed(2)), Date.now()) }) diff --git a/src/components/videoCover/videoCover.tsx b/src/components/videoCover/videoCover.tsx index 1dc2d7e..4161eb9 100644 --- a/src/components/videoCover/videoCover.tsx +++ b/src/components/videoCover/videoCover.tsx @@ -28,7 +28,7 @@ const VideoCover: FC = (opt: VideoCoverProps) => { - + {opt.content && {opt.content}} {opt.marker && {opt.marker}} diff --git a/src/pages/business/videoInfo/components/catalogue.tsx b/src/pages/business/videoInfo/components/catalogue.tsx index d3269e2..eaee913 100644 --- a/src/pages/business/videoInfo/components/catalogue.tsx +++ b/src/pages/business/videoInfo/components/catalogue.tsx @@ -76,7 +76,8 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { function learning() { const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] - if (data?.learn_record?.finished_count === data?.learn_record?.hour_count && flats.length) { + + if ((data?.learn_hour_records?.length || undefined) == data?.learn_record?.hour_count && flats.length) { setHors(true, flats[0].id) return } @@ -96,7 +97,6 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { } } - return ( <> diff --git a/src/pages/business/videoInfo/videoInfo.tsx b/src/pages/business/videoInfo/videoInfo.tsx index dd29702..6d1ea78 100644 --- a/src/pages/business/videoInfo/videoInfo.tsx +++ b/src/pages/business/videoInfo/videoInfo.tsx @@ -12,9 +12,10 @@ const VideoInfo: FC = () => { const [data, setData] = useState(null) const [playId, setPlayId] = useState(null) const [preview, setPreview] = useState(false) + const [playing, setPlaying] = useState(false) - const getData = async () => { + const getData = useCallback(async () => { const res = await curriculum.courseDep(id, depId) if (res) { setData(res) @@ -22,9 +23,15 @@ const VideoInfo: FC = () => { if (playId) { // 用于自动播放 判断当前课程是否完成 currentVideo(res) } + }, [playing]) + + function curEnd() { + setPlaying(false) + getData().then() } function setHors(is_complete: boolean, play_id: number) { + setPlaying(true) setPreview(is_complete) setPlayId(play_id) } @@ -86,14 +93,12 @@ const VideoInfo: FC = () => { data && getData() }) - - return ( <> {playId ? - + : }