添加接口 列表接口 第一次更新逻辑
This commit is contained in:
@@ -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.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
|
||||
},
|
||||
|
||||
// 获取历史搜索数据
|
||||
|
||||
Reference in New Issue
Block a user