mcy_new #1
|
|
@ -299,7 +299,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
'homeworkId': widget.homeworkId,
|
||||
'homeworkName': widget.name,
|
||||
'classId': itemData.classId,
|
||||
'subject': 2,
|
||||
'subject': widget.logic.state.subject,
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> 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<BottomAnnotationSwitch> 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<BottomAnnotationSwitch> 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)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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,27 +170,35 @@ 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(
|
||||
Container(
|
||||
color: Colors.yellow,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 对
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -199,15 +208,19 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -217,15 +230,19 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -233,6 +250,7 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -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<StudentQuestions> 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<StudentQuestions> 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<void> submit() async {
|
||||
Future<void> submit(BuildContext context) async {
|
||||
var data = state.data.value;
|
||||
if (data == null) return;
|
||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||
|
|
@ -154,7 +152,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
return;
|
||||
}
|
||||
// TODO 请求提交加载框是否需要 如何防止重复提交
|
||||
await getClient().reviewSubmission(ReviewSubmissionParams(
|
||||
await getClient()
|
||||
.reviewSubmission(ReviewSubmissionParams(
|
||||
homeworkId: state.param.value.homeworkId,
|
||||
templateId: data.templateId,
|
||||
studentId: data.studentId,
|
||||
|
|
@ -165,6 +164,33 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
questionNo: e.questionNo,
|
||||
studentScore: studentScore,
|
||||
);
|
||||
}).toList()));
|
||||
}).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: <Widget>[
|
||||
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());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue