no message

This commit is contained in:
1147192855@qq.com 2024-06-12 14:55:21 +08:00
parent 8a1d7a1dec
commit cf5ec5d25c
7 changed files with 180 additions and 28 deletions

1
.gitignore vendored
View File

@ -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/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/common/api/retrofit_client.g.dart
making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart making_school_asignment_app/lib/page/home_page/children/read_over/read_over_view.g.dart
.vscode/settings.json

View File

@ -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_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_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/favor_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
import 'package:retrofit/retrofit.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/annotated_class.dart';
import 'package:making_school_asignment_app/common/job/class_item.dart'; import 'package:making_school_asignment_app/common/job/class_item.dart';
@ -113,10 +114,13 @@ abstract class RetrofitClient {
// //
@GET("/api/hms/FavStudent/GetList") @GET("/api/hms/FavStudent/GetList")
Future<BasePageData<HomeworkFavs>> getFavList( Future<BasePageData<HomeworkFavs>> getFavList(@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
// () // ()
@POST("/api/hms/Annotate/AllCorrect") @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);
} }

View File

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

View File

@ -23,12 +23,11 @@ class AnnotateItem extends StatefulWidget {
} }
class _AnnotateItemState extends State<AnnotateItem> { class _AnnotateItemState extends State<AnnotateItem> {
Future<bool> confirmDialog() async { Future<bool> confirmDialog() async {
return await showDialog( return await showDialog(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), // borderRadius: BorderRadius.circular(10.0), //
), ),
actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r), actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
@ -51,9 +50,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
), ),
child: const Center( child: const Center(
child: Text( child: Text(
'确定', '确定',
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
))), ))),
onTap: () { onTap: () {
// //
Get.back(result: true); Get.back(result: true);
@ -72,9 +71,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
), ),
child: const Center( child: const Center(
child: Text( child: Text(
'取消', '取消',
style: TextStyle(color: Color(0xFF666666)), style: TextStyle(color: Color(0xFF666666)),
))), ))),
), ),
], ],
), ),
@ -129,10 +128,15 @@ class _AnnotateItemState extends State<AnnotateItem> {
Expanded( Expanded(
flex: 4, flex: 4,
child: ItemBtn( 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, font: widget.font - 2.sp,
clickFunction: () { 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( child: ItemBtn(
title: "一键批阅", title: "一键批阅",
font: widget.font - 2.sp, font: widget.font - 2.sp,
clickFunction: () async{ clickFunction: () async {
var confim = var confim = await confirmDialog();
await confirmDialog();
if (confim) { if (confim) {
widget.logic.getAllCorrect( widget.logic.getAllCorrect(widget.item.classId);
widget.item.classId);
} }
}, },
), ),
@ -178,10 +180,15 @@ class _AnnotateItemState extends State<AnnotateItem> {
Expanded( Expanded(
flex: 4, flex: 4,
child: ItemBtn( 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, font: widget.font - 2.sp,
clickFunction: () { 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( Expanded(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
print('批阅..........');
Get.toNamed(Routes.reviewHomework, arguments: { Get.toNamed(Routes.reviewHomework, arguments: {
'homeworkId': widget.homeworkId, 'homeworkId': widget.homeworkId,
'homeworkName': widget.name, 'homeworkName': widget.name,

View File

@ -18,6 +18,7 @@ class BottomAnnotationSwitch extends StatefulWidget {
class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin { class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with SingleTickerProviderStateMixin {
late AnimationController _animationController; // late AnimationController _animationController; //
final _homeworkLogic = Get.find<HomeworkReviewLogic>();
final _logicControl = Get.find<HomeworkReviewLogic>().annotationState; final _logicControl = Get.find<HomeworkReviewLogic>().annotationState;
StreamSubscription? _opControllisten; StreamSubscription? _opControllisten;
@ -124,7 +125,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
height: double.infinity, height: double.infinity,
child: TextButton( child: TextButton(
child: quickText('全 对', color: Colors.white, size: 12.sp), 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, width: double.infinity,
height: double.infinity, height: double.infinity,
child: TextButton( 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), child: quickText('全 错', color: Colors.white, size: 12.sp),
), ),
), ),
@ -185,7 +186,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: TextButton( 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), child: quickText('取 消', size: 12.sp, color: Colors.white),
), ),
), ),
@ -196,7 +197,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: TextButton( 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)), child: quickText('提 交', size: 12.sp, color: const Color.fromRGBO(76, 199, 147, 1)),
), ),
), ),

View File

@ -140,7 +140,8 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
child: Obx(() { child: Obx(() {
var imageVal = sateData.imageScale.value; var imageVal = sateData.imageScale.value;
if (imageVal == null) return const SizedBox(); if (imageVal == null) return const SizedBox();
var studentQuestions = sateData.data.value?.studentQuestions; var studentQuestions = sateData.studentQuestions.value;
print('书哈哈哈...');
return Padding( return Padding(
padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0), padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0),
child: Column( child: Column(
@ -160,6 +161,15 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
useValueChanged<int?, void>(studentScore.value, (_, __) { useValueChanged<int?, void>(studentScore.value, (_, __) {
item.studentScore = studentScore.value; item.studentScore = studentScore.value;
}); });
useValueChanged<StudentQuestions, void>(item, (_, __) {
studentScore.value = item.studentScore;
});
useEffect(() {
return () {};
}, []);
return Container( return Container(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
height: item.height * scaleRatio, height: item.height * scaleRatio,
@ -254,9 +264,6 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
ImageStream? imageStream; ImageStream? imageStream;
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) { ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
print('屏幕宽高:宽:${maxWidth} 高:${maxHeight}');
print('图片的宽高width${info.image.width.toDouble()};高:${info.image.height.toDouble()}');
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
sateData.imageScale.value = TestQuestionsImageInfo( sateData.imageScale.value = TestQuestionsImageInfo(
boxWidth: maxWidth, boxWidth: maxWidth,

View File

@ -1,9 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'package:get/get.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_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_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/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/mixins/request_tool_mixin.dart';
import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
@ -15,6 +17,7 @@ class HomeworkReviewState {
// late String homeworkName; // late String homeworkName;
late Rx<DoPaperDetailsParam> param; late Rx<DoPaperDetailsParam> param;
late Rx<DoPaperDetailsResult?> data; late Rx<DoPaperDetailsResult?> data;
late Rx<List<StudentQuestions>?> studentQuestions;
late Rx<double> slide; // late Rx<double> slide; //
late Rx<TestQuestionsImageInfo?> imageScale; late Rx<TestQuestionsImageInfo?> imageScale;
@ -57,6 +60,7 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
subject: Get.arguments['subject'], subject: Get.arguments['subject'],
).obs; ).obs;
state.data = Rx<DoPaperDetailsResult?>(null); state.data = Rx<DoPaperDetailsResult?>(null);
state.studentQuestions = Rx<List<StudentQuestions>?>(null);
state.imageScale = Rx<TestQuestionsImageInfo?>(null); state.imageScale = Rx<TestQuestionsImageInfo?>(null);
state.slide = 0.0.obs; state.slide = 0.0.obs;
getData(); getData();
@ -85,10 +89,82 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
// item.topHeight = itemPre.height; // item.topHeight = itemPre.height;
// } // }
state.data.value = data; state.data.value = data;
state.studentQuestions.value = data.studentQuestions;
} finally { } finally {
if (timerControl.isActive) timerControl.cancel(); if (timerControl.isActive) timerControl.cancel();
ToastUtils.dismiss(); 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()));
}
} }