109 lines
2.9 KiB
Dart
109 lines
2.9 KiB
Dart
|
|
import 'dart:io';
|
||
|
|
|
||
|
|
import 'package:dio/dio.dart';
|
||
|
|
import 'package:qhd_prevention/http/ApiService.dart';
|
||
|
|
import 'package:qhd_prevention/http/HttpManager.dart';
|
||
|
|
import 'package:qhd_prevention/services/SessionService.dart';
|
||
|
|
|
||
|
|
class EduApi {
|
||
|
|
/// 班级列表
|
||
|
|
static Future<Map<String, dynamic>> getClassList(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/class/list',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 验证是否可以签到
|
||
|
|
static Future<Map<String, dynamic>> checkSignIn(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentSign/verify',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 对比人脸
|
||
|
|
static Future<Map<String, dynamic>> compareFace(Map formData, String path) async {
|
||
|
|
final data = Map<String, dynamic>.from(formData);
|
||
|
|
// 把文件路径填成 MultipartFile
|
||
|
|
data['files'] = await MultipartFile.fromFile(
|
||
|
|
path,
|
||
|
|
filename: path.split(Platform.pathSeparator).last,
|
||
|
|
);
|
||
|
|
return HttpManager().uploadImages(
|
||
|
|
baseUrl: '${ApiService.basePath}/edu',
|
||
|
|
path: '/app/studentSign/compareFace',
|
||
|
|
fromData: data,
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 上传签字照片
|
||
|
|
static Future<Map<String, dynamic>> uploadSignature(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentSign/uploadSignUrl',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 签到信息列表
|
||
|
|
static Future<Map<String, dynamic>> getSignInList(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentSign/listAll',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 获取试卷详情
|
||
|
|
static Future<Map<String, dynamic>> getExamDetail(String classId) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/classExamPaper/getInfoByClassId/$classId',
|
||
|
|
method: Method.get,
|
||
|
|
data: {
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 提交试卷
|
||
|
|
static Future<Map<String, dynamic>> submitExam(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentExamRecord/submit',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 获取考试记录
|
||
|
|
static Future<Map<String, dynamic>> getExamRecord(Map data) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentExamRecord/list',
|
||
|
|
method: Method.post,
|
||
|
|
data: {
|
||
|
|
...data,
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
// 获取考试记录详情
|
||
|
|
static Future<Map<String, dynamic>> getExamRecordDetail(String recordId) async {
|
||
|
|
return HttpManager().request(
|
||
|
|
'${ApiService.basePath}/edu',
|
||
|
|
'/app/studentExamRecord/$recordId',
|
||
|
|
method: Method.get,
|
||
|
|
data: {
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|