diff --git a/lib/http/ApiService.dart b/lib/http/ApiService.dart index 37401fd..bf400c2 100644 --- a/lib/http/ApiService.dart +++ b/lib/http/ApiService.dart @@ -537,6 +537,10 @@ U6Hzm1ninpWeE+awIDAQAB static Future> getUserFace( String imagePath, String studentId, + String VIDEOCOURSEWARE_ID, + String CURRICULUM_ID, + String CHAPTER_ID, + String CLASS_ID, ) async { final file = File(imagePath); if (!await file.exists()) { @@ -551,6 +555,12 @@ U6Hzm1ninpWeE+awIDAQAB 'USER_ID': SessionService.instance.loginUserId, 'STUDENT_ID': studentId, 'CORPINFO_ID': SessionService.instance.corpinfoId, + + "CLASS_ID":CLASS_ID, + "VIDEOCOURSEWARE_ID": VIDEOCOURSEWARE_ID, + "CURRICULUM_ID": CURRICULUM_ID, + "CHAPTER_ID": CHAPTER_ID, + 'FFILE': await MultipartFile.fromFile(file.path, filename: fileName), }, ); diff --git a/lib/pages/home/scan_page.dart b/lib/pages/home/scan_page.dart index 06c8a79..f7778e2 100644 --- a/lib/pages/home/scan_page.dart +++ b/lib/pages/home/scan_page.dart @@ -109,14 +109,18 @@ class _ScanPageState extends State { void goToFace(Map stuInfo) async { print('navigate to face with $stuInfo'); final passed = await pushPage( - FaceRecognitionPage(studentId: stuInfo['STUDENT_ID'], mode: FaceMode.auto), + FaceRecognitionPage(studentId: stuInfo['STUDENT_ID'], + VIDEOCOURSEWARE_ID: stuInfo['VIDEOCOURSEWARE_ID'],CURRICULUM_ID: stuInfo['CURRICULUM_ID'], + CHAPTER_ID: stuInfo['CHAPTER_ID'],CLASS_ID: stuInfo['CLASS_ID'], + mode: FaceMode.auto), context, ); if (passed == true) { ToastUtil.showSuccess(context, '验证成功'); - + Navigator.pop(context); } else { ToastUtil.showError(context, '验证失败'); + Navigator.pop(context); } } diff --git a/lib/pages/home/study/face_ecognition_page.dart b/lib/pages/home/study/face_ecognition_page.dart index d992097..c99837f 100644 --- a/lib/pages/home/study/face_ecognition_page.dart +++ b/lib/pages/home/study/face_ecognition_page.dart @@ -21,11 +21,23 @@ enum FaceMode { auto, manual } class FaceRecognitionPage extends StatefulWidget { final String studentId; + + final String VIDEOCOURSEWARE_ID; + final String CURRICULUM_ID; + final String CHAPTER_ID; + final String CLASS_ID; + final FaceMode mode; const FaceRecognitionPage({ Key? key, required this.studentId, + + required this.VIDEOCOURSEWARE_ID, + required this.CURRICULUM_ID, + required this.CHAPTER_ID, + required this.CLASS_ID, + this.mode = FaceMode.auto, }) : super(key: key); @@ -259,7 +271,8 @@ class _FaceRecognitionPageState extends State } catch (_) {} final XFile pic = await _cameraController!.takePicture(); - final res = await ApiService.getUserFace(pic.path, widget.studentId); + final res = await ApiService.getUserFace(pic.path, widget.studentId, + widget.VIDEOCOURSEWARE_ID,widget.CURRICULUM_ID,widget.CHAPTER_ID,widget.CLASS_ID,); if (res['result'] == 'success') { _onSuccess(); diff --git a/lib/pages/home/study/study_class_list_page.dart b/lib/pages/home/study/study_class_list_page.dart index 5778c90..2976d44 100644 --- a/lib/pages/home/study/study_class_list_page.dart +++ b/lib/pages/home/study/study_class_list_page.dart @@ -46,7 +46,7 @@ class _StudyClassListPageState extends State { final result = await ApiService.getVideoPermissions(); if (result['result'] == 'success') { SessionService.instance.setStudyToken(result['token'] ?? ''); - pushPage(StudyDetailPage(item, widget.studyData['STUDENT_ID']), context); + pushPage(StudyDetailPage(item, widget.studyData['STUDENT_ID'],widget.studyData), context); } } @override diff --git a/lib/pages/home/study/study_detail_page.dart b/lib/pages/home/study/study_detail_page.dart index c278296..29438ed 100644 --- a/lib/pages/home/study/study_detail_page.dart +++ b/lib/pages/home/study/study_detail_page.dart @@ -25,8 +25,9 @@ enum TakeExamType { video_study, strengththen, list } class StudyDetailPage extends StatefulWidget { final Map studyDetailDetail; final String studentId; + final Map studyData; - const StudyDetailPage(this.studyDetailDetail, this.studentId, {super.key}); + const StudyDetailPage(this.studyDetailDetail, this.studentId, this.studyData,{super.key}); @override State createState() => _StudyDetailPageState(); @@ -284,7 +285,10 @@ class _StudyDetailPageState extends State await _exitTopRouteAndWait(); await _lockPortrait(); final passed = await pushPage( - FaceRecognitionPage(studentId: widget.studentId, mode: FaceMode.auto), + FaceRecognitionPage(studentId: widget.studentId, + VIDEOCOURSEWARE_ID:"",CURRICULUM_ID:"", + CHAPTER_ID: "",CLASS_ID: "", + mode: FaceMode.auto), context, ); await _restoreDefaultOrientations(); @@ -307,7 +311,10 @@ class _StudyDetailPageState extends State await _exitTopRouteAndWait(); await _lockPortrait(); await pushPage( - const FaceRecognitionPage(studentId: '', mode: FaceMode.manual), + const FaceRecognitionPage(studentId: '', + VIDEOCOURSEWARE_ID: '',CURRICULUM_ID: '', + CHAPTER_ID: '',CLASS_ID: '', + mode: FaceMode.manual), context, ); await _restoreDefaultOrientations(); @@ -718,7 +725,10 @@ class _StudyDetailPageState extends State await _lockPortrait(); final passed = await pushPage( - FaceRecognitionPage(studentId: widget.studentId, mode: FaceMode.auto), + FaceRecognitionPage(studentId: widget.studentId, + VIDEOCOURSEWARE_ID: "",CURRICULUM_ID: "", + CHAPTER_ID: "",CLASS_ID: "", + mode: FaceMode.auto), context, ); diff --git a/lib/pages/mine/mine_set_page.dart b/lib/pages/mine/mine_set_page.dart index 1d3afe1..f9866e4 100644 --- a/lib/pages/mine/mine_set_page.dart +++ b/lib/pages/mine/mine_set_page.dart @@ -68,7 +68,10 @@ class _MineSetPageState extends State { child: _setItemWidget("更新人脸信息"), onTap: () { pushPage( - const FaceRecognitionPage(studentId: '', mode: FaceMode.manual), + const FaceRecognitionPage(studentId: '', + VIDEOCOURSEWARE_ID: '',CURRICULUM_ID: '', + CHAPTER_ID: '',CLASS_ID: '', + mode: FaceMode.manual), context, ); },