1
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
ListState,
|
||||
IPayload,
|
||||
} from "../../types/list/types";
|
||||
import { useUser } from "./userStore";
|
||||
|
||||
function translateCityData(dataTree) {
|
||||
return dataTree.map((item) => {
|
||||
@@ -192,8 +193,10 @@ export const useListStore = create<TennisStore>()((set, get) => ({
|
||||
const distanceQuickFilter = currentPageState?.distanceQuickFilter || {};
|
||||
const { distanceFilter, order, district } = distanceQuickFilter || {};
|
||||
|
||||
// 从 area 中获取省份名称(area 格式: ["中国", 省份])
|
||||
const province = state.area?.[1] || ""; // area[1] 是省份
|
||||
// 从用户信息中获取 last_location_province 和 last_location_city
|
||||
const userInfo = useUser.getState().user as any;
|
||||
const last_location_province = userInfo?.last_location_province || "";
|
||||
const last_location_city = userInfo?.last_location_city || "";
|
||||
|
||||
// city 参数逻辑:
|
||||
// 1. 如果选择了行政区(district 有值),使用行政区的名称(label)
|
||||
@@ -218,12 +221,15 @@ export const useListStore = create<TennisStore>()((set, get) => ({
|
||||
ntrpMax: filterOptions?.ntrp?.[1],
|
||||
dateRange: dateRange, // 确保始终是两个值的数组
|
||||
distanceFilter: distanceFilter,
|
||||
province: province, // 添加省份参数
|
||||
last_location_province: last_location_province, // 使用 last_location_province
|
||||
};
|
||||
|
||||
// 只在有值时添加 city 参数
|
||||
// 只在有值时添加 city 参数(使用 last_location_city)
|
||||
if (city) {
|
||||
searchOption.city = city;
|
||||
searchOption.last_location_city = city;
|
||||
} else if (last_location_city) {
|
||||
// 如果没有选择行政区,但有 last_location_city,则使用它
|
||||
searchOption.last_location_city = last_location_city;
|
||||
}
|
||||
|
||||
const params = {
|
||||
|
||||
Reference in New Issue
Block a user