优化活动加载更多

This commit is contained in:
2025-11-27 15:56:32 +08:00
parent 4f32312209
commit a20490f28d

View File

@@ -43,7 +43,8 @@ const MyselfPageContent: React.FC = () => {
}); });
// 分类球局数据(使用 useCallback 包装,避免每次渲染都创建新函数) // 分类球局数据(使用 useCallback 包装,避免每次渲染都创建新函数)
const classifyGameRecords = useCallback(( const classifyGameRecords = useCallback(
(
game_records: TennisMatch[] game_records: TennisMatch[]
): { notEndGames: TennisMatch[]; finishedGames: TennisMatch[] } => { ): { notEndGames: TennisMatch[]; finishedGames: TennisMatch[] } => {
const now = new Date().getTime(); const now = new Date().getTime();
@@ -61,7 +62,9 @@ const MyselfPageContent: React.FC = () => {
finishedGames: [] as TennisMatch[], finishedGames: [] as TennisMatch[],
} }
); );
}, []); },
[]
);
// 使用 useCallback 包装 load_game_data避免每次渲染都创建新函数 // 使用 useCallback 包装 load_game_data避免每次渲染都创建新函数
const load_game_data = useCallback(async () => { const load_game_data = useCallback(async () => {
@@ -144,7 +147,7 @@ const MyselfPageContent: React.FC = () => {
const handleScroll = (event: any) => { const handleScroll = (event: any) => {
const scrollData = event.detail; const scrollData = event.detail;
setCollapseProfile(scrollData.scrollTop > 10); setCollapseProfile(scrollData.scrollTop > 10);
} };
return ( return (
<ScrollView scrollY className={styles.myselfPage} onScroll={handleScroll}> <ScrollView scrollY className={styles.myselfPage} onScroll={handleScroll}>
@@ -162,11 +165,13 @@ const MyselfPageContent: React.FC = () => {
on_follow={handle_follow} on_follow={handle_follow}
onTab={handleOnTab} onTab={handleOnTab}
/> />
{ {!collapseProfile ? (
!collapseProfile ?
<View className={styles.quickActionsSection}> <View className={styles.quickActionsSection}>
<View className={styles.actionCard}> <View className={styles.actionCard}>
<View className={styles.actionContent} onClick={handle_game_orders}> <View
className={styles.actionContent}
onClick={handle_game_orders}
>
<Image <Image
className={styles.actionIcon} className={styles.actionIcon}
src={require("@/static/userInfo/order_btn.svg")} src={require("@/static/userInfo/order_btn.svg")}
@@ -182,25 +187,29 @@ const MyselfPageContent: React.FC = () => {
<Text className={styles.actionText}></Text> <Text className={styles.actionText}></Text>
</View> </View>
</View> </View>
</View> : </View>
null ) : null}
}
</View> </View>
{!collapseProfile ? (
<View className={styles.testEntryCardBox}> <View className={styles.testEntryCardBox}>
<NTRPTestEntryCard type={EvaluateScene.user} /> <NTRPTestEntryCard type={EvaluateScene.user} />
</View> </View>
) : null}
<View className={styles.gameTabsSection}> <View className={styles.gameTabsSection}>
<View className={styles.tabContainer}> <View className={styles.tabContainer}>
<View <View
className={`${styles.tabItem} ${active_tab === "hosted" ? styles.active : ""}`} className={`${styles.tabItem} ${
active_tab === "hosted" ? styles.active : ""
}`}
onClick={() => setActiveTab("hosted")} onClick={() => setActiveTab("hosted")}
> >
<Text className={styles.tabText}></Text> <Text className={styles.tabText}></Text>
</View> </View>
<View <View
className={`${styles.tabItem} ${active_tab === "participated" ? styles.active : "" className={`${styles.tabItem} ${
active_tab === "participated" ? styles.active : ""
}`} }`}
onClick={() => setActiveTab("participated")} onClick={() => setActiveTab("participated")}
> >