Compare commits
1 Commits
feature/ju
...
ee579df162
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee579df162 |
@@ -63,7 +63,6 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
area,
|
||||
cityQrCode,
|
||||
districts,
|
||||
fetchMatches,
|
||||
gamesNum, // 新增:获取球局数量
|
||||
} = store;
|
||||
|
||||
@@ -78,7 +77,6 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
pageOption,
|
||||
isShowNoData,
|
||||
} = listPageState || {};
|
||||
console.log('===matches', matches)
|
||||
|
||||
const scrollContextRef = useRef(null);
|
||||
const scrollViewRef = useRef(null);
|
||||
@@ -94,8 +92,6 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
// 记录上一次加载数据时的城市,用于检测城市变化
|
||||
const lastLoadedAreaRef = useRef<[string, string] | null>(null);
|
||||
const prevIsActiveRef = useRef(isActive);
|
||||
// 首次加载标记:避免切回 tab 时使用 isRefresh 导致智能排序顺序抖动
|
||||
const hasLoadedOnceRef = useRef(false);
|
||||
|
||||
// 处理距离筛选显示/隐藏
|
||||
const handleDistanceFilterVisibleChange = useCallback(
|
||||
@@ -234,16 +230,9 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
|
||||
// 只有当页面激活时才加载位置和列表数据
|
||||
if (isActive) {
|
||||
const firstLoad = !hasLoadedOnceRef.current;
|
||||
getLocation(firstLoad)
|
||||
.then(() => {
|
||||
if (firstLoad) {
|
||||
hasLoadedOnceRef.current = true;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('获取位置信息失败:', error);
|
||||
});
|
||||
getLocation().catch((error) => {
|
||||
console.error('获取位置信息失败:', error);
|
||||
});
|
||||
}
|
||||
}, [isActive]);
|
||||
|
||||
@@ -370,7 +359,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
};
|
||||
}, []);
|
||||
|
||||
const getLocation = async (useRefresh = true) => {
|
||||
const getLocation = async () => {
|
||||
const location = await getCurrentLocationInfo();
|
||||
updateState({ location });
|
||||
if (location && location.latitude && location.longitude) {
|
||||
@@ -381,7 +370,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
||||
}
|
||||
}
|
||||
// 先调用列表接口
|
||||
await fetchMatches({}, useRefresh);
|
||||
await getMatchesData();
|
||||
// 列表接口完成后,再调用数量接口
|
||||
await fetchGetGamesCount();
|
||||
// 初始数据加载完成后,记录当前城市
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useCallback, forwardRef, useImperativeHandle, useEffect } from 'react'
|
||||
import React, { useState, useCallback, forwardRef, useImperativeHandle } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { View, Text, Image, ScrollView } from '@tarojs/components'
|
||||
import images from '@/config/images'
|
||||
@@ -70,6 +70,7 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
onAnyInput
|
||||
}, ref) => {
|
||||
const [openPicker, setOpenPicker] = useState(false);
|
||||
const [scrollTop, setScrollTop] = useState(0);
|
||||
const { getDictionaryValue } = useDictionaryActions()
|
||||
const court_type = getDictionaryValue('court_type') || []
|
||||
const court_surface = getDictionaryValue('court_surface') || []
|
||||
@@ -170,14 +171,27 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
|
||||
|
||||
|
||||
const changeTextarea = (value) => {
|
||||
if (value) {
|
||||
// 先滚动到底部
|
||||
setScrollTop(scrollTop ? scrollTop + 1 : 9999);
|
||||
// 使用 setTimeout 确保滚动后再更新 openPicker
|
||||
}
|
||||
}
|
||||
|
||||
const changePicker = (value) => {
|
||||
setOpenPicker(value)
|
||||
setOpenPicker(value);
|
||||
}
|
||||
|
||||
console.log(stadium,'stadiumstadium');
|
||||
return (
|
||||
<View className='stadium-detail'>
|
||||
<ScrollView className='stadium-detail-scroll' refresherBackground="#FAFAFA" scrollY={!openPicker}>
|
||||
<ScrollView
|
||||
className='stadium-detail-scroll'
|
||||
refresherBackground="#FAFAFA"
|
||||
scrollY={!openPicker}
|
||||
scrollTop={scrollTop}
|
||||
>
|
||||
{/* 已选球场 */}
|
||||
<View
|
||||
className={`stadium-item`}
|
||||
@@ -220,9 +234,12 @@ const StadiumDetail = forwardRef<StadiumDetailRef, StadiumDetailProps>(({
|
||||
<View className='textarea-tag-container'>
|
||||
<TextareaTag
|
||||
value={formData[item.prop]}
|
||||
onChange={(value) => updateFormData(item.prop, value)}
|
||||
onBlur={() => changePicker(false)}
|
||||
onFocus={() => changePicker(true)}
|
||||
onChange={(value) => {
|
||||
changeTextarea(true)
|
||||
updateFormData(item.prop, value)
|
||||
}}
|
||||
// onBlur={() => changeTextarea(false)}
|
||||
onFocus={() => changeTextarea(true)}
|
||||
placeholder='有其他场地信息可备注'
|
||||
options={(item.options || []).map((o) => ({ label: o, value: o }))}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user