From f2cf8b6486fd81d5a0a3c6d23e230a93035f2621 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 28 Aug 2023 17:24:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=BC=B9=E7=AA=97=E7=AD=94?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/topic/single.tsx | 10 ++++++++++ src/components/video/type.ts | 7 ++++--- src/components/video/video.tsx | 7 +++++-- src/pages/business/videoInfo/components/course.tsx | 9 +++++++-- src/pages/business/videoInfo/videoInfo.scss | 5 +++++ 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 src/components/topic/single.tsx diff --git a/src/components/topic/single.tsx b/src/components/topic/single.tsx new file mode 100644 index 0000000..9a2f92d --- /dev/null +++ b/src/components/topic/single.tsx @@ -0,0 +1,10 @@ +import {FC} from "react"; +import {View} from "@tarojs/components"; + +export const Single:FC = ()=>{ + return( + 1 + ) +} + +export default Single diff --git a/src/components/video/type.ts b/src/components/video/type.ts index 82fe90b..a0fc3fa 100644 --- a/src/components/video/type.ts +++ b/src/components/video/type.ts @@ -1,3 +1,5 @@ +import {ReactNode} from "react"; + export interface HVideoOptions { /** 视频时长s */ duration: number @@ -9,11 +11,10 @@ export interface HVideoOptions { poster?: string /** 视频断点 */ breakpoint: number[] - /** 进入断点 */ onBreakpoint: (id: number) => void /** 视频播放结束 */ onEnded: () => void - - setTime: (fn:(time:number)=>void) => void + setTime: (fn: (time: number) => void) => void + children?: ReactNode } diff --git a/src/components/video/video.tsx b/src/components/video/video.tsx index e324452..69e9501 100644 --- a/src/components/video/video.tsx +++ b/src/components/video/video.tsx @@ -48,7 +48,8 @@ const HVideo: FC = (opt: HVideoOptions) => { if (process.env.TARO_ENV === 'h5') { try { document?.exitFullscreen().then() - } catch (e) {} + } catch (e) { + } } video?.exitFullScreen() opt.onBreakpoint(d) @@ -122,7 +123,9 @@ const HVideo: FC = (opt: HVideoOptions) => { onEnded={onEnded} onPlay={onPlay} onPause={onPause} - /> + > + {opt.children} + ) } diff --git a/src/pages/business/videoInfo/components/course.tsx b/src/pages/business/videoInfo/components/course.tsx index b8df4c7..53ba61b 100644 --- a/src/pages/business/videoInfo/components/course.tsx +++ b/src/pages/business/videoInfo/components/course.tsx @@ -1,4 +1,4 @@ -import {ScrollView, Text, View} from "@tarojs/components"; +import {CoverView, ScrollView, Text, View} from "@tarojs/components"; import {FC, useEffect, useState} from "react"; import HVideo from "@/components/video/video"; import {curriculum, HourPlayData} from "@/api"; @@ -9,6 +9,7 @@ import unique_ident from "@/hooks/unique_ident"; import MyButton from "@/components/button/MyButton"; import {formatMinute} from "@/utils/time"; import CustomPageContainer from "@/components/custom-page-container/custom-page-container"; +import Single from "@/components/topic/single"; interface Props { id: number, @@ -127,7 +128,11 @@ const Course: FC = ({id, courseId, preview, curEnd}) => { breakpoint={breakpoint} onBreakpoint={onBreakpoint} setTime={videoSeek} - /> + > + {/**/} + {/* */} + {/**/} + diff --git a/src/pages/business/videoInfo/videoInfo.scss b/src/pages/business/videoInfo/videoInfo.scss index 5c0a7ad..7057f0c 100644 --- a/src/pages/business/videoInfo/videoInfo.scss +++ b/src/pages/business/videoInfo/videoInfo.scss @@ -106,3 +106,8 @@ filter: saturate(0); } +.single-cover { + position: absolute; + color: #fff; +} +