优化活动加载更多

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

View File

@@ -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 (
<ScrollView scrollY className={styles.myselfPage} onScroll={handleScroll}>
@@ -162,46 +165,52 @@ const MyselfPageContent: React.FC = () => {
on_follow={handle_follow}
onTab={handleOnTab}
/>
{
!collapseProfile ?
<View className={styles.quickActionsSection}>
<View className={styles.actionCard}>
<View className={styles.actionContent} onClick={handle_game_orders}>
<Image
className={styles.actionIcon}
src={require("@/static/userInfo/order_btn.svg")}
/>
<Text className={styles.actionText}></Text>
</View>
<View className={styles.actionDivider}></View>
<View className={styles.actionContent} onClick={handle_wallet}>
<Image
className={styles.actionIcon}
src={require("@/static/userInfo/wallet.svg")}
/>
<Text className={styles.actionText}></Text>
</View>
{!collapseProfile ? (
<View className={styles.quickActionsSection}>
<View className={styles.actionCard}>
<View
className={styles.actionContent}
onClick={handle_game_orders}
>
<Image
className={styles.actionIcon}
src={require("@/static/userInfo/order_btn.svg")}
/>
<Text className={styles.actionText}></Text>
</View>
</View> :
null
}
<View className={styles.actionDivider}></View>
<View className={styles.actionContent} onClick={handle_wallet}>
<Image
className={styles.actionIcon}
src={require("@/static/userInfo/wallet.svg")}
/>
<Text className={styles.actionText}></Text>
</View>
</View>
</View>
) : null}
</View>
<View className={styles.testEntryCardBox}>
<NTRPTestEntryCard type={EvaluateScene.user} />
</View>
{!collapseProfile ? (
<View className={styles.testEntryCardBox}>
<NTRPTestEntryCard type={EvaluateScene.user} />
</View>
) : null}
<View className={styles.gameTabsSection}>
<View className={styles.tabContainer}>
<View
className={`${styles.tabItem} ${active_tab === "hosted" ? styles.active : ""}`}
className={`${styles.tabItem} ${
active_tab === "hosted" ? styles.active : ""
}`}
onClick={() => setActiveTab("hosted")}
>
<Text className={styles.tabText}></Text>
</View>
<View
className={`${styles.tabItem} ${active_tab === "participated" ? styles.active : ""
}`}
className={`${styles.tabItem} ${
active_tab === "participated" ? styles.active : ""
}`}
onClick={() => setActiveTab("participated")}
>
<Text className={styles.tabText}></Text>
@@ -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"