54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:derma_flutter/api/dto/article_detail_dto.dart';
|
|
import 'package:derma_flutter/api/dto/record_list_dto.dart';
|
|
import 'package:derma_flutter/api/dto/skin_check_dto.dart';
|
|
import 'package:derma_flutter/api/network/request.dart';
|
|
import 'package:dio/dio.dart';
|
|
|
|
import '../dto/article_dto.dart';
|
|
|
|
///皮肤检测
|
|
Future<SkinCheckDto> skinDetectApi(String path) async {
|
|
FormData formData = FormData.fromMap({
|
|
"skin_image": await MultipartFile.fromFile(path),
|
|
});
|
|
var res = await Request().post("/skin/check", formData);
|
|
return SkinCheckDto.fromJson(res);
|
|
}
|
|
|
|
///提交联系邮箱
|
|
Future<void> skinContactApi(int id, String email) async {
|
|
await Request().post("/customer-health/submit-demand", {
|
|
"email": email,
|
|
"skin_check_record_id": id,
|
|
});
|
|
}
|
|
|
|
///皮肤检测记录
|
|
Future<RecordListDto> skinRecordApi({
|
|
int page = 1,
|
|
int pageSize = 20,
|
|
Map<String, dynamic>? query,
|
|
}) async {
|
|
var res = await Request().get("/skin/records", {
|
|
"search_params": jsonEncode(query),
|
|
"page": page,
|
|
"page_size": pageSize,
|
|
});
|
|
return RecordListDto.fromJson(res);
|
|
}
|
|
|
|
///获取文章列表
|
|
Future<List<ArticleDto>> articleListApi() async{
|
|
var res = await Request().get("/customer-health/get_articles");
|
|
return (res['list'] as List).map((e) => ArticleDto.fromJson(e)).toList();
|
|
}
|
|
|
|
///文章详情
|
|
Future<ArticleDetailDto> articleDetailApi(String id) async{
|
|
var res = await Request().get("/customer-health/get_article_detail", {
|
|
"id": id,
|
|
});
|
|
return ArticleDetailDto.fromJson(res);
|
|
} |