Compare commits
No commits in common. "d62560184d4d3edf7542136446af6e82afa67773" and "cd9904ef0a68ef9f36ebee08fe20e34bd643f937" have entirely different histories.
d62560184d
...
cd9904ef0a
|
|
@ -299,7 +299,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
|
|||
'homeworkId': widget.homeworkId,
|
||||
'homeworkName': widget.name,
|
||||
'classId': itemData.classId,
|
||||
'subject': widget.logic.state.subject,
|
||||
'subject': 2,
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
|
|
|
|||
|
|
@ -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.allPairs(context)),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allWrongRating()),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -165,8 +165,7 @@ class _BottomAnnotationSwitchJobState extends State<BottomAnnotationSwitch> with
|
|||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () =>
|
||||
easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allWrongRating(context)),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.allPairs()),
|
||||
child: quickText('全 错', color: Colors.white, size: 12.sp),
|
||||
),
|
||||
),
|
||||
|
|
@ -198,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', () => _homeworkLogic.submit(context)),
|
||||
onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit()),
|
||||
child: quickText('提 交', size: 12.sp, color: const Color.fromRGBO(76, 199, 147, 1)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
heroTag: '点击前往上一题',
|
||||
tooltip: '点击前往上一题',
|
||||
focusColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
elevation: 10.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
|
||||
elevation: 6.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: 10.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
elevation: 6.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = nextPageVal.studentId;
|
||||
|
|
@ -145,7 +145,6 @@ 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() ?? [],
|
||||
),
|
||||
);
|
||||
|
|
@ -170,35 +169,27 @@ 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: [
|
||||
Container(
|
||||
color: Colors.yellow,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
Row(
|
||||
children: [
|
||||
// 对
|
||||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -208,19 +199,15 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -230,19 +217,15 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
Expanded(
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
padding: EdgeInsets.only(top: 7.h, bottom: 3.h),
|
||||
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;
|
||||
}),
|
||||
|
|
@ -250,7 +233,6 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
|
@ -279,9 +261,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;
|
||||
var imageStreamListener = useState<ImageStreamListener>(ImageStreamListener((ImageInfo info, bool _) {
|
||||
|
||||
ImageStreamListener imageStreamListener = ImageStreamListener((ImageInfo info, bool _) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
sateData.imageScale.value = TestQuestionsImageInfo(
|
||||
boxWidth: maxWidth,
|
||||
|
|
@ -291,7 +273,7 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
url: sateData.data.value!.zgtAnswer,
|
||||
);
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
// 可选:添加滚动监听
|
||||
useEffect(() {
|
||||
|
|
@ -301,11 +283,10 @@ Widget $questionImageView(double maxWidth, double maxHeight, HomeworkReviewState
|
|||
});
|
||||
// 返回一个清理函数,在组件销毁时移除监听
|
||||
return () {
|
||||
imageStream?.removeListener(imageStreamListener.value);
|
||||
imageStream?.removeListener(imageStreamListener);
|
||||
};
|
||||
}, []);
|
||||
|
||||
print('这里是加载了..............');
|
||||
return Container(
|
||||
height: maxHeight,
|
||||
// padding: EdgeInsets.only(bottom: 2.h, top: 2.h),
|
||||
|
|
@ -317,69 +298,25 @@ 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(
|
||||
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(
|
||||
// return Container(
|
||||
// color: Colors.green,
|
||||
// height: 394.45145018915514,
|
||||
// );
|
||||
return $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);
|
||||
imageStream?.removeListener(imageStreamListener);
|
||||
imageStream = imageWidget.image.resolve(const ImageConfiguration())..addListener(imageStreamListener);
|
||||
|
||||
return imageWidget;
|
||||
},
|
||||
imageUrl: RequestConfig.imgUrl + imageUrl,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// imageUrl: 'https://cdn3-banquan.ituchong.com/weili/image/l/2000260200787476490.jpeg',
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 批注框
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
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';
|
||||
|
|
@ -9,7 +8,6 @@ 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 {
|
||||
|
|
@ -113,8 +111,8 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
state.data.value?.studentQuestions = data;
|
||||
}
|
||||
|
||||
// 全部统一打分
|
||||
void allRating(int score) {
|
||||
// 全对评分
|
||||
void allPairs([int score = 2]) async {
|
||||
var studentQuestions = state.studentQuestions.value;
|
||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||
List<StudentQuestions> data = [];
|
||||
|
|
@ -125,23 +123,27 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
}
|
||||
state.studentQuestions.value = data;
|
||||
state.data.value?.studentQuestions = data;
|
||||
}
|
||||
|
||||
// 全对评分
|
||||
void allPairs(BuildContext context, [int score = 2]) async {
|
||||
allRating(score);
|
||||
await submit(context);
|
||||
await submit();
|
||||
}
|
||||
|
||||
// 全错评分
|
||||
void allWrongRating(BuildContext context, [int score = 0]) 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();
|
||||
}
|
||||
|
||||
// 提交打分
|
||||
/// allPairs
|
||||
Future<void> submit(BuildContext context) async {
|
||||
Future<void> submit() async {
|
||||
var data = state.data.value;
|
||||
if (data == null) return;
|
||||
if (state.data.value?.studentQuestions.isEmpty ?? true) return;
|
||||
|
|
@ -152,8 +154,7 @@ 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,
|
||||
|
|
@ -164,33 +165,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
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());
|
||||
});
|
||||
}).toList()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue