修复日期选择问题
This commit is contained in:
@@ -21,7 +21,7 @@ interface IProps {
|
||||
}
|
||||
|
||||
function CityPicker(props) {
|
||||
const { visible, setVisible, cities, area, setArea } = props;
|
||||
const { visible, setVisible, cities, area, setArea, onCityChange } = props;
|
||||
console.log(cities, "cities");
|
||||
const [value, setValue] = useState(area);
|
||||
|
||||
@@ -29,6 +29,10 @@ function CityPicker(props) {
|
||||
console.log(value, "value");
|
||||
setValue(value);
|
||||
setArea(value);
|
||||
// 切换城市时触发接口调用
|
||||
if (onCityChange) {
|
||||
onCityChange(value);
|
||||
}
|
||||
}
|
||||
return (
|
||||
visible && (
|
||||
@@ -48,7 +52,7 @@ const ListHeader = (props: IProps) => {
|
||||
const { config } = props;
|
||||
const { showInput = false, inputLeftIcon, leftIconClick } = config || {};
|
||||
const { getLocationLoading, statusNavbarHeightInfo } = useGlobalState();
|
||||
const { gamesNum, searchValue, cities, area, updateArea } = useListState();
|
||||
const { gamesNum, searchValue, cities, area, updateArea, getMatchesData, fetchGetGamesCount, refreshBothLists } = useListState();
|
||||
const { navBarHeight } = statusNavbarHeightInfo;
|
||||
|
||||
const [cityPopupVisible, setCityPopupVisible] = useState(false);
|
||||
@@ -107,6 +111,18 @@ const ListHeader = (props: IProps) => {
|
||||
|
||||
const area_city = area.at(-1);
|
||||
|
||||
// 处理城市切换
|
||||
const handleCityChange = async (newArea: any) => {
|
||||
// 切换城市后,同时更新两个列表接口获取数据
|
||||
if (refreshBothLists) {
|
||||
await refreshBothLists();
|
||||
}
|
||||
// 更新球局数量
|
||||
if (fetchGetGamesCount) {
|
||||
await fetchGetGamesCount();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<CustomNavbar>
|
||||
<View className="listNavWrapper">
|
||||
@@ -176,6 +192,7 @@ const ListHeader = (props: IProps) => {
|
||||
cities={cities}
|
||||
area={area}
|
||||
setArea={updateArea}
|
||||
onCityChange={handleCityChange}
|
||||
/>
|
||||
)}
|
||||
</CustomNavbar>
|
||||
|
||||
Reference in New Issue
Block a user