From c421e30b71c345de5f09d352b103a4d2609edf06 Mon Sep 17 00:00:00 2001 From: sunlizhou <296190577@qq.com> Date: Thu, 26 Oct 2023 15:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89ui=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=85=A8=E5=B1=8F=E5=8F=AF=E9=80=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/videoPro/index.tsx | 34 ++++++++++++--------- src/pages/preview/brand/article/article.tsx | 4 +-- src/pages/preview/brand/info/info.tsx | 5 ++- 3 files changed, 23 insertions(+), 20 deletions(-) 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 => )} :