1
This commit is contained in:
@@ -33,6 +33,8 @@ interface UserDetailData {
|
||||
occupation: string;
|
||||
birthday: string;
|
||||
ntrp_level: string;
|
||||
last_location_province: string;
|
||||
last_location_city: string;
|
||||
stats: {
|
||||
followers_count: number;
|
||||
following_count: number;
|
||||
@@ -83,6 +85,8 @@ export interface UserInfoType {
|
||||
personal_profile: string;
|
||||
occupation: string;
|
||||
ntrp_level: string;
|
||||
last_location_province?: string;
|
||||
last_location_city?: string;
|
||||
bio?: string;
|
||||
birthday?: string;
|
||||
is_following?: boolean;
|
||||
@@ -326,6 +330,7 @@ export class UserService {
|
||||
|
||||
if (response.code === 0) {
|
||||
const userData = response.data;
|
||||
|
||||
return {
|
||||
id: userData.id || "",
|
||||
nickname: userData.nickname || "",
|
||||
@@ -351,7 +356,11 @@ export class UserService {
|
||||
country: userData.country || "",
|
||||
province: userData.province || "",
|
||||
city: userData.city || "",
|
||||
last_location_province: userData.last_location_province || "",
|
||||
last_location_city: userData.last_location_city || "",
|
||||
};
|
||||
|
||||
|
||||
} else {
|
||||
throw new Error(response.message || "获取用户信息失败");
|
||||
}
|
||||
|
||||
@@ -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