Merge branch 'light_v2'

This commit is contained in:
张成
2025-09-10 21:48:25 +08:00
12 changed files with 194 additions and 105 deletions

View File

@@ -16,7 +16,7 @@ interface GlobalState {
interface GlobalActions {
updateState: (payload: Record<string, any>) => void;
getNavbarHeightInfo: () => void;
getCurrentLocationInfo: () => void;
getCurrentLocationInfo: () => any;
}
// 完整的 Store 类型
type GlobalStore = GlobalState & GlobalActions;
@@ -50,14 +50,13 @@ export const useGlobalStore = create<GlobalStore>()((set, get) => ({
},
// 获取位置信息
getCurrentLocationInfo: () => {
return getCurrentLocation().then((res) => {
set({
getLocationLoading: false,
location: res || {},
});
return res;
getCurrentLocationInfo: async () => {
const res = await getCurrentLocation()
set({
getLocationLoading: false,
location: res || {},
});
return res;
},
// 更新store数据

View File

@@ -154,7 +154,7 @@ export const useListStore = create<TennisStore>()((set, get) => ({
},
// 获取列表数据(常规搜索)
fetchMatches: async (params) => {
fetchMatches: async (params, isFirstLoad = false) => {
set({ loading: true, error: null });
const { getSearchParams, setListData, distanceQuickFilter } = get();
@@ -172,6 +172,11 @@ export const useListStore = create<TennisStore>()((set, get) => ({
if (isIntegrate) {
reqParams.order = "";
fetchFn = getGamesIntegrateList;
// 第一次进入页面时传入 isRefresh 参数
if (isFirstLoad) {
reqParams.seachOption.isRefresh = true;
}
}
console.log("===fetchMatches 获取列表数据参数:", reqParams);
@@ -187,7 +192,6 @@ export const useListStore = create<TennisStore>()((set, get) => ({
}
const { count, rows } = data;
setListData({
// recommendList: rows || [],
error: '',
data: rows || [],
loading: false,
@@ -246,12 +250,7 @@ export const useListStore = create<TennisStore>()((set, get) => ({
// 获取列表数据
getMatchesData: () => {
const { fetchMatches } = get();
fetchMatches();
// if (distanceQuickFilter?.quick === "0") {
// getIntegrateListData();
// } else {
// fetchMatches();
// }
fetchMatches({}, true); // 第一次进入页面,传入 isFirstLoad = true
},
// 获取历史搜索数据