This commit is contained in:
张成
2025-12-03 18:26:28 +08:00
parent 828a090daa
commit 7699facccd
4 changed files with 37 additions and 27 deletions

View File

@@ -114,7 +114,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
// 使用 ref 保存最新的状态值,避免依赖项变化导致函数重新创建
const showSearchBarRef = useRef(showSearchBar);
const isShowInputCustomerNavBarRef = useRef(isShowInputCustomerNavBar);
useEffect(() => {
showSearchBarRef.current = showSearchBar;
isShowInputCustomerNavBarRef.current = isShowInputCustomerNavBar;
@@ -124,7 +124,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
const handleScrollViewScroll = useCallback(
(e: any) => {
const currentScrollTop = e?.detail?.scrollTop || 0;
const lastScrollTop = lastScrollTopRef.current;
const currentTime = Date.now();
@@ -199,18 +199,11 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
getCities();
getCityQrCode();
getDistricts(); // 新增:获取行政区列表
// 2. 移除 fetchUserInfo 调用,因为父组件 main_pages/index.tsx 已经在授权成功后调用了
// 这里直接使用 store 中的用户信息即可
// 3. 延迟执行:获取位置信息(可能较慢,不阻塞首屏)
requestAnimationFrame(() => {
requestAnimationFrame(() => {
getLocation().catch((error) => {
console.error('获取位置信息失败:', error);
});
});
getLocation().catch((error) => {
console.error('获取位置信息失败:', error);
});
}, []);
useEffect(() => {
@@ -268,7 +261,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
} finally {
// 使用 requestAnimationFrame 替代 setTimeout(0),性能更好
requestAnimationFrame(() => {
setRefreshing(false);
setRefreshing(false);
});
}
};
@@ -305,7 +298,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
updateFilterOptions(params);
};
const handleSearchChange = () => {};
const handleSearchChange = () => { };
const handleDistanceOrQuickChange = (name, value) => {
updateDistanceQuickFilter({
@@ -354,6 +347,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
className={styles.qrcode}
src={item.qr_code_url}
mode="widthFix"
showMenuByLongpress
onClick={() => {
saveImage(item.qr_code_url);
}}
@@ -374,7 +368,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
// 判定是否显示"暂无球局"页面
// 条件:省份不是上海 或 (已加载完成且球局数量为0)
const shouldShowNoGames = province !== "上海" ;
const shouldShowNoGames = province !== "上海";
return (
<>
@@ -400,9 +394,8 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
)}
<View className={styles.fixedHeader}>
<View
className={`${styles.listTopSearchWrapper} ${
showSearchBar ? styles.show : styles.hide
}`}
className={`${styles.listTopSearchWrapper} ${showSearchBar ? styles.show : styles.hide
}`}
>
<SearchBar
handleFilterIcon={toggleShowPopup}
@@ -430,7 +423,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
</View>
</View>
<ScrollView refresherBackground="#FAFAFA"
<ScrollView refresherBackground="#FAFAFA"
ref={scrollViewRef}
scrollY
scrollTop={scrollTop}