From 1104862e846de4048a331ebc366df359aaddfc79 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Thu, 13 Jun 2024 09:29:40 +0800 Subject: [PATCH] no message --- .../lib/common/model/enum/KeyboardType.dart | 12 +- .../marking/do_marking_keyboard_model.dart | 4 + .../model/marking/marking_text_question.dart | 23 +++ .../marking/marking_keyboard_switch.dart | 10 ++ .../components/marking/marking_seting.dart | 135 ++++++++++-------- 5 files changed, 121 insertions(+), 63 deletions(-) diff --git a/marking_app/lib/common/model/enum/KeyboardType.dart b/marking_app/lib/common/model/enum/KeyboardType.dart index 440a658..65558fb 100644 --- a/marking_app/lib/common/model/enum/KeyboardType.dart +++ b/marking_app/lib/common/model/enum/KeyboardType.dart @@ -2,7 +2,8 @@ enum KeyboardType { INPUT_TYPE, // 输入型 RIGHT_SELECTION, // 右侧选择型 - BOTTOM_SELECTION // 底部选择型 + BOTTOM_SELECTION, // 底部选择型 + CLICK_TO_RATE_AND_REVIEW, // 点击打分批阅 } // 键盘排序规则 @@ -17,3 +18,12 @@ enum ScreenDirection { HORIZONTAL_SCREEN, // 横屏 VERTICAL_SCREEN // 竖屏 } + +// 点击打分打分方式 +enum ClickOnScoringMethod { + INCREMENTAL(title: '点击递增'), + DECREASING(title: '点击递减'); + + const ClickOnScoringMethod({required this.title}); + final String title; +} diff --git a/marking_app/lib/common/model/marking/do_marking_keyboard_model.dart b/marking_app/lib/common/model/marking/do_marking_keyboard_model.dart index 679f801..9e16eab 100644 --- a/marking_app/lib/common/model/marking/do_marking_keyboard_model.dart +++ b/marking_app/lib/common/model/marking/do_marking_keyboard_model.dart @@ -166,6 +166,10 @@ class DoMarkingKeyboardModel extends Object { @JsonKey(name: 'commonScores', includeIfNull: false) MarkingCommonScoreItems? commonScores; + // 常用打分项 + @JsonKey(name: 'clickOnScoringMethod', includeIfNull: false) + ClickOnScoringMethod? clickOnScoringMethod; + // 默认输入型键盘 DoMarkingKeyboardModel({ this.hideQuestionId = false, diff --git a/marking_app/lib/common/model/marking/marking_text_question.dart b/marking_app/lib/common/model/marking/marking_text_question.dart index 150381e..9df2223 100644 --- a/marking_app/lib/common/model/marking/marking_text_question.dart +++ b/marking_app/lib/common/model/marking/marking_text_question.dart @@ -44,6 +44,10 @@ class MarkingTextQuestion extends Object { @JsonKey(name: 'subQuestionDetailList') List subQuestionDetailList; + // 点击打分 打分位置 + @JsonKey(name: 'scorePosition') + List scorePosition; + // 当前试题位置 // @JsonKey(name: 'questionIndex') // int questionIndex; @@ -127,6 +131,7 @@ class MarkingTextQuestion extends Object { this.scoreInterval = 1, this.markingProgress, this.completeRating = false, + this.scorePosition = const [], this.originalPaperAbsoluteUrl = const [], // this.totalCount = 0, // this.currentIndex = 0, @@ -290,3 +295,21 @@ class ExceptionInfo extends Object { Map toJson() => _$ExceptionInfoToJson(this); } + +@JsonSerializable() +class ScorePositionModel extends Object { + @JsonKey(name: 'position') + List position; + + @JsonKey(name: 'questionNum') + String questionNum; + + @JsonKey(name: 'subQuestionNum') + String? subQuestionNum; + + ScorePositionModel({required this.position, required this.questionNum, this.subQuestionNum}); + + factory ScorePositionModel.fromJson(Map srcJson) => _$ScorePositionModelFromJson(srcJson); + + Map toJson() => _$ScorePositionModelToJson(this); +} diff --git a/marking_app/lib/components/marking/marking_keyboard_switch.dart b/marking_app/lib/components/marking/marking_keyboard_switch.dart index 6bfc09b..0a33735 100644 --- a/marking_app/lib/components/marking/marking_keyboard_switch.dart +++ b/marking_app/lib/components/marking/marking_keyboard_switch.dart @@ -56,6 +56,16 @@ class MarkingKeyboardSwitch extends ConsumerWidget { submitCall: submitCall, synchroScore: synchroScore, ); + case KeyboardType.CLICK_TO_RATE_AND_REVIEW: + return SelectableKeyboard( + data: data, + markingUserId: markingUserId, + subtopicIndex: subtopicIndex, + questScore: questScore, + totalScore: data.totalScore, + submitCall: submitCall, + synchroScore: synchroScore, + ); case KeyboardType.BOTTOM_SELECTION: return const SizedBox(); } diff --git a/marking_app/lib/components/marking/marking_seting.dart b/marking_app/lib/components/marking/marking_seting.dart index 8d41be5..abdd5de 100644 --- a/marking_app/lib/components/marking/marking_seting.dart +++ b/marking_app/lib/components/marking/marking_seting.dart @@ -50,6 +50,7 @@ class _MarkingSetingState extends ConsumerState { late double scoreInterval; // 分值间隔设置 late int keyboardIndex; // 键盘下标 late bool autoSubmitToNextQuestion; // 提交并自动跳转下一题 + ClickOnScoringMethod? _clickOnScoringMethod; //点击打分计分方式 late RemoveListener _markingKeyboardListener; MarkingCommonScoreItems? _commonScoreItems; @override @@ -57,17 +58,15 @@ class _MarkingSetingState extends ConsumerState { // 当前 _markingKeyboardListener = ref.read(markingKeyboardProvider.notifier).addListener((state) { MarkingCommonScoreItems? theCommonScores = state.commonScores; - if (theCommonScores != null && - widget.questionNum == theCommonScores.questionNum && - widget.markingUserId == theCommonScores.id) { + if (theCommonScores != null && widget.questionNum == theCommonScores.questionNum && widget.markingUserId == theCommonScores.id) { _commonScoreItems = state.commonScores; } keyboardModel = state; keyboardIndex = state.keyboard.index; sortType = state.sort; autoSubmitToNextQuestion = state.autoSubmitToNextQuestion; - scoreInterval = state.getScoreStepSize( - widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); // 或者对应试卷和试题的步长 + _clickOnScoringMethod = state.clickOnScoringMethod; + scoreInterval = state.getScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval); // 或者对应试卷和试题的步长 isHorizontal = state.screenDirection == ScreenDirection.HORIZONTAL_SCREEN; keyboardTypes = KeyboardType.values.map((e) { @@ -112,54 +111,19 @@ class _MarkingSetingState extends ConsumerState { case KeyboardType.RIGHT_SELECTION: case KeyboardType.BOTTOM_SELECTION: // 底部键盘和右侧键盘 - model.setScoreStepSize( - widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); // 设置分值 + model.setScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); // 设置分值 model.sort = sortType; break; + case KeyboardType.CLICK_TO_RATE_AND_REVIEW: + // 点击打分 (打分步长、计分方式) + model.clickOnScoringMethod = _clickOnScoringMethod; + break; } model.screenDirection = keyboardModel.screenDirection; model.autoSubmitToNextQuestion = autoSubmitToNextQuestion; if (_commonScoreItems != null) model.commonScores = _commonScoreItems!.score.isNotEmpty ? _commonScoreItems : null; ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model); setTimeOut(300, () => widget.close(true)); - - /// 取消保存数据确认按钮 - // showDialog( - // // 表示点击灰色背景的时候是否消失弹出框 - // barrierDismissible: false, - // context: context, - // builder: (context1) { - // return AlertDialog(content: quickText("请确定当前阅卷习惯配置?"), actions: [ - // TextButton( - // child: quickText("取消"), - // onPressed: () { - // Navigator.pop(context1, 'Cancle'); - // }, - // ), - // TextButton( - // child: quickText("确定", color: Theme.of(context).primaryColor), - // onPressed: () { - // TheDoMarkingKeyboardModel theCurrent = keyboardTypes[keyboardIndex]; // 当前选中的键盘 - // DoMarkingKeyboardModel model = theCurrent.model; - // switch (model.keyboard) { - // case KeyboardType.INPUT_TYPE: - // // 输入型键盘 - // break; - // case KeyboardType.RIGHT_SELECTION: - // case KeyboardType.BOTTOM_SELECTION: - // // 底部键盘和右侧键盘 - // model.setScoreStepSize(widget.markingUserId, widget.questionNum, widget.defaultScoreInterval, scoreInterval); // 设置分值 - // model.sort = sortType; - // break; - // } - // model.screenDirection = keyboardModel.screenDirection; - // model.autoSubmitToNextQuestion = autoSubmitToNextQuestion; - // ref.read(markingKeyboardProvider.notifier).toggleKeyboard(model); - // Navigator.pop(context1, 'Cancle'); - // setTimeOut(300, () => widget.close(true)); - // }) - // ]); - // }); } @override @@ -191,9 +155,9 @@ class _MarkingSetingState extends ConsumerState { // crossAxisAlignment: CrossAxisAlignment.start, children: [ getKeyboardBox(), - getAutoNextQuestBox(), - getScoreIntervalSetBox(), - if (keyboardIndex != 0) + if (keyboardIndex != KeyboardType.CLICK_TO_RATE_AND_REVIEW.index) getAutoNextQuestBox(), // 自动提交 点击打分不能自动提交 + getScoreIntervalSetBox(), // 分值间隔 + if (![0, KeyboardType.CLICK_TO_RATE_AND_REVIEW.index].contains(keyboardIndex)) $CommonScoringList( score: widget.questTotalScore!, scoreInterval: scoreInterval, @@ -208,6 +172,10 @@ class _MarkingSetingState extends ConsumerState { }, ), getSetScoringRulesBox(), + $ClickOnScoringMethod(keyboardTypes[keyboardIndex].model.keyboard, _clickOnScoringMethod, (ClickOnScoringMethod mode) { + _clickOnScoringMethod = mode; + toUpState(setState, () {}, mounted); + }), ], ), ), @@ -323,7 +291,7 @@ class _MarkingSetingState extends ConsumerState { // 给分规则区域 Widget getSetScoringRulesBox() { - if (keyboardTypes[keyboardIndex].model.keyboard == KeyboardType.INPUT_TYPE) { + if ([KeyboardType.INPUT_TYPE, KeyboardType.CLICK_TO_RATE_AND_REVIEW].contains(keyboardTypes[keyboardIndex].model.keyboard)) { return Container(); } @@ -342,9 +310,7 @@ class _MarkingSetingState extends ConsumerState { fontWeight: FontWeight.bold, ), Wrap( - children: SortKeyboard.values - .where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER) - .map((e) { + children: SortKeyboard.values.where((element) => element != SortKeyboard.FULL_AND_AERO_TOP_INVERTED_ORDER).map((e) { String title; switch (e) { case SortKeyboard.INVERTED_ORDER: @@ -399,7 +365,7 @@ class _MarkingSetingState extends ConsumerState { // 分值间隔设置 Widget getScoreIntervalSetBox() { - if (keyboardTypes[keyboardIndex].model.keyboard == KeyboardType.INPUT_TYPE) { + if ([KeyboardType.INPUT_TYPE].contains(keyboardTypes[keyboardIndex].model.keyboard)) { return Container(); } @@ -413,8 +379,7 @@ class _MarkingSetingState extends ConsumerState { children: [ InkWell( onTap: () { - AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor) - .show(context); + AchievementView(title: "分值间隔", subTitle: "设定当前题目的分数按钮的间隔分值", color: Theme.of(context).primaryColor).show(context); }, child: Row( children: [ @@ -507,8 +472,6 @@ class _MarkingSetingState extends ConsumerState { ), ); } - - void _showPopover(BuildContext context) {} } class TheDoMarkingKeyboardModel { @@ -527,6 +490,9 @@ class TheDoMarkingKeyboardModel { case KeyboardType.BOTTOM_SELECTION: title = '底部选择型键盘'; break; + case KeyboardType.CLICK_TO_RATE_AND_REVIEW: + title = '点击打分'; + break; } } } @@ -551,8 +517,7 @@ Widget $commonScoringList(BuildContext context, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - child: - quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold), + child: quickText('常用打分项', size: 14.sp, color: const Color.fromRGBO(45, 56, 76, 1), fontWeight: FontWeight.bold), ), SizedBox(height: 10.h), Expanded( @@ -579,9 +544,7 @@ Widget $commonScoringList(BuildContext context, decoration: BoxDecoration( border: Border.all( width: 1.h, - color: isSelected - ? Theme.of(context).primaryColor.withOpacity(0.5) - : const Color.fromRGBO(224, 230, 255, 1), + color: isSelected ? Theme.of(context).primaryColor.withOpacity(0.5) : const Color.fromRGBO(224, 230, 255, 1), ), color: isSelected ? Colors.white : Colors.grey[300], borderRadius: BorderRadius.all(Radius.circular(2.w)), @@ -600,3 +563,51 @@ Widget $commonScoringList(BuildContext context, ), ); } + +// 点击打分打分方式 +@swidget +Widget $clickOnScoringMethod( + BuildContext context, KeyboardType keyboard, ClickOnScoringMethod? clickOnScoringMethod, Function(ClickOnScoringMethod) call) { + if (keyboard != KeyboardType.CLICK_TO_RATE_AND_REVIEW) return SizedBox(); + + List modes = ClickOnScoringMethod.values; + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 50.h), + quickText( + '计分方式', + size: 14.sp, + fontWeight: FontWeight.bold, + color: const Color.fromRGBO(45, 56, 76, 1), + ), + SizedBox(height: 12.h), + Row( + mainAxisSize: MainAxisSize.min, + children: modes.map((e) { + return InkWell( + onTap: () => call(e), + child: Container( + margin: EdgeInsets.only(right: 20.w), + padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 4.h), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(4.r), boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.2), + offset: Offset(1, 1), // 阴影与容器的距离 + blurRadius: 6.r, // 高斯的标准偏差与盒子的形状卷积。 + spreadRadius: 1.r, + ), + ]), + child: quickText( + e.title, + size: 14.sp, + color: clickOnScoringMethod == e ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 87, 103, 1), + ), + ), + ); + }).toList(), + ) + ], + ); +}