隐藏load ,提高用户体验
This commit is contained in:
@@ -163,11 +163,11 @@ const ListPage = () => {
|
|||||||
Taro.stopPullDownRefresh();
|
Taro.stopPullDownRefresh();
|
||||||
|
|
||||||
// 显示刷新成功提示
|
// 显示刷新成功提示
|
||||||
Taro.showToast({
|
// Taro.showToast({
|
||||||
title: "刷新成功",
|
// title: "刷新成功",
|
||||||
icon: "success",
|
// icon: "success",
|
||||||
duration: 1000,
|
// duration: 1000,
|
||||||
});
|
// });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 刷新失败时也停止动画
|
// 刷新失败时也停止动画
|
||||||
Taro.stopPullDownRefresh();
|
Taro.stopPullDownRefresh();
|
||||||
@@ -207,7 +207,7 @@ const ListPage = () => {
|
|||||||
updateFilterOptions(params);
|
updateFilterOptions(params);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchChange = () => { };
|
const handleSearchChange = () => { };
|
||||||
|
|
||||||
// 距离筛选
|
// 距离筛选
|
||||||
const handleDistanceOrQuickChange = (name, value) => {
|
const handleDistanceOrQuickChange = (name, value) => {
|
||||||
@@ -228,8 +228,8 @@ const ListPage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化字典数据
|
// 初始化字典数据
|
||||||
const initDictionaryData = async () => {
|
const initDictionaryData = async () => {
|
||||||
try {
|
try {
|
||||||
const { fetchDictionary } = useDictionaryStore.getState();
|
const { fetchDictionary } = useDictionaryStore.getState();
|
||||||
await fetchDictionary();
|
await fetchDictionary();
|
||||||
@@ -238,9 +238,9 @@ const ListPage = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initDictionaryData()
|
initDictionaryData()
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -255,21 +255,21 @@ const ListPage = () => {
|
|||||||
{/* 列表内容 */}
|
{/* 列表内容 */}
|
||||||
<View className={styles.listPage} style={{ paddingTop: totalHeight }}>
|
<View className={styles.listPage} style={{ paddingTop: totalHeight }}>
|
||||||
{/* 综合筛选 */}
|
{/* 综合筛选 */}
|
||||||
{isShowFilterPopup && (
|
{isShowFilterPopup && (
|
||||||
<View>
|
<View>
|
||||||
<FilterPopup
|
<FilterPopup
|
||||||
loading={loading}
|
loading={loading}
|
||||||
onCancel={toggleShowPopup}
|
onCancel={toggleShowPopup}
|
||||||
onConfirm={handleFilterConfirm}
|
onConfirm={handleFilterConfirm}
|
||||||
onChange={handleUpdateFilterOptions}
|
onChange={handleUpdateFilterOptions}
|
||||||
filterOptions={filterOptions}
|
filterOptions={filterOptions}
|
||||||
onClear={clearFilterOptions}
|
onClear={clearFilterOptions}
|
||||||
visible={isShowFilterPopup}
|
visible={isShowFilterPopup}
|
||||||
onClose={toggleShowPopup}
|
onClose={toggleShowPopup}
|
||||||
statusNavbarHeigh={statusNavbarHeightInfo?.totalHeight}
|
statusNavbarHeigh={statusNavbarHeightInfo?.totalHeight}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
<View
|
<View
|
||||||
className={`${styles.listTopSearchWrapper}`}
|
className={`${styles.listTopSearchWrapper}`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,134 +0,0 @@
|
|||||||
import httpService from './httpService'
|
|
||||||
import type { ApiResponse } from './httpService'
|
|
||||||
|
|
||||||
// 用户信息接口
|
|
||||||
export interface UserProfile {
|
|
||||||
id: string
|
|
||||||
nickname: string
|
|
||||||
avatar?: string
|
|
||||||
age?: number
|
|
||||||
gender: 'male' | 'female'
|
|
||||||
interests: string[]
|
|
||||||
acceptNotification: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
// 反馈评价接口
|
|
||||||
export interface Feedback {
|
|
||||||
id: string
|
|
||||||
matchId: string
|
|
||||||
userId: string
|
|
||||||
photos: string[]
|
|
||||||
rating: number
|
|
||||||
recommend: 'yes' | 'no' | 'neutral'
|
|
||||||
aspects: string[]
|
|
||||||
comments: string
|
|
||||||
createdAt: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// DynamicFormDemo页面API服务类
|
|
||||||
class DemoApiService {
|
|
||||||
// ==================== 用户信息相关接口 ====================
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
async getUserProfile(): Promise<ApiResponse<UserProfile>> {
|
|
||||||
return httpService.get('/user/profile')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新用户信息
|
|
||||||
async updateUserProfile(data: Partial<UserProfile>): Promise<ApiResponse<UserProfile>> {
|
|
||||||
return httpService.put('/user/profile', data, {
|
|
||||||
showLoading: true,
|
|
||||||
loadingText: '保存中...'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上传头像
|
|
||||||
async uploadAvatar(filePath: string): Promise<ApiResponse<{ url: string }>> {
|
|
||||||
return httpService.post('/user/avatar', { filePath }, {
|
|
||||||
showLoading: true,
|
|
||||||
loadingText: '上传头像中...'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== 反馈评价相关接口 ====================
|
|
||||||
|
|
||||||
// 提交活动评价
|
|
||||||
async submitFeedback(data: {
|
|
||||||
matchId: string
|
|
||||||
photos?: string[]
|
|
||||||
rating: number
|
|
||||||
recommend: 'yes' | 'no' | 'neutral'
|
|
||||||
aspects: string[]
|
|
||||||
comments: string
|
|
||||||
}): Promise<ApiResponse<Feedback>> {
|
|
||||||
return httpService.post('/feedback', data, {
|
|
||||||
showLoading: true,
|
|
||||||
loadingText: '提交评价中...'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取我的评价列表
|
|
||||||
async getMyFeedbacks(params?: {
|
|
||||||
page?: number
|
|
||||||
limit?: number
|
|
||||||
}): Promise<ApiResponse<{ list: Feedback[]; total: number }>> {
|
|
||||||
return httpService.get('/feedback/my', params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取活动的所有评价
|
|
||||||
async getMatchFeedbacks(matchId: string, params?: {
|
|
||||||
page?: number
|
|
||||||
limit?: number
|
|
||||||
}): Promise<ApiResponse<{ list: Feedback[]; total: number }>> {
|
|
||||||
return httpService.get(`/feedback/match/${matchId}`, params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== 通用表单提交接口 ====================
|
|
||||||
|
|
||||||
// 提交表单数据(通用接口)
|
|
||||||
async submitForm(formType: string, formData: any[]): Promise<ApiResponse<any>> {
|
|
||||||
return httpService.post('/forms/submit', {
|
|
||||||
type: formType,
|
|
||||||
data: formData
|
|
||||||
}, {
|
|
||||||
showLoading: true,
|
|
||||||
loadingText: '提交中...'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存表单草稿
|
|
||||||
async saveFormDraft(formType: string, formData: any[]): Promise<ApiResponse<{ id: string }>> {
|
|
||||||
return httpService.post('/forms/draft', {
|
|
||||||
type: formType,
|
|
||||||
data: formData
|
|
||||||
}, {
|
|
||||||
showLoading: true,
|
|
||||||
loadingText: '保存中...'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取表单草稿
|
|
||||||
async getFormDrafts(formType: string): Promise<ApiResponse<{ id: string; data: any[]; createdAt: string }[]>> {
|
|
||||||
return httpService.get('/forms/drafts', { type: formType })
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除表单草稿
|
|
||||||
async deleteFormDraft(id: string): Promise<ApiResponse<{ success: boolean }>> {
|
|
||||||
return httpService.delete(`/forms/draft/${id}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==================== 兴趣爱好相关接口 ====================
|
|
||||||
|
|
||||||
// 获取兴趣爱好选项
|
|
||||||
async getInterestOptions(): Promise<ApiResponse<{ label: string; value: string }[]>> {
|
|
||||||
return httpService.get('/interests')
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取推荐的兴趣爱好
|
|
||||||
async getRecommendedInterests(): Promise<ApiResponse<string[]>> {
|
|
||||||
return httpService.get('/interests/recommended')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 导出API服务实例
|
|
||||||
export default new DemoApiService()
|
|
||||||
@@ -139,7 +139,7 @@ export class FollowService {
|
|||||||
API_CONFIG.USER.FOLLOW,
|
API_CONFIG.USER.FOLLOW,
|
||||||
{ following_id: user_id },
|
{ following_id: user_id },
|
||||||
{
|
{
|
||||||
showLoading: true,
|
showLoading: false,
|
||||||
loadingText: '关注中...'
|
loadingText: '关注中...'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -162,7 +162,7 @@ export class FollowService {
|
|||||||
API_CONFIG.USER.UNFOLLOW,
|
API_CONFIG.USER.UNFOLLOW,
|
||||||
{ following_id: user_id },
|
{ following_id: user_id },
|
||||||
{
|
{
|
||||||
showLoading: true,
|
showLoading: false,
|
||||||
loadingText: '取消关注中...'
|
loadingText: '取消关注中...'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ export const getGamesIntegrateList = async (params?: Record<string, any>) => {
|
|||||||
*/
|
*/
|
||||||
export const getGamesCount = async (params?: Record<string, any>) => {
|
export const getGamesCount = async (params?: Record<string, any>) => {
|
||||||
try {
|
try {
|
||||||
return httpService.post('/games/count', params, { showLoading: true })
|
return httpService.post('/games/count', params, { showLoading: false })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("列表数量获取失败:", error);
|
console.error("列表数量获取失败:", error);
|
||||||
throw error;
|
throw error;
|
||||||
@@ -68,7 +68,7 @@ export const getGamesCount = async (params?: Record<string, any>) => {
|
|||||||
export const getSearchHistory = async (params) => {
|
export const getSearchHistory = async (params) => {
|
||||||
try {
|
try {
|
||||||
// 调用HTTP服务获取搜索历史记录
|
// 调用HTTP服务获取搜索历史记录
|
||||||
return httpService.post('/games/search_history', params, { showLoading: true })
|
return httpService.post('/games/search_history', params, { showLoading: false })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 捕获并打印错误信息
|
// 捕获并打印错误信息
|
||||||
console.error("历史记录获取失败:", error);
|
console.error("历史记录获取失败:", error);
|
||||||
@@ -84,7 +84,7 @@ export const getSearchHistory = async (params) => {
|
|||||||
export const clearHistory = async (params) => {
|
export const clearHistory = async (params) => {
|
||||||
try {
|
try {
|
||||||
// 调用HTTP服务清除搜索历史记录
|
// 调用HTTP服务清除搜索历史记录
|
||||||
return httpService.post('/games/search_history/delete_all', params, { showLoading: true })
|
return httpService.post('/games/search_history/delete_all', params, { showLoading: false })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 捕获并打印错误信息
|
// 捕获并打印错误信息
|
||||||
console.error("清除历史记录失败:", error);
|
console.error("清除历史记录失败:", error);
|
||||||
|
|||||||
@@ -40,23 +40,23 @@ export interface UnreadMountResponse {
|
|||||||
class NoticeService {
|
class NoticeService {
|
||||||
// 获取用户消息通知列表
|
// 获取用户消息通知列表
|
||||||
async getNotificationList({ notification_type, is_read }: NoticeListParams): Promise<ApiResponse<NoticeListResponse>> {
|
async getNotificationList({ notification_type, is_read }: NoticeListParams): Promise<ApiResponse<NoticeListResponse>> {
|
||||||
return httpService.post("/notifications/list", { notification_type, is_read }, { showLoading: true });
|
return httpService.post("/notifications/list", { notification_type, is_read }, { showLoading: false });
|
||||||
}
|
}
|
||||||
// 获取消息通知详情
|
// 获取消息通知详情
|
||||||
async getNotificationDetail(notification_id: number): Promise<ApiResponse<Notice>> {
|
async getNotificationDetail(notification_id: number): Promise<ApiResponse<Notice>> {
|
||||||
return httpService.post("/notifications/detail", { notification_id }, { showLoading: true });
|
return httpService.post("/notifications/detail", { notification_id }, { showLoading: false });
|
||||||
}
|
}
|
||||||
// 标记消息为已读
|
// 标记消息为已读
|
||||||
async markNotificationRead({ notification_ids, mark_all }: MarkReadParams): Promise<ApiResponse<{ marked_count: number }>> {
|
async markNotificationRead({ notification_ids, mark_all }: MarkReadParams): Promise<ApiResponse<{ marked_count: number }>> {
|
||||||
return httpService.post("/notifications/mark_read", { notification_ids, mark_all }, { showLoading: true });
|
return httpService.post("/notifications/mark_read", { notification_ids, mark_all }, { showLoading: false });
|
||||||
}
|
}
|
||||||
// 删除消息通知
|
// 删除消息通知
|
||||||
async delNotification({ notification_ids, delete_all }: DeleteParams): Promise<ApiResponse<{ deleted_count: number }>> {
|
async delNotification({ notification_ids, delete_all }: DeleteParams): Promise<ApiResponse<{ deleted_count: number }>> {
|
||||||
return httpService.post("/notifications/delete", { notification_ids, delete_all }, { showLoading: true });
|
return httpService.post("/notifications/delete", { notification_ids, delete_all }, { showLoading: false });
|
||||||
}
|
}
|
||||||
// 获取未读消息数量
|
// 获取未读消息数量
|
||||||
async getNotificationUnreadCount(): Promise<ApiResponse<UnreadMountResponse>> {
|
async getNotificationUnreadCount(): Promise<ApiResponse<UnreadMountResponse>> {
|
||||||
return httpService.post("/notifications/unread_count", {}, { showLoading: true });
|
return httpService.post("/notifications/unread_count", {}, { showLoading: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user