Compare commits
1 Commits
master
...
feature/ju
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49f53d60ed |
@@ -63,6 +63,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
area,
|
area,
|
||||||
cityQrCode,
|
cityQrCode,
|
||||||
districts,
|
districts,
|
||||||
|
fetchMatches,
|
||||||
gamesNum, // 新增:获取球局数量
|
gamesNum, // 新增:获取球局数量
|
||||||
} = store;
|
} = store;
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
pageOption,
|
pageOption,
|
||||||
isShowNoData,
|
isShowNoData,
|
||||||
} = listPageState || {};
|
} = listPageState || {};
|
||||||
|
console.log('===matches', matches)
|
||||||
|
|
||||||
const scrollContextRef = useRef(null);
|
const scrollContextRef = useRef(null);
|
||||||
const scrollViewRef = useRef(null);
|
const scrollViewRef = useRef(null);
|
||||||
@@ -92,6 +94,8 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
// 记录上一次加载数据时的城市,用于检测城市变化
|
// 记录上一次加载数据时的城市,用于检测城市变化
|
||||||
const lastLoadedAreaRef = useRef<[string, string] | null>(null);
|
const lastLoadedAreaRef = useRef<[string, string] | null>(null);
|
||||||
const prevIsActiveRef = useRef(isActive);
|
const prevIsActiveRef = useRef(isActive);
|
||||||
|
// 首次加载标记:避免切回 tab 时使用 isRefresh 导致智能排序顺序抖动
|
||||||
|
const hasLoadedOnceRef = useRef(false);
|
||||||
|
|
||||||
// 处理距离筛选显示/隐藏
|
// 处理距离筛选显示/隐藏
|
||||||
const handleDistanceFilterVisibleChange = useCallback(
|
const handleDistanceFilterVisibleChange = useCallback(
|
||||||
@@ -230,7 +234,14 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
|
|
||||||
// 只有当页面激活时才加载位置和列表数据
|
// 只有当页面激活时才加载位置和列表数据
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
getLocation().catch((error) => {
|
const firstLoad = !hasLoadedOnceRef.current;
|
||||||
|
getLocation(firstLoad)
|
||||||
|
.then(() => {
|
||||||
|
if (firstLoad) {
|
||||||
|
hasLoadedOnceRef.current = true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
console.error('获取位置信息失败:', error);
|
console.error('获取位置信息失败:', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -359,7 +370,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getLocation = async () => {
|
const getLocation = async (useRefresh = true) => {
|
||||||
const location = await getCurrentLocationInfo();
|
const location = await getCurrentLocationInfo();
|
||||||
updateState({ location });
|
updateState({ location });
|
||||||
if (location && location.latitude && location.longitude) {
|
if (location && location.latitude && location.longitude) {
|
||||||
@@ -370,7 +381,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 先调用列表接口
|
// 先调用列表接口
|
||||||
await getMatchesData();
|
await fetchMatches({}, useRefresh);
|
||||||
// 列表接口完成后,再调用数量接口
|
// 列表接口完成后,再调用数量接口
|
||||||
await fetchGetGamesCount();
|
await fetchGetGamesCount();
|
||||||
// 初始数据加载完成后,记录当前城市
|
// 初始数据加载完成后,记录当前城市
|
||||||
|
|||||||
Reference in New Issue
Block a user