优化展示逻辑

This commit is contained in:
李瑞
2025-10-13 00:07:31 +08:00
parent 12600ebdfb
commit 99671667f3
5 changed files with 10 additions and 31 deletions

View File

@@ -60,6 +60,8 @@ const pageStateDefaultValue = {
gamesNum: 0,
// 是否还有更多数据
isHasMoreData: true,
// 是否展示无数据
isShowNoData: false,
}
// 列表页状态
@@ -187,40 +189,13 @@ export const useListStore = create<TennisStore>()((set, get) => ({
state.updateCurrentPageState({
data: newData,
isHasMoreData,
isShowNoData: newData?.length === 0,
});
set({
error,
loading,
});
if (state.isSearchResult) {
// 更新搜索页状态
// const currentData = state.searchPageState?.data || [];
// const newData = isAppend ? [...currentData, ...(data || [])] : (data || []);
// set({
// searchPageState: {
// ...state.searchPageState,
// data: newData,
// isHasMoreData,
// },
// error,
// loading,
// });
} else {
// 更新列表页状态
// const currentData = state.listPageState?.data || [];
// const newData = isAppend ? [...currentData, ...(data || [])] : (data || []);
// set({
// listPageState: {
// ...state.listPageState,
// data: newData,
// isHasMoreData,
// },
// error,
// loading,
// });
}
},
// 获取列表数据(常规搜索)
@@ -241,7 +216,6 @@ export const useListStore = create<TennisStore>()((set, get) => ({
// 获取当前页面的距离筛选
const state = get();
const currentPageState = state.isSearchResult ? state.searchPageState : state.listPageState;
console.log("===获取列表数据=当前页面状态:", state.isSearchResult, currentPageState);
const distanceQuickFilter = currentPageState?.distanceQuickFilter || {};
// 是否选择了智能排序
@@ -258,7 +232,6 @@ export const useListStore = create<TennisStore>()((set, get) => ({
}
}
console.log("===获取列表数据参数:", reqParams);
const resData = (await fetchFn(reqParams)) || {};
const { data = {}, code } = resData;
if (code !== 0) {