diff --git a/marking_app/lib/components/PictureOverview.dart b/marking_app/lib/components/PictureOverview.dart index 5dc23ec..8bb4258 100644 --- a/marking_app/lib/components/PictureOverview.dart +++ b/marking_app/lib/components/PictureOverview.dart @@ -71,6 +71,7 @@ class PictureOverview extends StatefulHookConsumerWidget { final String testQuestionNumber; final Map commentImageMap; final MarkingTextQuestion data; + final Function callAnnotationTips; const PictureOverview({ required this.imageItems, @@ -80,6 +81,7 @@ class PictureOverview extends StatefulHookConsumerWidget { required this.questionNum, required this.markingUserId, required this.data, + required this.callAnnotationTips, this.homework = false, this.imageScale = 1, this.imagePosition, @@ -139,6 +141,7 @@ class PictureOverviewState extends ConsumerState with CommonMix // 事件总线监听 清空数据 eventOn(callback: (BottomAnnotationSwitchCleanallOfMarking item) async { + widget.callAnnotationTips(); // 调用回调 通知父级批注记录被更改 if (ref.read(drawMarkingProvider).data.isEmpty) { if (widget.data.commentImageUrl.isNotEmpty) { bool? res = await showDialog( @@ -146,7 +149,7 @@ class PictureOverviewState extends ConsumerState with CommonMix barrierDismissible: false, context: context, builder: (context1) { - return AlertDialog(content: quickText("是否撤销上次批注痕迹"), actions: [ + return AlertDialog(content: quickText("是否撤销上次批阅批注痕迹"), actions: [ TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)), TextButton(child: quickText("确定", color: Theme.of(context).primaryColor), onPressed: () => Navigator.pop(context1, true)) ]); @@ -424,6 +427,7 @@ class PictureOverviewState extends ConsumerState with CommonMix var newVal = ref.read(drawMarkingProvider).data..add(GestureRecording(eraser: graffitiSwitch.openEraser, data: localPosition)); var newVal1 = ref.read(drawMarkingProvider).offsets..add(localPosition); ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal(newVal, newVal1)); + widget.callAnnotationTips(); }, // onPointerDown: (PointerDownEvent event) { // }, diff --git a/marking_app/lib/pages/marking/components/do_paper_bottom_review_marks.dart b/marking_app/lib/pages/marking/components/do_paper_bottom_review_marks.dart index 3185981..6e78354 100644 --- a/marking_app/lib/pages/marking/components/do_paper_bottom_review_marks.dart +++ b/marking_app/lib/pages/marking/components/do_paper_bottom_review_marks.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -5,6 +6,7 @@ import 'package:marking_app/common/model/enum/review_marks_bottom_btns_enum.dart import 'package:marking_app/common/model/event_bus/bottom_annotation_switch_cleanall.dart'; import 'package:marking_app/pages/common/event_bus_mixin.dart'; import 'package:marking_app/utils/anti_shake_throttling.dart'; +import 'package:marking_app/utils/my_text.dart'; import '../provider/do_paper_bottom_review_marks_provider.dart'; @@ -84,7 +86,31 @@ class _DoPaperBottomReviewMarksState extends ConsumerState easyThrottle( 'REVIEW_MARKS_BOTTOM_BTNS', duration: const Duration(milliseconds: 100), - () => eventFire(model: BottomAnnotationSwitchCleanallOfMarking(cleanAll: true)), + () async { + var resFlag = await showDialog( + context: context, + builder: (BuildContext context) { + return CupertinoAlertDialog( + title: quickText('撤销批阅痕迹', size: 14.sp, color: Color.fromARGB(255, 53, 52, 52)), + content: SingleChildScrollView( + padding: EdgeInsets.only(top: 4.h), + child: RichText(text: TextSpan(text: '请确认需要撤销所有批阅痕迹?', style: TextStyle(color: Color.fromARGB(255, 58, 58, 58)))), + ), + actions: [ + CupertinoDialogAction( + child: Text("取消", style: TextStyle(color: Color.fromARGB(255, 58, 58, 58))), + onPressed: () => Navigator.of(context).pop(false), + ), + CupertinoDialogAction( + child: Text("确定"), + onPressed: () => Navigator.of(context).pop(true), + ), + ], + ); + }, + ); + if (resFlag == true) eventFire(model: BottomAnnotationSwitchCleanallOfMarking(cleanAll: true)); + }, ), padding: EdgeInsets.zero, icon: Icon(Icons.reply_all_outlined, color: btnEnum == ReviewMarksBottomBtnsEnum.CLEAR_ALL ? actionColor : Colors.white, size: 34.r), diff --git a/marking_app/lib/pages/marking/do_papers.dart b/marking_app/lib/pages/marking/do_papers.dart index 27cec61..fd45696 100644 --- a/marking_app/lib/pages/marking/do_papers.dart +++ b/marking_app/lib/pages/marking/do_papers.dart @@ -14,6 +14,7 @@ import 'package:achievement_view/achievement_view.dart'; import 'package:collection/collection.dart'; import 'package:dotted_border/dotted_border.dart'; import 'package:dropdown_search/dropdown_search.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; @@ -29,6 +30,7 @@ import 'package:marking_app/common/model/common/upload_img_secret_key.dart'; import 'package:marking_app/common/model/enum/KeyboardType.dart'; import 'package:marking_app/common/model/enum/marking_list_type.dart'; import 'package:marking_app/common/model/enum/review_marks_bottom_btns_enum.dart'; +import 'package:marking_app/common/model/event_bus/bottom_annotation_switch_cleanall.dart'; import 'package:marking_app/common/model/marking/current_review_task.dart'; import 'package:marking_app/common/model/marking/do_marking_keyboard_model.dart'; import 'package:marking_app/common/model/marking/keyboard_assist_event.dart'; @@ -142,6 +144,7 @@ class _MarkingPapersState extends ConsumerState bool _completionPromptTab = false; // tab下试题完成并提示 bool _reviewCompletedPrompted = false; // 已经批阅完成提示 + bool annotationTips = false; // 批注提示(用于已批注但未提交) // bool _switchQueTypePrompt = false; // 切换题型 @@ -195,6 +198,7 @@ class _MarkingPapersState extends ConsumerState setTimeOut(300, () { eventFireSub(model: SwitchKeyboardToReloadImages(true)); }); + eventOn(callback: (BottomAnnotationSwitchCleanallOfMarking item) async {}); }); params = MarkingTextQuestionParams( @@ -506,6 +510,7 @@ class _MarkingPapersState extends ConsumerState e.isFinish = true; } } + annotationTips = false; // ScaffoldMessenger.of(context).showSnackBar( // SnackBar( @@ -757,6 +762,39 @@ class _MarkingPapersState extends ConsumerState return ToastUtils.getFluttertoast(context: context, msg: '请先评分后提交再进入下一题'); } + print(annotationTips); + if (annotationTips && currentQuestion != null) { + // 改变批注未提交 需要提示 + var resFlag = await showDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return CupertinoAlertDialog( + title: quickText('未提交批注提示', size: 14.sp, color: Color.fromARGB(255, 53, 52, 52)), + content: SingleChildScrollView( + padding: EdgeInsets.only(top: 4.h), + child: RichText(text: TextSpan(text: '当前批注未提交切换试题将清空本次笔迹,是否继续?', style: TextStyle(color: Color.fromARGB(255, 58, 58, 58)))), + ), + actions: [ + CupertinoDialogAction( + child: Text("提交", style: TextStyle(color: Color.fromARGB(255, 58, 58, 58))), + onPressed: () => Navigator.of(context).pop(false), + ), + CupertinoDialogAction( + child: Text("继续"), + onPressed: () => Navigator.of(context).pop(true), + ), + ], + ); + }, + ); + + if (!resFlag!) { + // 提交批注 + return submitTestQuestions(context, currentQuestion!); + } + } + int detailId = theId ?? (isNext ? currentQuestion!.nextId : currentQuestion!.prevId); bool isReview = widget.isReview; @@ -1094,6 +1132,7 @@ class _MarkingPapersState extends ConsumerState // bool flagInputKeyboardGuidePage = await FastData.getInstance().getInputKeyboardGuidePage(); // 引导页标志 try { theRequesting = true; + RestClient client = await getClient(); MarkingTextQuestionTab? temTab; bool isNormal = !widget.exceptional; @@ -1102,8 +1141,6 @@ class _MarkingPapersState extends ConsumerState MarkingTextQuestionTab? oldCurrentTab = _currentTab; temTab = await getTabsData(tabQuestionNum: tabQuestionNum, resetting: resetting); // 切换tag 返回对应的tag - print('当前选中类型:${temTab.questionNum}'); - MarkingTextQuestionTabParams theParam = tabParams.setQuestionNum( tab: temTab, locaQuestionNum: oldCurrentTab?.questionNum, @@ -1130,6 +1167,7 @@ class _MarkingPapersState extends ConsumerState ref.read(doPaperBottomReviewMarksProvider.notifier).setState(ReviewMarksBottomBtnsEnum.DRAG); // 重置批阅痕迹 ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal([], [])); + currentQuestion = result.data; if (temTab != null) { result.data!.scoreInterval = temTab.scoreInterval ?? 1; @@ -1146,60 +1184,8 @@ class _MarkingPapersState extends ConsumerState imageScale = 1; imagePosition = Offset(0, 0); } - - /** */ - // int? thetypeNum = tabParams.type; - - // // || _currentTab?.total == 0 是因为第一次进入页面 total没有更新造成了total是0 - // if (tabQuestionNum != null || _currentTab?.total == 0) - // await getTabsData(updateCurrentTag: true); // 切换tag更新当前Tag数据 - - // currentQuestion?.scoreInterval = temTab.scoreInterval!; - // if (oldCurrentQuestion == null || - // (oldCurrentQuestion.markingUserDetailId != currentQuestion!.markingUserDetailId)) { - // if (theExamIndex == 0 || tabQuestionNum != null) { - // // 当前试题位置 条件意思代表:当批阅的试题大于等于当前任务并且题池中没有试题 或者 获取当前试题是否继续取题池中的试题(!tabParams.excessContinue) - // theExamIndex = (temTab.finishCount >= temTab.total && temTab.excessCount <= 0) || - // (!tabParams.excessContinue && currentQuestion!.isFinish) - // ? temTab.finishCount - // : temTab.finishCount + 1; // 当前试题的位置 - // } else if (thetypeNum != null) { - // thetypeNum == 0 ? ++theExamIndex : --theExamIndex; - // } - // } - // theExamIndex = currentQuestion?.currentIndex ?? 0; - - /**后端返回当前试题位置不需要前端再去计算位置了 不需要判断超量题和平均量了 */ - // currentQuestion!.setTotalCountAndCurrentIndex( - // temTab.isExcess - // ? (temTab.total > temTab.excessAvgCount ? temTab.total : temTab.excessAvgCount) - // : temTab.total, - // temTab.finishCount); // 设置下标 - - // currentQuestion?.totalCount = temTab.total; } - /** - toUpState(setState, () { - bool hasSub = currentQuestion!.subQuestionDetailList.isNotEmpty; - activeQuestIndex = 0; // 选中题号 - double fullScore; - double getScore; - if (hasSub) { - SubQuestions questions = currentQuestion!.subQuestionDetailList[activeQuestIndex]; - bool isFinish = questions.isFinish; - fullScore = questions.subQuestionScore; - getScore = isFinish ? questions.subQuestionGotScore! : 0; - } else { - fullScore = currentQuestion!.totalScore; - bool isFinish = currentQuestion!.isFinish; // 是否提交 - getScore = isFinish ? currentQuestion!.score! : 0; - } - questScore = getScore == 0 ? '' : getScore.toString(); // 打分值 - hasZeroPointFive = getScore >= fullScore || questScore.length > 1; // 是否是满分/是否已经包含小数 - - // inputKeyboardGuidePage = flagInputKeyboardGuidePage; // 引导页标志配置 - }, mounted);*/ bool hasSub = currentQuestion!.subQuestionDetailList.isNotEmpty; activeQuestIndex = 0; // 选中题号 double fullScore; @@ -1239,6 +1225,7 @@ class _MarkingPapersState extends ConsumerState } } + Future.delayed(Duration.zero, () => annotationTips = false); // getMarkingQuestionsErrorInfo return currentQuestion; } catch (e) { @@ -1935,6 +1922,10 @@ class _MarkingPapersState extends ConsumerState commentImageMap: data.commentImageUrlMap, testQuestionNumber: widget.markingUserId.toString() + '-' + data.questionNum, imageItems: data.studentAnswerList, + callAnnotationTips: () { + // 批注记录被更改 + annotationTips = true; + }, ), ),