no message

This commit is contained in:
1147192855@qq.com 2024-06-12 18:19:07 +08:00
parent 9421c6e90e
commit 19c59b0bde
4 changed files with 130 additions and 85 deletions

View File

@ -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(

View File

@ -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)),
),
),

View File

@ -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: [

View File

@ -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());
});
}
}