mcy_new #1
|
|
@ -38,7 +38,7 @@ class QuestionNumberView extends GetView<HomeworkReviewLogic> {
|
|||
var studentQuestions = sateData.studentQuestions.value ?? [];
|
||||
|
||||
return $QuestionNumberScrollView(
|
||||
controller:controller,
|
||||
controller: controller,
|
||||
sateData: sateData,
|
||||
sateZoomData: sateZoomData,
|
||||
studentQuestions: studentQuestions,
|
||||
|
|
@ -141,27 +141,34 @@ Widget $questionNumberScrollView({
|
|||
|
||||
// 单道题得分框
|
||||
@hwidget
|
||||
Widget $scoringQuestionsView(BuildContext context, List<StudentQuestions>? studentQuestions,StudentQuestions item, HomeworkReviewLogic logic, double scaleRatio, double initScale) {
|
||||
Widget $scoringQuestionsView(BuildContext context, List<StudentQuestions>? studentQuestions, StudentQuestions item, HomeworkReviewLogic logic, double scaleRatio, double initScale) {
|
||||
var studentScore = useState<int?>(item.studentScore);
|
||||
|
||||
useValueChanged<int?, void>(studentScore.value, (_, __) {
|
||||
item.studentScore = studentScore.value;
|
||||
|
||||
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
||||
var annotateTime = logic.state.data.value?.annotateTime;
|
||||
if (annotateTime == null) {
|
||||
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
||||
if (noRatingGiven == null) logic.submit(context);
|
||||
}
|
||||
});
|
||||
|
||||
useValueChanged<StudentQuestions, void>(item, (_, __) {
|
||||
useValueChanged<int?, void>(item.studentScore, (_, __) {
|
||||
studentScore.value = item.studentScore;
|
||||
});
|
||||
|
||||
useEffect(() {
|
||||
return () {};
|
||||
/// 学生打分数据
|
||||
studentScoreListener() {
|
||||
item.studentScore = studentScore.value;
|
||||
if (item.studentScore == null) return;
|
||||
|
||||
// 校验是否自动提交 对于已经批阅过的试题 不重复自动提交
|
||||
var annotateTime = logic.state.data.value?.annotateTime;
|
||||
if (annotateTime == null) {
|
||||
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null);
|
||||
if (noRatingGiven == null) logic.submit(context);
|
||||
}
|
||||
}
|
||||
|
||||
studentScore.addListener(studentScoreListener);
|
||||
|
||||
return () {
|
||||
studentScore.removeListener(studentScoreListener);
|
||||
};
|
||||
}, []);
|
||||
|
||||
var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h);
|
||||
return Container(
|
||||
height: item.height! * scaleRatio * initScale,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import 'package:making_school_asignment_app/common/job/marking_models/do_test_qu
|
|||
import 'package:making_school_asignment_app/common/mixins/event_bus_mixin.dart';
|
||||
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
|
||||
import 'package:making_school_asignment_app/common/utils/cached_network_img.dart';
|
||||
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
||||
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||
import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart';
|
||||
import 'package:zoom_widget/zoom_widget.dart';
|
||||
|
|
@ -347,7 +348,17 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
|
|||
sateData.data.value?.zgtAnnotate = null;
|
||||
sateData.data.value?.showZgtAnnotate = null;
|
||||
if (sateData.data.value != null) {
|
||||
sateData.data.update((_) => logic.submit(Get.context ?? context));
|
||||
sateData.data.update((_) {
|
||||
var theStudentQuestions = sateData.studentQuestions.value;
|
||||
if (theStudentQuestions?.isNotEmpty ?? false) {
|
||||
var noMarking = theStudentQuestions?.firstWhereOrNull((e) => e.studentScore == null);
|
||||
if (noMarking != null) {
|
||||
ToastUtils.showInfo("未提交!请为第${noMarking.questionNo}题打分,再手动提交");
|
||||
return;
|
||||
}
|
||||
}
|
||||
logic.submit(Get.context ?? context);
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
|
||||
state.param.value.templateId ??= data.templateId;
|
||||
state.param.value.studentId ??= data.studentId;
|
||||
|
||||
|
||||
state.data.value = data;
|
||||
} catch (e) {
|
||||
print('获取数据报错了:$e');
|
||||
|
|
@ -189,28 +189,26 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
void cancelAllRatings() {
|
||||
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 = null;
|
||||
data.add(newe);
|
||||
if (e.studentScore != null) {
|
||||
e.studentScore = null;
|
||||
}
|
||||
}
|
||||
state.studentQuestions.value = data;
|
||||
state.data.value?.studentQuestions = data;
|
||||
// state.studentQuestions.value = data;
|
||||
// state.data.value?.studentQuestions = data;
|
||||
state.studentQuestions.update((_) {});
|
||||
}
|
||||
|
||||
// 全部统一打分
|
||||
void allRating(int score) {
|
||||
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);
|
||||
e.studentScore = score;
|
||||
}
|
||||
state.studentQuestions.value = data;
|
||||
state.data.value?.studentQuestions = data;
|
||||
// state.studentQuestions.value = data;
|
||||
// state.data.value?.studentQuestions = data;
|
||||
state.studentQuestions.update((_) {});
|
||||
}
|
||||
|
||||
// 全对评分
|
||||
|
|
|
|||
Loading…
Reference in New Issue