From e5f9843a32edb3d696d297adbfa939223096f551 Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 9 Aug 2023 09:40:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=A4=A7=E5=B1=8F=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E8=BD=AE=E6=92=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fillion/containers/videoCenter.js | 2 +- .../containers/footer/build/videoMonitor.js | 30 +++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/web/client/src/sections/fillion/containers/videoCenter.js b/web/client/src/sections/fillion/containers/videoCenter.js index 42ff7e4a..700d3b76 100644 --- a/web/client/src/sections/fillion/containers/videoCenter.js +++ b/web/client/src/sections/fillion/containers/videoCenter.js @@ -15,7 +15,7 @@ function VideoCenter (props) { return (
- +
); } diff --git a/web/client/src/sections/quanju/containers/footer/build/videoMonitor.js b/web/client/src/sections/quanju/containers/footer/build/videoMonitor.js index 979f44af..deeecd13 100644 --- a/web/client/src/sections/quanju/containers/footer/build/videoMonitor.js +++ b/web/client/src/sections/quanju/containers/footer/build/videoMonitor.js @@ -25,12 +25,32 @@ const videoMonitor = (props) => { /> } + useEffect(() => { + const timer = setInterval(() => { + if (pageLeft + 1 < Math.ceil(videoCenterList?.length / 3)) { + setPageLeft(pageLeft + 1) + } else { + setPageLeft(0) + } + }, 1000 * 60 * 5); + return () => clearInterval(timer); + }, [pageLeft]); + + return ( videoCenterList?.length > 0 ?
{ - if (pageLeft > 0) setPageLeft(pageLeft - 1) + if (pageLeft == 0) { + if (Math.ceil(videoCenterList?.length / 3) == 0) { + setPageLeft(0) + } else { + setPageLeft(Math.ceil(videoCenterList?.length / 3) - 1) + } + } else { + setPageLeft(pageLeft - 1) + } }} /> -
+
{videoCenterList?.slice(pageLeft * 3, (pageLeft + 1) * 3)?.map((v, index) => { return
{renderVideo(v, index)} @@ -44,7 +64,11 @@ const videoMonitor = (props) => { })}
{ - if (pageLeft + 1 < Math.ceil(videoCenterList?.length / 3)) setPageLeft(pageLeft + 1) + if (pageLeft + 1 < Math.ceil(videoCenterList?.length / 3)) { + setPageLeft(pageLeft + 1) + } else { + setPageLeft(0) + } }} />