diff --git a/src/components/videoPro/index.tsx b/src/components/videoPro/index.tsx index c032bd8..477e1af 100644 --- a/src/components/videoPro/index.tsx +++ b/src/components/videoPro/index.tsx @@ -9,17 +9,21 @@ import unfull from "@/static/img/exitFullscreen.png" type Props = { src: string - onRef: any + onRef?: any + showFull?: boolean } -const VideoPro:FC = ({src,onRef}) => { +const VideoPro:FC = ({src,onRef,showFull}) => { const globalData = Taro.getApp().globalData - //用useImperativeHandle暴露一些外部ref能访问的属性 - useImperativeHandle(onRef, () => { - return { - func: pause, - } - }) + + if(onRef){ + //用useImperativeHandle暴露一些外部ref能访问的属性 + useImperativeHandle(onRef, () => { + return { + func: pause, + } + }) + } // 视频ui控制需要的响应式数据 const videoContext = useRef() @@ -178,16 +182,16 @@ const VideoPro:FC = ({src,onRef}) => { {videoContext.current.pause();setIsPlay(false)}} /> : {videoContext.current.play();setIsPlay(true)}} /> } - {process_duration} + {process_duration} - { - isFull?videoContext.current.exitFullScreen():videoContext.current.requestFullScreen({direction:90}) - }} className="text-white font-26 pr-1">{total_duration} - { - isFull? {videoContext.current.exitFullScreen()}} src={unfull} /> - : {videoContext.current.requestFullScreen({direction:90})}} /> + {total_duration} + { showFull && + <> + {isFull? {videoContext.current.exitFullScreen()}} src={unfull} /> + : {videoContext.current.requestFullScreen({direction:90})}} />} + } } diff --git a/src/pages/preview/brand/article/article.tsx b/src/pages/preview/brand/article/article.tsx index 1d1831c..884ef60 100644 --- a/src/pages/preview/brand/article/article.tsx +++ b/src/pages/preview/brand/article/article.tsx @@ -155,7 +155,7 @@ const article: FC = () => { {articleInfo?.title} { articleInfo?.owner_type === 1 && articleInfo?.brands?.map(d => ( - + @@ -183,7 +183,7 @@ const article: FC = () => { { articleInfo?.owner_type === 2 && articleInfo?.illness?.map(d => ( - + diff --git a/src/pages/preview/brand/info/info.tsx b/src/pages/preview/brand/info/info.tsx index ccf290e..7e481ec 100644 --- a/src/pages/preview/brand/info/info.tsx +++ b/src/pages/preview/brand/info/info.tsx @@ -24,7 +24,6 @@ const BrandInfo: FC = () => { const [enable, setEnable] = useState(true) let VideoRef = React.createRef() - Taro.useDidHide(() => { console.log("页面隐藏",VideoRef.current.func) // 视频被隐藏后自动暂停播放了,再打开自动继续播放了 @@ -103,7 +102,7 @@ const BrandInfo: FC = () => { onChange={onChange} > {brandInfo?.introductory_video_resource?.url && - + } { (brandInfo?.brand_album?.length || 0) > 0 @@ -132,7 +131,7 @@ const BrandInfo: FC = () => { { articleList?.length ? <>{ - articleList.map(d => )} + articleList.map(d => )} :