From ecfb2c33b65376275b22890ec4f2c6ea299f13d0 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Fri, 12 Apr 2024 12:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=AD=A4=E6=AC=A1=E6=89=B9?= =?UTF-8?q?=E9=98=85=E4=BC=98=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../homework_correction/do_papers_job.dart | 33 +++++++++++-------- .../use_switch_student_and_type.dart | 21 ++++++++++-- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index bab1ac1..999669b 100644 --- a/.gitignore +++ b/.gitignore @@ -214,3 +214,4 @@ marking_app/lib/pages/homework_correction/job_personal_detail.g.dart marking_app/lib/common/model/event_bus/jobs/job_do_papers_submit_check_switch_bus.g.dart marking_app/lib/common/model/event_bus/jobs/job_do_synchro_tab.g.dart marking_app/lib/pages/homework_correction/widget/top_count.g.dart +marking_app/lib/pages/homework_correction/job_knowledge_points.g.dart diff --git a/marking_app/lib/pages/homework_correction/do_papers_job.dart b/marking_app/lib/pages/homework_correction/do_papers_job.dart index 6353e57..60a4136 100644 --- a/marking_app/lib/pages/homework_correction/do_papers_job.dart +++ b/marking_app/lib/pages/homework_correction/do_papers_job.dart @@ -290,19 +290,24 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func var _currentTab = _useSwitchStudentAndType.currentTab.value; var _pageIndex = _currentTab?.pageIndex; if (_currentTab == null || _pageIndex == null) return; - var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex); - if (_currentTab.finishCount + 1 == _currentTab.total) { - var _currentTabNew = - _useSwitchStudentAndType.tabs.value.firstWhereOrNull((e) => e.pageIndex != _currentTab.pageIndex && e.finishCount != e.total); - // 如果全部都已经批阅完成就不需要跳转到不必要得批阅试题 - if (_currentTabNew != null) params.pageIndex = _currentTabNew.pageIndex; - } - var _theCurrentPage = _useSwitchStudentAndType.tabs.value.firstWhereOrNull((element) => element.pageIndex == _pageIndex); - if (_theCurrentPage != null) { - _theCurrentPage.finishCount += 1; - _useSwitchStudentAndType.tabs.value = _useSwitchStudentAndType.tabs.value.map((e) => JobPageTab.fromJson(e.toJson())).toList(); - } - _useSwitchStudentAndType.eventFire(model: params); + _useSwitchStudentAndType.refreshQuestionTypeData(context, taskId: taskId, exitCallback: exitCallback, getNewData: false).then((value) { + var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex); + if (_currentTab.finishCount < _currentTab.total) { + if (_currentTab.finishCount + 1 == _currentTab.total) { + var _currentTabNew = + _useSwitchStudentAndType.tabs.value.firstWhereOrNull((e) => e.pageIndex != _currentTab.pageIndex && e.finishCount != e.total); + // 如果全部都已经批阅完成就不需要跳转到不必要得批阅试题 + if (_currentTabNew != null) params.pageIndex = _currentTabNew.pageIndex; + } + var _theCurrentPage = _useSwitchStudentAndType.tabs.value.firstWhereOrNull((element) => element.pageIndex == _pageIndex); + if (_theCurrentPage != null) { + _theCurrentPage.finishCount += 1; + _useSwitchStudentAndType.tabs.value = _useSwitchStudentAndType.tabs.value.map((e) => JobPageTab.fromJson(e.toJson())).toList(); + } + } + + _useSwitchStudentAndType.eventFire(model: params); + }); break; default: } @@ -396,7 +401,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func ), Expanded(flex: 1, child: SizedBox()), Expanded( - flex: 4, + flex: isPad() ? 4 : 5, child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, diff --git a/marking_app/lib/pages/homework_correction/hooks/do_papers_job/use_switch_student_and_type.dart b/marking_app/lib/pages/homework_correction/hooks/do_papers_job/use_switch_student_and_type.dart index e7a210d..392b01f 100644 --- a/marking_app/lib/pages/homework_correction/hooks/do_papers_job/use_switch_student_and_type.dart +++ b/marking_app/lib/pages/homework_correction/hooks/do_papers_job/use_switch_student_and_type.dart @@ -99,8 +99,12 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin { } /// 属性tab类型数据 - Future refreshQuestionTypeData(BuildContext context, {required int taskId, required Function() exitCallback}) async { - List? tabDatas = await getDataForTestpaper(taskId: taskId, synchronization: false); + Future refreshQuestionTypeData(BuildContext context, + {required int taskId, required Function() exitCallback, bool getNewData = true}) async { + List? tabDatas = tabs.value; + if (getNewData) { + tabDatas = await getDataForTestpaper(taskId: taskId, synchronization: false); + } if (tabDatas?.isNotEmpty ?? false) { JobPageTab? tabJob = tabDatas!.firstWhereOrNull((e) => e.finishCount < e.total); if (tabJob == null && !exitPromptFlag.value) { @@ -124,9 +128,20 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin { exitCallback(); } else { // 跳转到对于位置 + if (!getNewData) return tabJob; tabs.value = tabDatas; if (tabJob != null) currentTab.value = tabJob; - if (tabJob == null && exitPromptFlag.value) ToastUtils.showSuccess('最后一题提交成功'); + if (tabJob == null && exitPromptFlag.value) { + var _thePageIndex = currentTab.value?.pageIndex; + if (_thePageIndex != null) { + var _theIndex = tabDatas.indexWhere((e) => e.pageIndex == _thePageIndex); + if (_theIndex != -1 && _theIndex < tabDatas.length - 1) { + currentTab.value = tabDatas[_theIndex + 1]; + return tabJob; + } + } + ToastUtils.showSuccess('最后一题提交成功'); + } return tabJob; } }