基本完成

This commit is contained in:
zhutao
2025-08-28 16:27:56 +08:00
commit 5d7d233d2e
132 changed files with 6390 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import 'package:food_health/api/dto/profile_options_dto.dart';
import 'package:food_health/api/dto/user_profile_dto.dart';
import 'package:food_health/api/network/request.dart';
///获取用户档案
Future<UserProfileDto> getUserProfileApi() async {
var res = await Request().get("/user/profile");
return UserProfileDto.fromJson(res);
}
///获取档案选项
Future<List<ProfileOptionDto>> getProfileOptionsApi() async {
var res = await Request().get("/user/get_user_profile_options");
return (res as List).map((e) => ProfileOptionDto.fromJson(e)).toList();
}
///更新档案
Future<void> updateProfileApi(UserProfileDto userProfile) async {
await Request().post("/user/update_profile", {
"age_range": userProfile.ageRange,
"food_allergies": userProfile.foodAllergiesList,
"dietary_preferences": userProfile.dietaryPreferencesList,
"medical_information": userProfile.medicalInformationList,
"current_medications": userProfile.currentMedicationsList,
"activity_level": userProfile.activityLevel,
});
}