Compare commits

..

3 Commits

Author SHA1 Message Date
machuanyu d62560184d Merge branch 'mcy_new' into new_main 2024-06-14 09:48:32 +08:00
1147192855@qq.com a4dd67ddfa no message 2024-06-14 09:45:36 +08:00
1147192855@qq.com 19c59b0bde no message 2024-06-12 18:19:07 +08:00
4 changed files with 197 additions and 107 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

@ -59,8 +59,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
heroTag: '点击前往上一题',
tooltip: '点击前往上一题',
focusColor: Theme.of(context).primaryColor,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
elevation: 6.r,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
elevation: 10.r,
onPressed: () => easyThrottle('TestQuestionSwitch', () {
var param = sateData.param.value;
param.studentId = lastPageVal.studentId;
@ -82,8 +82,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
return FloatingActionButton(
heroTag: '点击前往下一题',
tooltip: '点击前往下一题',
elevation: 6.r,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
elevation: 10.r,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
onPressed: () => easyThrottle('TestQuestionSwitch', () {
var param = sateData.param.value;
param.studentId = nextPageVal.studentId;
@ -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,69 +170,86 @@ 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(
children: [
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
Container(
color: Colors.yellow,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
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;
}),
),
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;
}),
),
),
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
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;
}),
),
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;
}),
),
),
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
backgroundColor: const Color.fromRGBO(237, 237, 237, 1), //
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero), //
//
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
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;
}),
),
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;
}),
),
),
],
],
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
@ -261,9 +279,9 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
@hwidget
Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState sateData) {
final scrollControllerQuestion = useScrollController(); //
var vnHandWritings = useValueNotifier<List<dynamic>>([]);
ImageStream? imageStream;
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
WidgetsBinding.instance.addPostFrameCallback((_) {
sateData.imageScale.value = TestQuestionsImageInfo(
boxWidth: maxWidth,
@ -273,7 +291,7 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
url: sateData.data.value!.zgtAnswer,
);
});
});
}));
//
useEffect(() {
@ -283,10 +301,11 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
});
//
return () {
imageStream?.removeListener(imageStreamListener);
imageStream?.removeListener(imageStreamListener.value);
};
}, []);
print('这里是加载了..............');
return Container(
height: maxHeight,
// padding: EdgeInsets.only(bottom: 2.h, top: 2.h),
@ -298,25 +317,69 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
scrollDirection: Axis.vertical, //
child: Obx(() {
var imageUrl = sateData.data.value?.zgtAnswer;
print(imageUrl);
if (imageUrl == null) return const SizedBox();
// return Container(
// color: Colors.green,
// height: 394.45145018915514,
// );
return $TheCachedNetworkImage(
(context, imageProvider) {
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
imageStream?.removeListener(imageStreamListener);
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener);
return Container(
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(-6.r, 1.r), //x轴偏移量
blurRadius: 10.r, //
spreadRadius: 8.r //
)
]),
child: Listener(
behavior: HitTestBehavior.opaque,
onPointerUp: (PointerUpEvent details) {},
onPointerMove: (PointerMoveEvent details) {},
child: RepaintBoundary(
child: CustomPaint(
foregroundPainter: DrawingPainter(ctrl: vnHandWritings),
child: RepaintBoundary(
child: $TheCachedNetworkImage(
(context, imageProvider) {
print('图片加载了..............');
Image imageWidget = Image(image: imageProvider, fit: BoxFit.fitWidth);
imageStream?.removeListener(imageStreamListener.value);
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener.value);
return imageWidget;
},
imageUrl: RequestConfig.imgUrl + imageUrl,
// imageUrl: 'https://cdn3-banquan.ituchong.com/weili/image/l/2000260200787476490.jpeg',
return imageWidget;
},
imageUrl: RequestConfig.imgUrl + imageUrl,
),
),
),
),
),
);
}),
),
);
}
//
class DrawingPainter extends CustomPainter {
final ValueNotifier<List<dynamic>> ctrl;
final Paint paintBrush = Paint()
..color = Colors.red
..strokeCap = StrokeCap.round
..strokeWidth = 1.5.r;
DrawingPainter({required this.ctrl}) : super(repaint: ctrl);
@override
void paint(Canvas canvas, Size size) {
var points = ctrl.value;
var pointsLength = points.length;
// for (int i = 0; i < pointsLength; i++) {
// GestureRecording item = points[i];
// Offset? offsetData = item.data;
// Offset? nextOffsetData = pointsLength - 1 == i ? null : points[i + 1].data;
// if (offsetData != null && nextOffsetData != null) {
// canvas.drawLine(offsetData, nextOffsetData, paintBrush);
// }
// }
}
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
}

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,17 +152,45 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
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()));
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()))
.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());
});
}
}