列表搜索页面

This commit is contained in:
juguohong
2025-09-06 22:08:34 +08:00
parent c78be00ded
commit 2d0d728969
15 changed files with 518 additions and 128 deletions

View File

@@ -12,39 +12,39 @@ interface ApiResponse<T> {
}
/**
* 获取网球比赛列表
* 获取列表
* @param params 查询参数
* @returns Promise<TennisMatch[]>
*/
export const getTennisMatches = async (params?: {
export const getGamesList = async (params?: {
page?: number;
pageSize?: number;
location?: string;
skillLevel?: string;
}) => {
try {
return httpService.post('/venues/list', params, { showLoading: false })
return httpService.post('/games/list', params, { showLoading: false })
} catch (error) {
console.error("列表数据获取失败:", error);
throw error;
}
};
/**
* 刷新网球比赛数据
* @returns Promise<TennisMatch[]>
*/
export const refreshTennisMatches = async (params) => {
export const getGamesIntegrateList = async (params?: {
page?: number;
pageSize?: number;
location?: string;
skillLevel?: string;
}) => {
try {
// 生成新的动态数据
const matches = generateDynamicData(params);
return matches;
return httpService.post('/games/integrate_list', params, { showLoading: false })
} catch (error) {
console.error("API刷新失败:", error);
console.error("列表数据获取失败:", error);
throw error;
}
};
/**
* 获取搜索历史记录的异步函数
* @param {Object} params - 查询参数对象
@@ -69,8 +69,8 @@ export const getSearchHistory = async (params) => {
export const clearHistory = async () => {
try {
// 调用HTTP服务清除搜索历史记录
return httpService.post('/games/clear_history')
} catch (error) {
return httpService.post('/search_history/delete_all')
} catch (error) {
// 捕获并打印错误信息
console.error("清除历史记录失败:", error);
// 抛出错误以便上层处理
@@ -86,7 +86,7 @@ export const clearHistory = async () => {
export const searchSuggestion = async (params) => {
try {
// 调用HTTP服务获取搜索建议
return httpService.get('/games/search_suggestion', params)
return httpService.get('/games/search_recommendations', params)
} catch (error) {
// 捕获并打印错误信息
console.error("搜索建议获取失败:", error);