优化活动加载更多
This commit is contained in:
@@ -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")}
|
||||||
>
|
>
|
||||||
@@ -222,7 +231,7 @@ const MyselfPageContent: React.FC = () => {
|
|||||||
btnImg="ICON_ADD"
|
btnImg="ICON_ADD"
|
||||||
reload={goPublish}
|
reload={goPublish}
|
||||||
isShowNoData={game_records.length === 0}
|
isShowNoData={game_records.length === 0}
|
||||||
loadMoreMatches={() => { }}
|
loadMoreMatches={() => {}}
|
||||||
collapse={true}
|
collapse={true}
|
||||||
style={{ paddingBottom: 0, overflow: "hidden" }}
|
style={{ paddingBottom: 0, overflow: "hidden" }}
|
||||||
listLoadErrorHeight="320px"
|
listLoadErrorHeight="320px"
|
||||||
@@ -241,7 +250,7 @@ const MyselfPageContent: React.FC = () => {
|
|||||||
error={null}
|
error={null}
|
||||||
errorImg="ICON_LIST_EMPTY"
|
errorImg="ICON_LIST_EMPTY"
|
||||||
isShowNoData={ended_game_records.length === 0}
|
isShowNoData={ended_game_records.length === 0}
|
||||||
loadMoreMatches={() => { }}
|
loadMoreMatches={() => {}}
|
||||||
collapse={true}
|
collapse={true}
|
||||||
style={{ paddingBottom: "90px", overflow: "hidden" }}
|
style={{ paddingBottom: "90px", overflow: "hidden" }}
|
||||||
listLoadErrorHeight="320px"
|
listLoadErrorHeight="320px"
|
||||||
|
|||||||
Reference in New Issue
Block a user