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> { return httpService.get('/user/profile') } // 更新用户信息 async updateUserProfile(data: Partial): Promise> { return httpService.put('/user/profile', data, { showLoading: true, loadingText: '保存中...' }) } // 上传头像 async uploadAvatar(filePath: string): Promise> { 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> { return httpService.post('/feedback', data, { showLoading: true, loadingText: '提交评价中...' }) } // 获取我的评价列表 async getMyFeedbacks(params?: { page?: number limit?: number }): Promise> { return httpService.get('/feedback/my', params) } // 获取活动的所有评价 async getMatchFeedbacks(matchId: string, params?: { page?: number limit?: number }): Promise> { return httpService.get(`/feedback/match/${matchId}`, params) } // ==================== 通用表单提交接口 ==================== // 提交表单数据(通用接口) async submitForm(formType: string, formData: any[]): Promise> { return httpService.post('/forms/submit', { type: formType, data: formData }, { showLoading: true, loadingText: '提交中...' }) } // 保存表单草稿 async saveFormDraft(formType: string, formData: any[]): Promise> { return httpService.post('/forms/draft', { type: formType, data: formData }, { showLoading: true, loadingText: '保存中...' }) } // 获取表单草稿 async getFormDrafts(formType: string): Promise> { return httpService.get('/forms/drafts', { type: formType }) } // 删除表单草稿 async deleteFormDraft(id: string): Promise> { return httpService.delete(`/forms/draft/${id}`) } // ==================== 兴趣爱好相关接口 ==================== // 获取兴趣爱好选项 async getInterestOptions(): Promise> { return httpService.get('/interests') } // 获取推荐的兴趣爱好 async getRecommendedInterests(): Promise> { return httpService.get('/interests/recommended') } } // 导出API服务实例 export default new DemoApiService()