mcy_new #1
|
|
@ -51,3 +51,4 @@ making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view
|
|||
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart
|
||||
making_school_asignment_app/lib/common/api/retrofit_client.g.dart
|
||||
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart
|
||||
.vscode/settings.json
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:dio/dio.dart' hide Headers;
|
|||
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';
|
||||
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
|
||||
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
|
||||
import 'package:retrofit/retrofit.dart';
|
||||
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
|
||||
import 'package:making_school_asignment_app/common/job/class_item.dart';
|
||||
|
|
@ -113,10 +114,13 @@ abstract class RetrofitClient {
|
|||
|
||||
//收藏夹列表
|
||||
@GET("/api/hms/FavStudent/GetList")
|
||||
Future<BasePageData<HomeworkFavs>> getFavList(
|
||||
@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
|
||||
Future<BasePageData<HomeworkFavs>> getFavList(@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
|
||||
|
||||
//一键批阅 (默认未批阅的题目全部正确)
|
||||
@POST("/api/hms/Annotate/AllCorrect")
|
||||
Future getAllCorrect(@Field() String homeworkId,@Field() String classId);
|
||||
Future getAllCorrect(@Field() String homeworkId, @Field() String classId);
|
||||
|
||||
// 批阅提交
|
||||
@POST("/api/hms/Annotate/AnnotateSubmit")
|
||||
Future reviewSubmission(@Body() ReviewSubmissionParams param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'review_submission_params.g.dart';
|
||||
|
||||
@JsonSerializable(includeIfNull: false)
|
||||
class ReviewSubmissionParams extends Object {
|
||||
@JsonKey(name: 'homeworkId')
|
||||
String homeworkId;
|
||||
|
||||
@JsonKey(name: 'templateId')
|
||||
int templateId;
|
||||
|
||||
@JsonKey(name: 'studentId')
|
||||
int studentId;
|
||||
|
||||
@JsonKey(name: 'studentScores')
|
||||
List<StudentScores> studentScores;
|
||||
|
||||
@JsonKey(name: 'pictureBytes')
|
||||
String? zgtAnnotate;
|
||||
|
||||
ReviewSubmissionParams({
|
||||
required this.homeworkId,
|
||||
required this.templateId,
|
||||
required this.studentId,
|
||||
required this.studentScores,
|
||||
this.zgtAnnotate,
|
||||
});
|
||||
|
||||
factory ReviewSubmissionParams.fromJson(Map<String, dynamic> srcJson) => _$ReviewSubmissionParamsFromJson(srcJson);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ReviewSubmissionParamsToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class StudentScores extends Object {
|
||||
@JsonKey(name: 'questionNo')
|
||||
int questionNo;
|
||||
|
||||
@JsonKey(name: 'studentScore')
|
||||
int studentScore;
|
||||
|
||||
@JsonKey(name: 'isCorrect')
|
||||
bool isCorrect;
|
||||
|
||||
StudentScores({
|
||||
required this.questionNo,
|
||||
required this.studentScore,
|
||||
required this.isCorrect,
|
||||
});
|
||||
|
||||
factory StudentScores.fromJson(Map<String, dynamic> srcJson) => _$StudentScoresFromJson(srcJson);
|
||||
|
||||
Map<String, dynamic> toJson() => _$StudentScoresToJson(this);
|
||||
}
|
||||
|
|
@ -23,12 +23,11 @@ class AnnotateItem extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _AnnotateItemState extends State<AnnotateItem> {
|
||||
|
||||
Future<bool> confirmDialog() async {
|
||||
return await showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0), // 设置圆角大小
|
||||
),
|
||||
actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
|
||||
|
|
@ -51,9 +50,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'确定',
|
||||
style: TextStyle(color: Colors.white),
|
||||
))),
|
||||
'确定',
|
||||
style: TextStyle(color: Colors.white),
|
||||
))),
|
||||
onTap: () {
|
||||
// 执行操作
|
||||
Get.back(result: true);
|
||||
|
|
@ -72,9 +71,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(color: Color(0xFF666666)),
|
||||
))),
|
||||
'取消',
|
||||
style: TextStyle(color: Color(0xFF666666)),
|
||||
))),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
@ -129,10 +128,15 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
Expanded(
|
||||
flex: 4,
|
||||
child: ItemBtn(
|
||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty?'(${ widget.item.homeworkFavs.length})':''}",
|
||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
||||
font: widget.font - 2.sp,
|
||||
clickFunction: () {
|
||||
Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade});
|
||||
Get.toNamed(Routes.favStudentPage, arguments: {
|
||||
'homeworkName': widget.name,
|
||||
'classId': widget.item.classId,
|
||||
'homeworkId': widget.logic.state.homeworkId.value,
|
||||
'grade': widget.item.grade
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
@ -147,12 +151,10 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
child: ItemBtn(
|
||||
title: "一键批阅",
|
||||
font: widget.font - 2.sp,
|
||||
clickFunction: () async{
|
||||
var confim =
|
||||
await confirmDialog();
|
||||
clickFunction: () async {
|
||||
var confim = await confirmDialog();
|
||||
if (confim) {
|
||||
widget.logic.getAllCorrect(
|
||||
widget.item.classId);
|
||||
widget.logic.getAllCorrect(widget.item.classId);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
|
@ -178,10 +180,15 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
Expanded(
|
||||
flex: 4,
|
||||
child: ItemBtn(
|
||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty?'(${ widget.item.homeworkFavs.length})':''}",
|
||||
title: "收藏夹${widget.item.homeworkFavs.isNotEmpty ? '(${widget.item.homeworkFavs.length})' : ''}",
|
||||
font: widget.font - 2.sp,
|
||||
clickFunction: () {
|
||||
Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade});
|
||||
Get.toNamed(Routes.favStudentPage, arguments: {
|
||||
'homeworkName': widget.name,
|
||||
'classId': widget.item.classId,
|
||||
'homeworkId': widget.logic.state.homeworkId.value,
|
||||
'grade': widget.item.grade
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
@ -287,6 +294,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print('批阅..........');
|
||||
Get.toNamed(Routes.reviewHomework, arguments: {
|
||||
'homeworkId': widget.homeworkId,
|
||||
'homeworkName': widget.name,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class BottomAnnotationSwitch extends StatefulWidget {
|
|||
|
||||
class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin {
|
||||
late AnimationController _animationController; // 动画
|
||||
final _homeworkLogic = Get.find<HomeworkReviewLogic>();
|
||||
final _logicControl = Get.find<HomeworkReviewLogic>().annotationState;
|
||||
StreamSubscription? _opControllisten;
|
||||
|
||||
|
|
@ -124,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', () {}),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allWrongRating()),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -164,7 +165,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
|
|||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () {}),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allPairs()),
|
||||
child: quickText('全 错', color: Colors.white, size: 12.sp),
|
||||
),
|
||||
),
|
||||
|
|
@ -185,7 +186,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
|
|||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () {}),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.cancelAllRatings()),
|
||||
child: quickText('取 消', size: 12.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
|
|
@ -196,7 +197,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
|
|||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () {}),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit()),
|
||||
child: quickText('提 交', size: 12.sp, color: const Color.fromRGBO(76, 199, 147, 1)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
|||
child: Obx(() {
|
||||
var imageVal = sateData.imageScale.value;
|
||||
if (imageVal == null) return const SizedBox();
|
||||
var studentQuestions = sateData.data.value?.studentQuestions;
|
||||
var studentQuestions = sateData.studentQuestions.value;
|
||||
print('书哈哈哈...');
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0),
|
||||
child: Column(
|
||||
|
|
@ -160,6 +161,15 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
useValueChanged<int?, void>(studentScore.value, (_, __) {
|
||||
item.studentScore = studentScore.value;
|
||||
});
|
||||
|
||||
useValueChanged<StudentQuestions, void>(item, (_, __) {
|
||||
studentScore.value = item.studentScore;
|
||||
});
|
||||
|
||||
useEffect(() {
|
||||
return () {};
|
||||
}, []);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.topCenter,
|
||||
height: item.height * scaleRatio,
|
||||
|
|
@ -254,9 +264,6 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
ImageStream? imageStream;
|
||||
|
||||
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
|
||||
print('屏幕宽高:宽:${maxWidth}, 高:${maxHeight}');
|
||||
print('图片的宽高:width:${info.image.width.toDouble()};高:${info.image.height.toDouble()}');
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
sateData.imageScale.value = TestQuestionsImageInfo(
|
||||
boxWidth: maxWidth,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
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';
|
||||
import 'package:making_school_asignment_app/common/job/marking_models/do_test_questions_image_info.dart';
|
||||
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';
|
||||
|
||||
|
|
@ -15,6 +17,7 @@ class HomeworkReviewState {
|
|||
// late String homeworkName;
|
||||
late Rx<DoPaperDetailsParam> param;
|
||||
late Rx<DoPaperDetailsResult?> data;
|
||||
late Rx<List<StudentQuestions>?> studentQuestions;
|
||||
late Rx<double> slide; // 滑动位置
|
||||
late Rx<TestQuestionsImageInfo?> imageScale;
|
||||
|
||||
|
|
@ -57,6 +60,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
subject: Get.arguments['subject'],
|
||||
).obs;
|
||||
state.data = Rx<DoPaperDetailsResult?>(null);
|
||||
state.studentQuestions = Rx<List<StudentQuestions>?>(null);
|
||||
state.imageScale = Rx<TestQuestionsImageInfo?>(null);
|
||||
state.slide = 0.0.obs;
|
||||
getData();
|
||||
|
|
@ -85,10 +89,82 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
// item.topHeight = itemPre.height;
|
||||
// }
|
||||
state.data.value = data;
|
||||
state.studentQuestions.value = data.studentQuestions;
|
||||
} finally {
|
||||
if (timerControl.isActive) timerControl.cancel();
|
||||
|
||||
ToastUtils.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
// 取消全部评分
|
||||
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);
|
||||
}
|
||||
state.studentQuestions.value = data;
|
||||
state.data.value?.studentQuestions = data;
|
||||
}
|
||||
|
||||
// 全对评分
|
||||
void allPairs([int score = 2]) 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([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();
|
||||
}
|
||||
|
||||
// 提交打分
|
||||
/// allPairs
|
||||
Future<void> submit() async {
|
||||
var data = state.data.value;
|
||||
if (data == null) return;
|
||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||
var studentQuestions = state.data.value!.studentQuestions;
|
||||
var noRatingElement = studentQuestions.firstWhereOrNull((e) => e.studentScore == null);
|
||||
if (noRatingElement != null) {
|
||||
ToastUtils.showInfo('${noRatingElement.questionNo}题请评分');
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue