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/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
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,7 +23,6 @@ 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,
|
||||||
|
|
@ -132,7 +131,12 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
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
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -148,11 +152,9 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
@ -181,7 +183,12 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
||||||
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,
|
||||||
|
|
|
||||||
|
|
@ -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)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
|
|
@ -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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue