From f0ef2a827d9f4ada788e6e4d76f77569e82ba02f Mon Sep 17 00:00:00 2001 From: callmeyan Date: Sun, 22 Dec 2024 23:16:58 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=BD=93=E5=89=8D=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/video/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/video/index.tsx b/src/pages/video/index.tsx index d9a8d30..6b29fb6 100644 --- a/src/pages/video/index.tsx +++ b/src/pages/video/index.tsx @@ -74,9 +74,12 @@ export default function VideoIndex() { useEffect(loadList, []) const totalDuration = useMemo(() => { if (!videoData || videoData.length == 0) return 0; + if(state.playingIndex == -1 || state.playingIndex >= videoData.length) return 0 + const v= videoData[state.playingIndex] as VideoInfo; + return Math.ceil(v.duration / 1000) // 计算总时长 - return videoData.reduce((sum, v) => sum + Math.ceil(v.duration / 1000), 0); - }, [videoData]) + //return videoData.reduce((sum, v) => sum + Math.ceil(v.duration / 1000), 0); + }, [videoData,state.playingIndex]) return (
{contextHolder} @@ -171,6 +174,7 @@ export default function VideoIndex() {
} +