From a20490f28d8e99a85578e12ff6c553011f2cdb4d Mon Sep 17 00:00:00 2001 From: Ultrame <1019265060@qq.com> Date: Thu, 27 Nov 2025 15:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B4=BB=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=9B=B4=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/MyselfPageContent.tsx | 109 ++++++++++-------- 1 file changed, 59 insertions(+), 50 deletions(-) diff --git a/src/main_pages/components/MyselfPageContent.tsx b/src/main_pages/components/MyselfPageContent.tsx index 16f99d5..27615b0 100644 --- a/src/main_pages/components/MyselfPageContent.tsx +++ b/src/main_pages/components/MyselfPageContent.tsx @@ -43,25 +43,28 @@ const MyselfPageContent: React.FC = () => { }); // 分类球局数据(使用 useCallback 包装,避免每次渲染都创建新函数) - const classifyGameRecords = useCallback(( - game_records: TennisMatch[] - ): { notEndGames: TennisMatch[]; finishedGames: TennisMatch[] } => { - const now = new Date().getTime(); - return game_records.reduce( - (result, cur) => { - let { end_time } = cur; - end_time = end_time.replace(/\s/, "T"); - new Date(end_time).getTime() > now - ? result.notEndGames.push(cur) - : result.finishedGames.push(cur); - return result; - }, - { - notEndGames: [] as TennisMatch[], - finishedGames: [] as TennisMatch[], - } - ); - }, []); + const classifyGameRecords = useCallback( + ( + game_records: TennisMatch[] + ): { notEndGames: TennisMatch[]; finishedGames: TennisMatch[] } => { + const now = new Date().getTime(); + return game_records.reduce( + (result, cur) => { + let { end_time } = cur; + end_time = end_time.replace(/\s/, "T"); + new Date(end_time).getTime() > now + ? result.notEndGames.push(cur) + : result.finishedGames.push(cur); + return result; + }, + { + notEndGames: [] as TennisMatch[], + finishedGames: [] as TennisMatch[], + } + ); + }, + [] + ); // 使用 useCallback 包装 load_game_data,避免每次渲染都创建新函数 const load_game_data = useCallback(async () => { @@ -144,7 +147,7 @@ const MyselfPageContent: React.FC = () => { const handleScroll = (event: any) => { const scrollData = event.detail; setCollapseProfile(scrollData.scrollTop > 10); - } + }; return ( @@ -162,46 +165,52 @@ const MyselfPageContent: React.FC = () => { on_follow={handle_follow} onTab={handleOnTab} /> - { - !collapseProfile ? - - - - - 球局订单 - - - - - 钱包 - + {!collapseProfile ? ( + + + + + 球局订单 - : - null - } + + + + 钱包 + + + + ) : null} - - - + {!collapseProfile ? ( + + + + ) : null} setActiveTab("hosted")} > 我主办的 setActiveTab("participated")} > 我参与的 @@ -222,7 +231,7 @@ const MyselfPageContent: React.FC = () => { btnImg="ICON_ADD" reload={goPublish} isShowNoData={game_records.length === 0} - loadMoreMatches={() => { }} + loadMoreMatches={() => {}} collapse={true} style={{ paddingBottom: 0, overflow: "hidden" }} listLoadErrorHeight="320px" @@ -241,7 +250,7 @@ const MyselfPageContent: React.FC = () => { error={null} errorImg="ICON_LIST_EMPTY" isShowNoData={ended_game_records.length === 0} - loadMoreMatches={() => { }} + loadMoreMatches={() => {}} collapse={true} style={{ paddingBottom: "90px", overflow: "hidden" }} listLoadErrorHeight="320px"