diff --git a/making_school_asignment_app/lib/page/home_page/children/annotate_class/widget/annotate_item.dart b/making_school_asignment_app/lib/page/home_page/children/annotate_class/widget/annotate_item.dart index 121f266..2d1850e 100644 --- a/making_school_asignment_app/lib/page/home_page/children/annotate_class/widget/annotate_item.dart +++ b/making_school_asignment_app/lib/page/home_page/children/annotate_class/widget/annotate_item.dart @@ -299,7 +299,7 @@ class _AnnotateItemState extends State { 'homeworkId': widget.homeworkId, 'homeworkName': widget.name, 'classId': itemData.classId, - 'subject': 2, + 'subject': widget.logic.state.subject, }); }, child: Container( diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart index dbfa22d..3d9dde5 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart @@ -125,7 +125,7 @@ class _BottomAnnotationSwitchJobState extends State with height: double.infinity, child: TextButton( child: quickText('全 对', color: Colors.white, size: 12.sp), - onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allWrongRating()), + onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allPairs(context)), ), ), ), @@ -165,7 +165,8 @@ class _BottomAnnotationSwitchJobState extends State with width: double.infinity, height: double.infinity, child: TextButton( - onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allPairs()), + onPressed: () => + easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allWrongRating(context)), child: quickText('全 错', color: Colors.white, size: 12.sp), ), ), @@ -197,7 +198,7 @@ class _BottomAnnotationSwitchJobState extends State with width: double.infinity, height: double.infinity, child: TextButton( - onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit()), + onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit(context)), child: quickText('提 交', size: 12.sp, color: const Color.fromRGBO(76, 199, 147, 1)), ), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart index 9fff9e8..4fed909 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart @@ -145,6 +145,7 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) { return Padding( padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0), child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: studentQuestions?.asMap().keys.map((e) => $ScoringQuestionsView(studentQuestions[e], imageVal.scaleRatio)).toList() ?? [], ), ); @@ -169,69 +170,86 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double useEffect(() { return () {}; }, []); - + var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h); return Container( - alignment: Alignment.topCenter, height: item.height * scaleRatio, + padding: EdgeInsets.zero, child: Stack( + alignment: const FractionalOffset(0, 0), children: [ - Row( - children: [ - // 对 - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.only(top: 7.h, bottom: 3.h), - backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + Container( + color: Colors.yellow, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // 对 + Expanded( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + padding: EdgeInsets.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + ), + child: Padding( + padding: padinVal, + child: Icon( + size: 22.sp, + color: studentScore.value == 2 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), + const IconData(0xe62b, fontFamily: "AlibabaIcon"), + ), + ), + onPressed: () => easyThrottle('scoring_homework_questions', () { + studentScore.value = studentScore.value == 2 ? null : 2; + }), ), - child: Icon( - size: 22.sp, - color: studentScore.value == 2 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), - const IconData(0xe62b, fontFamily: "AlibabaIcon"), - ), - onPressed: () => easyThrottle('scoring_homework_questions', () { - studentScore.value = studentScore.value == 2 ? null : 2; - }), ), - ), - // 半 - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.only(top: 7.h, bottom: 3.h), - backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + // 半 + Expanded( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + padding: EdgeInsets.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + ), + child: Padding( + padding: padinVal, + child: Icon( + size: 22.sp, + color: studentScore.value == 1 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), + const IconData(0xe62c, fontFamily: "AlibabaIcon"), + ), + ), + onPressed: () => easyThrottle('scoring_homework_questions', () { + studentScore.value = studentScore.value == 1 ? null : 1; + }), ), - child: Icon( - size: 22.sp, - color: studentScore.value == 1 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), - const IconData(0xe62c, fontFamily: "AlibabaIcon"), - ), - onPressed: () => easyThrottle('scoring_homework_questions', () { - studentScore.value = studentScore.value == 1 ? null : 1; - }), ), - ), - // 错 - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - padding: EdgeInsets.only(top: 7.h, bottom: 3.h), - backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 - shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + // 错 + Expanded( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + padding: EdgeInsets.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + backgroundColor: const Color.fromRGBO(237, 237, 237, 1), // 设置背景色 + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), // 去除圆角 + ), + child: Padding( + padding: padinVal, + child: Icon( + size: 22.sp, + color: studentScore.value == 0 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), + const IconData(0xe62a, fontFamily: "AlibabaIcon"), + ), + ), + onPressed: () => easyThrottle('scoring_homework_questions', () { + studentScore.value = studentScore.value == 0 ? null : 0; + }), ), - child: Icon( - size: 22.sp, - color: studentScore.value == 0 ? const Color.fromRGBO(255, 152, 0, 1) : const Color.fromRGBO(114, 114, 114, 1), - const IconData(0xe62a, fontFamily: "AlibabaIcon"), - ), - onPressed: () => easyThrottle('scoring_homework_questions', () { - studentScore.value = studentScore.value == 0 ? null : 0; - }), ), - ), - ], + ], + ), ), Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart index 6660b47..588c15c 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/configuration_files/index.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; +import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart'; import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart'; @@ -8,6 +9,7 @@ import 'package:making_school_asignment_app/common/job/marking_models/do_test_qu import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart'; import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart'; import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; +import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; // 数据 class HomeworkReviewState { @@ -111,8 +113,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin { state.data.value?.studentQuestions = data; } - // 全对评分 - void allPairs([int score = 2]) async { + // 全部统一打分 + void allRating(int score) { var studentQuestions = state.studentQuestions.value; if (state.data.value?.studentQuestions.isEmpty ?? true) return; List data = []; @@ -123,27 +125,23 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin { } state.studentQuestions.value = data; state.data.value?.studentQuestions = data; - await submit(); + } + + // 全对评分 + void allPairs(BuildContext context, [int score = 2]) async { + allRating(score); + await submit(context); } // 全错评分 - void allWrongRating([int score = 0]) async { - var studentQuestions = state.studentQuestions.value; - if (state.data.value?.studentQuestions.isEmpty ?? true) return; - List data = []; - for (var e in studentQuestions!) { - var newe = StudentQuestions.fromJson(e.toJson()); - newe.studentScore = score; - data.add(newe); - } - state.studentQuestions.value = data; - state.data.value?.studentQuestions = data; - await submit(); + void allWrongRating(BuildContext context, [int score = 0]) async { + allRating(score); + await submit(context); } // 提交打分 /// allPairs - Future submit() async { + Future submit(BuildContext context) async { var data = state.data.value; if (data == null) return; if (state.data.value?.studentQuestions.isEmpty ?? true) return; @@ -154,17 +152,45 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin { return; } // TODO 请求提交加载框是否需要 如何防止重复提交 - await getClient().reviewSubmission(ReviewSubmissionParams( - homeworkId: state.param.value.homeworkId, - templateId: data.templateId, - studentId: data.studentId, - studentScores: studentQuestions.map((e) { - var studentScore = e.studentScore!; - return StudentScores( - isCorrect: studentScore == 2, - questionNo: e.questionNo, - studentScore: studentScore, - ); - }).toList())); + await getClient() + .reviewSubmission(ReviewSubmissionParams( + homeworkId: state.param.value.homeworkId, + templateId: data.templateId, + studentId: data.studentId, + studentScores: studentQuestions.map((e) { + var studentScore = e.studentScore!; + return StudentScores( + isCorrect: studentScore == 2, + questionNo: e.questionNo, + studentScore: studentScore, + ); + }).toList())) + .then((e) async { + var annotatedCount = data.annotatedCount + 1; // 批阅数量 + var submitCount = data.submitCount; // 学生提交数量 + if (annotatedCount == submitCount) { + // 批阅完成 + showDialog( + context: context, + builder: (BuildContext context1) { + return AlertDialog( + title: quickText('完成批阅提示'), + content: const Text('暂无更多待批阅项,是否返回主页?'), + actions: [ + TextButton(child: const Text('否'), onPressed: () => Navigator.of(context1).pop()), + TextButton( + child: const Text('是'), + onPressed: () { + Navigator.of(context1).pop(); + Get.back(); + }), + ], + ); + }, + ); + return; + } + state.param.value = DoPaperDetailsParam.fromJson(state.param.value.toJson()); + }); } }