往期球局排序处理

This commit is contained in:
2026-02-25 16:37:47 +08:00
parent baa60bbfcb
commit 4a553c63fc
2 changed files with 27 additions and 25 deletions

View File

@@ -89,11 +89,10 @@ const MyselfPage: React.FC = () => {
await fetchUserInfo();
}
// 获取测试结果
const res = await evaluateService.getLastResult();
if (res.code === 0) {
console.log( "getLastResult", res.data);
console.log("getLastResult", res.data);
setHasTestInLastMonth(res.data.has_test_in_last_month);
}
};
@@ -110,7 +109,8 @@ const MyselfPage: React.FC = () => {
});
// 分类球局数据(使用 useCallback 包装,避免每次渲染都创建新函数)
const classifyGameRecords = useCallback((
const classifyGameRecords = useCallback(
(
game_records: TennisMatch[]
): { notEndGames: TennisMatch[]; finishedGames: TennisMatch[] } => {
const now = new Date().getTime();
@@ -120,7 +120,7 @@ const MyselfPage: React.FC = () => {
end_time = end_time.replace(/\s/, "T");
new Date(end_time).getTime() > now
? result.notEndGames.push(cur)
: result.finishedGames.push(cur);
: result.finishedGames.unshift(cur);
return result;
},
{
@@ -128,7 +128,9 @@ const MyselfPage: React.FC = () => {
finishedGames: [] as TennisMatch[],
}
);
}, []);
},
[]
);
// 加载球局数据(使用 useCallback 包装,避免每次渲染都创建新函数)
const load_game_data = useCallback(async () => {
@@ -272,7 +274,7 @@ const MyselfPage: React.FC = () => {
</View>
{/* 球局列表 */}
<View className="game_list_section" >
<View className="game_list_section">
<ScrollView scrollY refresherBackground="#FAFAFA">
<ListContainer
data={game_records}

View File

@@ -141,7 +141,7 @@ const OtherUserPage: React.FC = () => {
end_time = end_time.replace(/\s/, "T");
new Date(end_time).getTime() > now
? result.notEndGames.push(cur)
: result.finishedGames.push(cur);
: result.finishedGames.unshift(cur);
return result;
},
{