Merge branch 'feature/juguohong/20250816'

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

View File

@@ -13,6 +13,7 @@ import { useRef, useEffect } from "react";
const ListContainer = (props) => {
const {
loading,
isShowNoData,
data = [],
error,
reload,
@@ -84,7 +85,7 @@ const ListContainer = (props) => {
// 渲染列表
const renderList = (list) => {
// 请求数据为空
if (!loading && (!list || list?.length === 0)) {
if (isShowNoData) {
return <ListLoadError reload={reload} errorImg={errorImg} btnText={btnText} btnImg={btnImg} text={emptyText || "暂无数据"} />;
}

View File

@@ -58,6 +58,7 @@ const ListPage = () => {
distanceQuickFilter,
isShowInputCustomerNavBar,
pageOption,
isShowNoData,
} = listPageState || {};
// 防抖的滚动处理函数
@@ -376,6 +377,7 @@ const ListPage = () => {
data={matches}
recommendList={recommendList}
loading={loading}
isShowNoData={isShowNoData}
error={error}
reload={refreshMatches}
loadMoreMatches={loadMoreMatches}

View File

@@ -35,6 +35,7 @@ const SearchResult = () => {
recommendList,
filterCount,
filterOptions,
isShowNoData,
} = searchPageState || {};
const { statusNavbarHeightInfo } = useGlobalState() || {};
const { totalHeight } = statusNavbarHeightInfo || {};
@@ -166,6 +167,7 @@ const SearchResult = () => {
data={data}
recommendList={recommendList}
loading={loading}
isShowNoData={isShowNoData}
error={error}
reload={refreshMatches}
loadMoreMatches={loadMoreMatches}

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) {