no message
This commit is contained in:
parent
adc07a9346
commit
ad660bec11
|
|
@ -96,9 +96,9 @@ class MarkingTextQuestion extends Object {
|
||||||
@JsonKey(name: 'papersUrlStr')
|
@JsonKey(name: 'papersUrlStr')
|
||||||
List<String>? papersUrlStr;
|
List<String>? papersUrlStr;
|
||||||
|
|
||||||
// 批注图片 预提交集合
|
// // 批注图片 预提交集合
|
||||||
@JsonKey(name: 'commentImageUrlTodo')
|
// @JsonKey(name: 'commentImageUrlTodo')
|
||||||
List<String>? commentImageUrlTodo;
|
// List<String>? commentImageUrlTodo;
|
||||||
|
|
||||||
// 批注图片Map
|
// 批注图片Map
|
||||||
@JsonKey(name: 'commentImageUrlMap')
|
@JsonKey(name: 'commentImageUrlMap')
|
||||||
|
|
@ -115,8 +115,8 @@ class MarkingTextQuestion extends Object {
|
||||||
@JsonKey(name: 'historicalScorings')
|
@JsonKey(name: 'historicalScorings')
|
||||||
List<HistoricalScoring>? historicalScorings;
|
List<HistoricalScoring>? historicalScorings;
|
||||||
|
|
||||||
MarkingTextQuestion(this.id, this.totalScore, this.isFinish, this.subQuestionDetailList, this.isException,
|
MarkingTextQuestion(
|
||||||
this.questionNum, this.score, this.studentAnswerList,
|
this.id, this.totalScore, this.isFinish, this.subQuestionDetailList, this.isException, this.questionNum, this.score, this.studentAnswerList,
|
||||||
// this.questionIndex,
|
// this.questionIndex,
|
||||||
{required this.commentImageUrl,
|
{required this.commentImageUrl,
|
||||||
required this.lastOne,
|
required this.lastOne,
|
||||||
|
|
@ -130,7 +130,7 @@ class MarkingTextQuestion extends Object {
|
||||||
// this.totalCount = 0,
|
// this.totalCount = 0,
|
||||||
// this.currentIndex = 0,
|
// this.currentIndex = 0,
|
||||||
this.papersUrl = const [],
|
this.papersUrl = const [],
|
||||||
this.commentImageUrlTodo,
|
// this.commentImageUrlTodo,
|
||||||
this.commentImageUrlMap = const {}}) {
|
this.commentImageUrlMap = const {}}) {
|
||||||
score = isFinish ? score : null;
|
score = isFinish ? score : null;
|
||||||
completeRating = isFinish && score != null;
|
completeRating = isFinish && score != null;
|
||||||
|
|
@ -140,14 +140,20 @@ class MarkingTextQuestion extends Object {
|
||||||
commentImageUrlMap = Map();
|
commentImageUrlMap = Map();
|
||||||
|
|
||||||
if (commentImageUrl.isNotEmpty) {
|
if (commentImageUrl.isNotEmpty) {
|
||||||
for (var element in commentImageUrl) {
|
// for (var element in commentImageUrl) {
|
||||||
commentImageUrlMap[element] = '$element?${DateTime.now().millisecondsSinceEpoch}';
|
// commentImageUrlMap[element] = '$element?${DateTime.now().millisecondsSinceEpoch}';
|
||||||
|
// }
|
||||||
|
for (var i = 0; i < commentImageUrl.length; i++) {
|
||||||
|
var element = commentImageUrl[i];
|
||||||
|
var originalImage = studentAnswerList[i];
|
||||||
|
commentImageUrlMap[originalImage] = '$element?${DateTime.now().millisecondsSinceEpoch}';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var element in studentAnswerList) {
|
for (var element in studentAnswerList) {
|
||||||
commentImageUrlMap[element] = element;
|
commentImageUrlMap[element] = element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (historicalScore != null) {
|
// if (historicalScore != null) {
|
||||||
// this.historicalScorings = (jsonDecode(historicalScore!) as List<dynamic>).map((e) {
|
// this.historicalScorings = (jsonDecode(historicalScore!) as List<dynamic>).map((e) {
|
||||||
// return HistoricalScoring.fromJson(e as Map<String, dynamic>);
|
// return HistoricalScoring.fromJson(e as Map<String, dynamic>);
|
||||||
|
|
@ -165,10 +171,6 @@ class MarkingTextQuestion extends Object {
|
||||||
factory MarkingTextQuestion.fromJson(Map<String, dynamic> srcJson) => _$MarkingTextQuestionFromJson(srcJson);
|
factory MarkingTextQuestion.fromJson(Map<String, dynamic> srcJson) => _$MarkingTextQuestionFromJson(srcJson);
|
||||||
|
|
||||||
List<String> getImageData() {
|
List<String> getImageData() {
|
||||||
if (commentImageUrlTodo != null && commentImageUrlTodo!.isNotEmpty) {
|
|
||||||
return commentImageUrlTodo!;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commentImageUrl.isNotEmpty) {
|
if (commentImageUrl.isNotEmpty) {
|
||||||
return commentImageUrl;
|
return commentImageUrl;
|
||||||
}
|
}
|
||||||
|
|
@ -178,10 +180,8 @@ class MarkingTextQuestion extends Object {
|
||||||
|
|
||||||
bool setImageList(String resImage, int imageIndex) {
|
bool setImageList(String resImage, int imageIndex) {
|
||||||
try {
|
try {
|
||||||
commentImageUrlTodo ??= getImageData().map((e) => e).toList();
|
|
||||||
String oldImage = studentAnswerList[imageIndex];
|
String oldImage = studentAnswerList[imageIndex];
|
||||||
commentImageUrlMap[oldImage] = '$resImage?${DateTime.now().millisecondsSinceEpoch}';
|
commentImageUrlMap[oldImage] = '$resImage?${DateTime.now().millisecondsSinceEpoch}';
|
||||||
commentImageUrlTodo![imageIndex] = resImage;
|
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -220,11 +220,7 @@ class SubQuestions extends Object {
|
||||||
bool completeRating;
|
bool completeRating;
|
||||||
|
|
||||||
SubQuestions(
|
SubQuestions(
|
||||||
{required this.subQuestionScore,
|
{required this.subQuestionScore, required this.subQuestionNum, this.subQuestionGotScore, required this.isFinish, this.completeRating = false}) {
|
||||||
required this.subQuestionNum,
|
|
||||||
this.subQuestionGotScore,
|
|
||||||
required this.isFinish,
|
|
||||||
this.completeRating = false}) {
|
|
||||||
subQuestionGotScore = isFinish ? subQuestionGotScore : null;
|
subQuestionGotScore = isFinish ? subQuestionGotScore : null;
|
||||||
completeRating = isFinish && subQuestionGotScore != null;
|
completeRating = isFinish && subQuestionGotScore != null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import 'package:marking_app/common/model/job/upload_file_interface_config_params
|
||||||
import 'package:marking_app/common/model/marking/annotation_graffiti_switch.dart';
|
import 'package:marking_app/common/model/marking/annotation_graffiti_switch.dart';
|
||||||
import 'package:marking_app/common/model/marking/do_marking_keyboard_model.dart';
|
import 'package:marking_app/common/model/marking/do_marking_keyboard_model.dart';
|
||||||
import 'package:marking_app/common/model/marking/marking_history_zoom_info.dart';
|
import 'package:marking_app/common/model/marking/marking_history_zoom_info.dart';
|
||||||
|
import 'package:marking_app/common/model/marking/marking_text_question.dart';
|
||||||
import 'package:marking_app/common/model/marking/switch_keyboard_to_reload_images.dart';
|
import 'package:marking_app/common/model/marking/switch_keyboard_to_reload_images.dart';
|
||||||
import 'package:marking_app/pages/common/event_bus_mixin.dart';
|
import 'package:marking_app/pages/common/event_bus_mixin.dart';
|
||||||
import 'package:marking_app/pages/homework_correction/hooks/use_cached_img_refresh.dart';
|
import 'package:marking_app/pages/homework_correction/hooks/use_cached_img_refresh.dart';
|
||||||
|
|
@ -69,6 +70,7 @@ class PictureOverview extends StatefulHookConsumerWidget {
|
||||||
final bool annotationsFlag;
|
final bool annotationsFlag;
|
||||||
final String testQuestionNumber;
|
final String testQuestionNumber;
|
||||||
final Map<String, String> commentImageMap;
|
final Map<String, String> commentImageMap;
|
||||||
|
final MarkingTextQuestion data;
|
||||||
|
|
||||||
const PictureOverview({
|
const PictureOverview({
|
||||||
required this.imageItems,
|
required this.imageItems,
|
||||||
|
|
@ -77,6 +79,7 @@ class PictureOverview extends StatefulHookConsumerWidget {
|
||||||
required this.testQuestionNumber,
|
required this.testQuestionNumber,
|
||||||
required this.questionNum,
|
required this.questionNum,
|
||||||
required this.markingUserId,
|
required this.markingUserId,
|
||||||
|
required this.data,
|
||||||
this.homework = false,
|
this.homework = false,
|
||||||
this.imageScale = 1,
|
this.imageScale = 1,
|
||||||
this.imagePosition,
|
this.imagePosition,
|
||||||
|
|
@ -87,7 +90,7 @@ class PictureOverview extends StatefulHookConsumerWidget {
|
||||||
PictureOverviewState createState() => PictureOverviewState();
|
PictureOverviewState createState() => PictureOverviewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMixin {
|
class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMixin, EventBusMixin {
|
||||||
final GlobalKey theglobalKey = GlobalKey();
|
final GlobalKey theglobalKey = GlobalKey();
|
||||||
final GlobalKey<_ExamPaperDrawingState> examPaperDrawingKey = GlobalKey<_ExamPaperDrawingState>();
|
final GlobalKey<_ExamPaperDrawingState> examPaperDrawingKey = GlobalKey<_ExamPaperDrawingState>();
|
||||||
final GlobalKey zoomGlobalKey = GlobalKey(); // zoom
|
final GlobalKey zoomGlobalKey = GlobalKey(); // zoom
|
||||||
|
|
@ -132,11 +135,39 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
||||||
graffitiSwitch = state;
|
graffitiSwitch = state;
|
||||||
toUpState(setState, () {}, mounted);
|
toUpState(setState, () {}, mounted);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 事件总线监听 清空数据
|
||||||
|
eventOn(callback: (BottomAnnotationSwitchCleanallOfMarking item) async {
|
||||||
|
if (ref.read(drawMarkingProvider).data.isEmpty) {
|
||||||
|
if (widget.data.commentImageUrl.isNotEmpty) {
|
||||||
|
bool? res = await showDialog<bool>(
|
||||||
|
// 表示点击灰色背景的时候是否消失弹出框
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (context1) {
|
||||||
|
return AlertDialog(content: quickText("是否撤销上次批注痕迹"), actions: <Widget>[
|
||||||
|
TextButton(child: quickText("取消"), onPressed: () => Navigator.pop(context1, false)),
|
||||||
|
TextButton(child: quickText("确定", color: Theme.of(context).primaryColor), onPressed: () => Navigator.pop(context1, true))
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (res == true) {
|
||||||
|
widget.data.commentImageUrl.removeAt(currentIndex);
|
||||||
|
var theUrl = widget.imageItems[currentIndex];
|
||||||
|
widget.commentImageMap[theUrl] = theUrl;
|
||||||
|
toUpState(setState, () {}, mounted);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ToastUtils.showInfo('批注已清空');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_annotationsListener();
|
_annotationsListener();
|
||||||
|
eventCancel();
|
||||||
try {
|
try {
|
||||||
_imageStream?.removeListener(_imageStreamListener!);
|
_imageStream?.removeListener(_imageStreamListener!);
|
||||||
if (temFile != null) {
|
if (temFile != null) {
|
||||||
|
|
@ -156,9 +187,12 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
||||||
// 没有图片就上传图片
|
// 没有图片就上传图片
|
||||||
RenderRepaintBoundary? boundary = theglobalKey.currentContext!.findRenderObject() as RenderRepaintBoundary?;
|
RenderRepaintBoundary? boundary = theglobalKey.currentContext!.findRenderObject() as RenderRepaintBoundary?;
|
||||||
if (boundary == null) return null;
|
if (boundary == null) return null;
|
||||||
double dpr = MediaQuery.of(context).devicePixelRatio;
|
// double dpr = MediaQuery.of(context).devicePixelRatio;
|
||||||
// double dpr = ui.window.devicePixelRatio;
|
|
||||||
ui.Image image = await boundary.toImage(pixelRatio: dpr);
|
double pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
if (imagInfoModel?.pixelRatio != null) pixelRatio = imagInfoModel!.pixelRatio;
|
||||||
|
|
||||||
|
ui.Image image = await boundary.toImage(pixelRatio: pixelRatio);
|
||||||
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
ByteData? byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
||||||
if (byteData == null) {
|
if (byteData == null) {
|
||||||
/// 等于null 已经是异常了
|
/// 等于null 已经是异常了
|
||||||
|
|
@ -172,8 +206,11 @@ class PictureOverviewState extends ConsumerState<PictureOverview> with CommonMix
|
||||||
temFile = file;
|
temFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
|
if (imagInfoModel != null) {
|
||||||
|
// 剪切图片
|
||||||
|
}
|
||||||
|
|
||||||
|
crypto.Digest fileMd5 = crypto.md5.convert(await temFile!.readAsBytes());
|
||||||
RestClient _client = await getClient();
|
RestClient _client = await getClient();
|
||||||
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getUploadFile(UploadFileInterfaceConfigParams(
|
BaseStructureResult<UploadFileInterfaceConfig> resUploadConfig = await _client.getUploadFile(UploadFileInterfaceConfigParams(
|
||||||
fileName: '1.png',
|
fileName: '1.png',
|
||||||
|
|
@ -459,7 +496,6 @@ class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing> with EventB
|
||||||
eventOn(callback: (BottomAnnotationSwitchCleanallOfMarking item) {
|
eventOn(callback: (BottomAnnotationSwitchCleanallOfMarking item) {
|
||||||
if (item.previousStep) {
|
if (item.previousStep) {
|
||||||
if (ref.read(drawMarkingProvider).data.isEmpty) {
|
if (ref.read(drawMarkingProvider).data.isEmpty) {
|
||||||
ToastUtils.showInfo('批注已清空');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var index = pointsPureData.toList().lastIndexOf(null);
|
var index = pointsPureData.toList().lastIndexOf(null);
|
||||||
|
|
@ -508,7 +544,7 @@ class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing> with EventB
|
||||||
isComplex: true,
|
isComplex: true,
|
||||||
willChange: true,
|
willChange: true,
|
||||||
foregroundPainter: DrawingPainter(ctrl: _vnHandWritings),
|
foregroundPainter: DrawingPainter(ctrl: _vnHandWritings),
|
||||||
child: RepaintBoundary(child: widget.child),
|
child: widget.child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import 'package:marking_app/common/model/common/base_structure_result.dart';
|
||||||
import 'package:marking_app/common/model/common/upload_img_secret_key.dart';
|
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/KeyboardType.dart';
|
||||||
import 'package:marking_app/common/model/enum/marking_list_type.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/marking/current_review_task.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/do_marking_keyboard_model.dart';
|
||||||
import 'package:marking_app/common/model/marking/keyboard_assist_event.dart';
|
import 'package:marking_app/common/model/marking/keyboard_assist_event.dart';
|
||||||
|
|
@ -52,6 +53,8 @@ import 'package:marking_app/components/marking/review_records_view.dart';
|
||||||
import 'package:marking_app/components/marking/selectable_keyboard_bottom.dart';
|
import 'package:marking_app/components/marking/selectable_keyboard_bottom.dart';
|
||||||
import 'package:marking_app/pages/common/event_bus_mixin.dart';
|
import 'package:marking_app/pages/common/event_bus_mixin.dart';
|
||||||
import 'package:marking_app/pages/marking/hooks/use_zoomImage_history_utils.dart';
|
import 'package:marking_app/pages/marking/hooks/use_zoomImage_history_utils.dart';
|
||||||
|
import 'package:marking_app/pages/marking/provider/do_paper_bottom_review_marks_provider.dart';
|
||||||
|
import 'package:marking_app/pages/marking/provider/draw_marking_provider.dart';
|
||||||
import 'package:marking_app/pages/marking/provider/rating_progress_provider.dart';
|
import 'package:marking_app/pages/marking/provider/rating_progress_provider.dart';
|
||||||
import 'package:marking_app/provider/annotation_graffiti_switch_provider.dart';
|
import 'package:marking_app/provider/annotation_graffiti_switch_provider.dart';
|
||||||
import 'package:marking_app/provider/do_marking_provider.dart';
|
import 'package:marking_app/provider/do_marking_provider.dart';
|
||||||
|
|
@ -158,6 +161,10 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
|
||||||
fToast.init(context);
|
fToast.init(context);
|
||||||
Future.delayed(const Duration(seconds: 0)).then((onValue) {
|
Future.delayed(const Duration(seconds: 0)).then((onValue) {
|
||||||
ref.read(annotationGraffitiSwitchProvider.notifier).init();
|
ref.read(annotationGraffitiSwitchProvider.notifier).init();
|
||||||
|
// 重置批阅痕迹
|
||||||
|
ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal([], []));
|
||||||
|
// 重置批阅动作按钮
|
||||||
|
ref.read(doPaperBottomReviewMarksProvider.notifier).setState(ReviewMarksBottomBtnsEnum.DRAG);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 批注监听
|
// 批注监听
|
||||||
|
|
@ -460,15 +467,10 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
|
||||||
|
|
||||||
RestClient client = await getClient();
|
RestClient client = await getClient();
|
||||||
String? commentImageUrlStr;
|
String? commentImageUrlStr;
|
||||||
List<String>? commentImageUrl = currentQuestion?.commentImageUrlTodo;
|
List<String>? commentImageUrl =
|
||||||
if (commentImageUrl?.isEmpty ?? true) commentImageUrl = currentQuestion?.commentImageUrl;
|
(currentQuestion?.commentImageUrl.isNotEmpty ?? false) || res?.url != null ? currentQuestion?.commentImageUrlMap.values.toList() : null;
|
||||||
if (commentImageUrl?.isNotEmpty ?? false) commentImageUrlStr = jsonEncode(commentImageUrl);
|
if (commentImageUrl?.isNotEmpty ?? false) commentImageUrlStr = jsonEncode(commentImageUrl);
|
||||||
|
|
||||||
// bool excessContinue =
|
|
||||||
// _currentTab?.agreementExcess == null ? true : _currentTab!.agreementExcess!; // 如果没有询问默认为true 如果询问了 就已询问为主
|
|
||||||
bool isExit = false;
|
|
||||||
MarkingTextQuestionTab? nextTag;
|
|
||||||
|
|
||||||
BaseStructureResult<bool> result = await client.submitTestQuestionsOfExam(SubmitExamParams(
|
BaseStructureResult<bool> result = await client.submitTestQuestionsOfExam(SubmitExamParams(
|
||||||
widget.markingUserId,
|
widget.markingUserId,
|
||||||
detailId,
|
detailId,
|
||||||
|
|
@ -1124,6 +1126,10 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
|
||||||
setTimeOut(300, () => ToastUtils.showError('请求错诶,请重试'));
|
setTimeOut(300, () => ToastUtils.showError('请求错诶,请重试'));
|
||||||
throw Error();
|
throw Error();
|
||||||
}
|
}
|
||||||
|
// 重置批阅动作
|
||||||
|
ref.read(doPaperBottomReviewMarksProvider.notifier).setState(ReviewMarksBottomBtnsEnum.DRAG);
|
||||||
|
// 重置批阅痕迹
|
||||||
|
ref.read(drawMarkingProvider.notifier).setState(DrawMarkingVal([], []));
|
||||||
currentQuestion = result.data;
|
currentQuestion = result.data;
|
||||||
if (temTab != null) {
|
if (temTab != null) {
|
||||||
result.data!.scoreInterval = temTab.scoreInterval ?? 1;
|
result.data!.scoreInterval = temTab.scoreInterval ?? 1;
|
||||||
|
|
@ -1919,6 +1925,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
|
||||||
// margin: EdgeInsets.only(top: 6.h),
|
// margin: EdgeInsets.only(top: 6.h),
|
||||||
padding: EdgeInsets.symmetric(horizontal: 1.w),
|
padding: EdgeInsets.symmetric(horizontal: 1.w),
|
||||||
child: PictureOverview(
|
child: PictureOverview(
|
||||||
|
data: data,
|
||||||
questionNum: data.questionNum,
|
questionNum: data.questionNum,
|
||||||
markingUserId: widget.markingUserId,
|
markingUserId: widget.markingUserId,
|
||||||
key: pictureOverviewKey,
|
key: pictureOverviewKey,
|
||||||
|
|
@ -1927,7 +1934,7 @@ class _MarkingPapersState extends ConsumerState<DoPapers>
|
||||||
annotationsFlag: annotationSwitch,
|
annotationsFlag: annotationSwitch,
|
||||||
commentImageMap: data.commentImageUrlMap,
|
commentImageMap: data.commentImageUrlMap,
|
||||||
testQuestionNumber: widget.markingUserId.toString() + '-' + data.questionNum,
|
testQuestionNumber: widget.markingUserId.toString() + '-' + data.questionNum,
|
||||||
imageItems: data.getImageData(),
|
imageItems: data.studentAnswerList,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue