diff --git a/.gitignore b/.gitignore index eb137e1..16f39b3 100644 --- a/.gitignore +++ b/.gitignore @@ -218,3 +218,9 @@ marking_app/lib/common/model/event_bus/job_home_refresh_bus.g.dart marking_app/lib/common/model/job/job_knowledge_points_detail.g.dart marking_app/lib/common/model/job/job_knowledge_points.g.dart marking_app/lib/pages/homework_correction/job_knowledge_points.g.dart +marking_app/lib/pages/homework_correction/job_knowledge_points_detail.g.dart +marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart +marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart +marking_app/lib/pages/homework_correction/job_home.g.dart +marking_app/lib/common/model/marking/keyboard_assist_event.g.dart +marking_app/lib/common/model/marking/marking_history_zoom_info.g.dart diff --git a/marking_app/assets/images/2.0x/job_home_answer_record.png b/marking_app/assets/images/2.0x/job_home_answer_record.png new file mode 100644 index 0000000..06b07c3 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_answer_record.png differ diff --git a/marking_app/assets/images/2.0x/job_home_history.png b/marking_app/assets/images/2.0x/job_home_history.png new file mode 100644 index 0000000..63f66d3 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_history.png differ diff --git a/marking_app/assets/images/2.0x/job_home_knowledge.png b/marking_app/assets/images/2.0x/job_home_knowledge.png new file mode 100644 index 0000000..8b6fda0 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_knowledge.png differ diff --git a/marking_app/assets/images/2.0x/job_home_marking.png b/marking_app/assets/images/2.0x/job_home_marking.png new file mode 100644 index 0000000..4c51ed0 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_marking.png differ diff --git a/marking_app/assets/images/2.0x/job_home_marking_set.png b/marking_app/assets/images/2.0x/job_home_marking_set.png new file mode 100644 index 0000000..bcdc6d3 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_marking_set.png differ diff --git a/marking_app/assets/images/2.0x/job_home_top_bgm.png b/marking_app/assets/images/2.0x/job_home_top_bgm.png new file mode 100644 index 0000000..6983041 Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/2.0x/job_home_youxian.png b/marking_app/assets/images/2.0x/job_home_youxian.png new file mode 100644 index 0000000..69ffdeb Binary files /dev/null and b/marking_app/assets/images/2.0x/job_home_youxian.png differ diff --git a/marking_app/assets/images/3.0x/job_home_answer_record.png b/marking_app/assets/images/3.0x/job_home_answer_record.png new file mode 100644 index 0000000..b6c192a Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_answer_record.png differ diff --git a/marking_app/assets/images/3.0x/job_home_history.png b/marking_app/assets/images/3.0x/job_home_history.png new file mode 100644 index 0000000..4df1334 Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_history.png differ diff --git a/marking_app/assets/images/3.0x/job_home_knowledge.png b/marking_app/assets/images/3.0x/job_home_knowledge.png new file mode 100644 index 0000000..b6aebd4 Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_knowledge.png differ diff --git a/marking_app/assets/images/3.0x/job_home_marking.png b/marking_app/assets/images/3.0x/job_home_marking.png new file mode 100644 index 0000000..15baf5f Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_marking.png differ diff --git a/marking_app/assets/images/3.0x/job_home_marking_set.png b/marking_app/assets/images/3.0x/job_home_marking_set.png new file mode 100644 index 0000000..8eea382 Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_marking_set.png differ diff --git a/marking_app/assets/images/3.0x/job_home_top_bgm.png b/marking_app/assets/images/3.0x/job_home_top_bgm.png new file mode 100644 index 0000000..7a62344 Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/3.0x/job_home_youxian.png b/marking_app/assets/images/3.0x/job_home_youxian.png new file mode 100644 index 0000000..956d7ef Binary files /dev/null and b/marking_app/assets/images/3.0x/job_home_youxian.png differ diff --git a/marking_app/assets/images/4.0x/job_home_answer_record.png b/marking_app/assets/images/4.0x/job_home_answer_record.png new file mode 100644 index 0000000..25d26b9 Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_answer_record.png differ diff --git a/marking_app/assets/images/4.0x/job_home_history.png b/marking_app/assets/images/4.0x/job_home_history.png new file mode 100644 index 0000000..d03f369 Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_history.png differ diff --git a/marking_app/assets/images/4.0x/job_home_knowledge.png b/marking_app/assets/images/4.0x/job_home_knowledge.png new file mode 100644 index 0000000..28ead35 Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_knowledge.png differ diff --git a/marking_app/assets/images/4.0x/job_home_marking.png b/marking_app/assets/images/4.0x/job_home_marking.png new file mode 100644 index 0000000..1fa6449 Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_marking.png differ diff --git a/marking_app/assets/images/4.0x/job_home_marking_set.png b/marking_app/assets/images/4.0x/job_home_marking_set.png new file mode 100644 index 0000000..2b509cd Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_marking_set.png differ diff --git a/marking_app/assets/images/4.0x/job_home_top_bgm.png b/marking_app/assets/images/4.0x/job_home_top_bgm.png new file mode 100644 index 0000000..11513dc Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/4.0x/job_home_youxian.png b/marking_app/assets/images/4.0x/job_home_youxian.png new file mode 100644 index 0000000..945a8cc Binary files /dev/null and b/marking_app/assets/images/4.0x/job_home_youxian.png differ diff --git a/marking_app/assets/images/job_home_answer_record.png b/marking_app/assets/images/job_home_answer_record.png new file mode 100644 index 0000000..21fd223 Binary files /dev/null and b/marking_app/assets/images/job_home_answer_record.png differ diff --git a/marking_app/assets/images/job_home_history.png b/marking_app/assets/images/job_home_history.png new file mode 100644 index 0000000..3e00774 Binary files /dev/null and b/marking_app/assets/images/job_home_history.png differ diff --git a/marking_app/assets/images/job_home_knowledge.png b/marking_app/assets/images/job_home_knowledge.png new file mode 100644 index 0000000..866ad4c Binary files /dev/null and b/marking_app/assets/images/job_home_knowledge.png differ diff --git a/marking_app/assets/images/job_home_marking.png b/marking_app/assets/images/job_home_marking.png new file mode 100644 index 0000000..81e0e6e Binary files /dev/null and b/marking_app/assets/images/job_home_marking.png differ diff --git a/marking_app/assets/images/job_home_marking_set.png b/marking_app/assets/images/job_home_marking_set.png new file mode 100644 index 0000000..3fd1ca0 Binary files /dev/null and b/marking_app/assets/images/job_home_marking_set.png differ diff --git a/marking_app/assets/images/job_home_top_bgm.png b/marking_app/assets/images/job_home_top_bgm.png new file mode 100644 index 0000000..2515c1e Binary files /dev/null and b/marking_app/assets/images/job_home_top_bgm.png differ diff --git a/marking_app/assets/images/job_home_youxian.png b/marking_app/assets/images/job_home_youxian.png new file mode 100644 index 0000000..4e37a46 Binary files /dev/null and b/marking_app/assets/images/job_home_youxian.png differ diff --git a/marking_app/ios/Runner.xcodeproj/project.pbxproj b/marking_app/ios/Runner.xcodeproj/project.pbxproj index f24b956..9662e40 100644 --- a/marking_app/ios/Runner.xcodeproj/project.pbxproj +++ b/marking_app/ios/Runner.xcodeproj/project.pbxproj @@ -352,7 +352,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = CYDU583KN6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -360,7 +360,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.102; + MARKETING_VERSION = 1.0.104; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -490,7 +490,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = CYDU583KN6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -498,7 +498,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.102; + MARKETING_VERSION = 1.0.104; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; @@ -520,7 +520,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 20; + CURRENT_PROJECT_VERSION = 21; DEVELOPMENT_TEAM = CYDU583KN6; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; @@ -528,7 +528,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.102; + MARKETING_VERSION = 1.0.104; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; diff --git a/marking_app/lib/common/model/event_bus/jobs/job_do_synchro_tab.dart b/marking_app/lib/common/model/event_bus/jobs/job_do_synchro_tab.dart index c08bc4f..5144183 100644 --- a/marking_app/lib/common/model/event_bus/jobs/job_do_synchro_tab.dart +++ b/marking_app/lib/common/model/event_bus/jobs/job_do_synchro_tab.dart @@ -1,3 +1,4 @@ +import 'package:collection/collection.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:marking_app/common/model/job/job_page_tab.dart'; @@ -14,14 +15,21 @@ class JobDoSynchroTab extends Object { Map toJson() => _$JobDoSynchroTabToJson(this); /// 当前tab下一个tab的pageIndex - int? getNextPageIndex([int? indexLocated]) { - if (indexLocated == null) return null; - return indexLocated == tabs.length - 1 ? null : tabs[indexLocated + 1].pageIndex; + int? getNextPageIndex([int? pageIndex]) { + if (pageIndex == null) return null; + var _index = tabs.indexWhere((e) => e.pageIndex == pageIndex); + if (_index == -1) return null; + + return _index == tabs.length - 1 ? null : tabs[_index + 1].pageIndex; } /// 当前tab上一个tab的pageIndex - int? getPreviousPageIndex([int? indexLocated]) { - if (indexLocated == null) return null; - return indexLocated == 0 ? null : tabs[indexLocated - 1].pageIndex; + int? getPreviousPageIndex([int? pageIndex]) { + if (pageIndex == null) return null; + var _index = tabs.indexWhere((e) => e.pageIndex == pageIndex); + if (_index == -1) return null; + pageIndex = _index == 0 ? null : tabs[_index - 1].pageIndex; + print('这是上一页的数据:${pageIndex}'); + return pageIndex; } } diff --git a/marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart b/marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart deleted file mode 100644 index 9a570b7..0000000 --- a/marking_app/lib/common/model/job/job_knowledge_detail_student.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'job_knowledge_detail_student.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -JobKnowledgeDetailStudent _$JobKnowledgeDetailStudentFromJson( - Map json) => - JobKnowledgeDetailStudent( - json['studentId'] as int, - json['studentName'] as String, - json['isAnswer'] as bool, - json['isCorrect'] as bool, - ); - -Map _$JobKnowledgeDetailStudentToJson( - JobKnowledgeDetailStudent instance) => - { - 'studentId': instance.studentId, - 'studentName': instance.studentName, - 'isAnswer': instance.isAnswer, - 'isCorrect': instance.isCorrect, - }; diff --git a/marking_app/lib/common/model/marking/keyboard_assist_event.g.dart b/marking_app/lib/common/model/marking/keyboard_assist_event.g.dart deleted file mode 100644 index 13cca58..0000000 --- a/marking_app/lib/common/model/marking/keyboard_assist_event.g.dart +++ /dev/null @@ -1,18 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'keyboard_assist_event.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -KeyboardAssistEvent _$KeyboardAssistEventFromJson(Map json) => - KeyboardAssistEvent( - openAuxiliary: json['openAuxiliary'] as bool? ?? false, - ); - -Map _$KeyboardAssistEventToJson( - KeyboardAssistEvent instance) => - { - 'openAuxiliary': instance.openAuxiliary, - }; diff --git a/marking_app/lib/common/model/marking/marking_history_zoom_info.g.dart b/marking_app/lib/common/model/marking/marking_history_zoom_info.g.dart deleted file mode 100644 index 07a8b6a..0000000 --- a/marking_app/lib/common/model/marking/marking_history_zoom_info.g.dart +++ /dev/null @@ -1,27 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'marking_history_zoom_info.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -MarkingHistoryZoomInfo _$MarkingHistoryZoomInfoFromJson( - Map json) => - MarkingHistoryZoomInfo( - markingUserId: json['markingUserId'] as int, - questionNum: json['questionNum'] as String, - scale: (json['scale'] as num).toDouble(), - positionY: (json['positionY'] as num).toDouble(), - positionX: (json['positionX'] as num).toDouble(), - ); - -Map _$MarkingHistoryZoomInfoToJson( - MarkingHistoryZoomInfo instance) => - { - 'markingUserId': instance.markingUserId, - 'questionNum': instance.questionNum, - 'scale': instance.scale, - 'positionY': instance.positionY, - 'positionX': instance.positionX, - }; 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 8199917..5710bcf 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, @@ -415,9 +420,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func 'DO_PAPERS_JOB_CONTINUE_TO_REVIEW', () { var _currentTabNew = _useSwitchStudentAndType.tabs.value.firstWhere((e) => e.finishCount < e.total); - _useSwitchStudentAndType.eventFire( - model: MarkingTextQuestionJobTabParamsBus(taskId, _currentTabNew.pageIndex), - ); + _useSwitchStudentAndType.eventFire(model: MarkingTextQuestionJobTabParamsBus(taskId, _currentTabNew.pageIndex)); }, ), child: quickText( @@ -468,41 +471,6 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func ), ], ), - // InkWell( - // onTap: () => easyThrottle( - // 'prioritize_homework_review', - // () => !_useSwitchStudentAndType.isFirst.value - // ? _useSwitchStudentAndType.jobPriorityReviewJoin(jobId) - // : _useSwitchStudentAndType.jobPriorityReviewCancel(jobId)), - // child: - // Row( - // crossAxisAlignment: CrossAxisAlignment.center, - // mainAxisAlignment: MainAxisAlignment.start, - // children: [ - // Stack( - // alignment: const FractionalOffset(0.52, 0.24), - // children: [ - // Icon( - // const IconData(0xe63d, fontFamily: "AlibabaIcon"), - // size: 12.sp, - // color: _useSwitchStudentAndType.isFirst.value - // ? Color.fromRGBO(76, 199, 147, 1) - // : Color.fromRGBO(164, 164, 164, 1), - // ), - // quickText('优先', size: 4.sp, color: Colors.white), - // ], - // ), - // SizedBox(width: 1.2.w), - // quickText( - // '优先批阅', - // size: 10.sp, - // color: _useSwitchStudentAndType.isFirst.value - // ? Color.fromRGBO(76, 199, 147, 1) - // : Color.fromRGBO(164, 164, 164, 1), - // ), - // ], - // ), - // ), ), ], ), @@ -541,7 +509,14 @@ class _EexamPaperAndScoringViewState extends ConsumerState e.pageIndex == theEventVal.pageIndex); + if (_theTab != null && _theTab.finishCount == _theTab.total) { + isDefaultFirst = false; + } + } } ref.read(doJobObtainGradingDataProvider.notifier).setVal(MarkingTextQuestionJobTabParams( pageIndex: theEventVal.pageIndex, @@ -579,8 +554,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState e.pageIndex == _pageIndex); + if (_tabIndex != -1 && _tabIndex + 1 <= synchroTabs!.tabs.length - 1) { + model.isDefaultFirst = true; + } + } + if (model.paperId == 0 && jobData.nextPageIndex != null) { // 切换题型页面 model.paperId = null; @@ -635,8 +617,16 @@ class _EexamPaperAndScoringViewState extends ConsumerState e.pageIndex == _pageIndex); + if (_tabIndex != -1 && _tabIndex - 1 >= 0 && _tabIndex - 1 <= synchroTabs!.tabs.length - 1) { + model.isDefaultFirst = false; + } + } + if (model.paperId == 0 && jobData.previousPageIndex != null) { model.paperId = null; model.pageIndex = jobData.previousPageIndex!; 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; } } diff --git a/marking_app/lib/pages/homework_correction/job_home.dart b/marking_app/lib/pages/homework_correction/job_home.dart index a92cec4..bab1477 100644 --- a/marking_app/lib/pages/homework_correction/job_home.dart +++ b/marking_app/lib/pages/homework_correction/job_home.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:marking_app/common/mixin/common.dart'; import 'package:marking_app/common/model/event_bus/job_home_refresh_bus.dart'; import 'package:marking_app/common/model/marking/marking_list_params.dart'; @@ -13,6 +15,8 @@ import 'package:badges/badges.dart' as badges; import '../../utils/my_future_builder.dart'; +part 'job_home.g.dart'; + class JobHome extends StatefulWidget { const JobHome({super.key}); @@ -24,50 +28,10 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto @override bool get wantKeepAlive => true; - late Future _future; - List entrances = [ - EntranceModel( - title: '作业批阅', - image: '', - navigationUrl: RouterManager.jobMainListPagePath, - ), - EntranceModel( - title: '学生历史作业', - image: '', - navigationUrl: RouterManager.jobStudentGroupPath, - page:'history', - - ), - EntranceModel( - title: '知识点掌握', - image: '', - navigationUrl: RouterManager.jobKnowledgePointsPath, - ), - EntranceModel( - title: '答题轨迹', - image: '', - navigationUrl: RouterManager.answerTrajectoryPath, - ), - EntranceModel( - title: '优先批阅设定', - image: '', - navigationUrl: RouterManager.jobStudentGroupPath, - page:'set', - ), - EntranceModel( - title: '批阅设置', - image: '', - navigationUrl: '', - ), - ]; - @override void initState() { - _future = getData(); - eventOn(callback: (JobHomeRefreshBus item) { - _future = getData(); - toUpState(setState, () {}, mounted); - }); + getData(); + eventOn(callback: (JobHomeRefreshBus item) => getData()); super.initState(); } @@ -86,7 +50,9 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto limit: 1, pageType: 0, )); - return _result.data?.total ?? 0; + var data = _result.data?.total ?? 0; + eventFire(model: QuantityToBeReviewedData(data)); + return data; } catch (e) { return 0; } @@ -95,7 +61,7 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto @override Widget build(BuildContext context) { super.build(context); - + var spaceWidth = SizedBox(height: ScreenUtil().screenWidth / 19); return AnnotatedRegion( value: const SystemUiOverlayStyle( systemNavigationBarColor: Color(0xFF000000), @@ -105,87 +71,42 @@ class _JobHomeState extends State with CommonMixin, EventBusMixin, Auto statusBarIconBrightness: Brightness.dark, statusBarBrightness: Brightness.light, ), - child: Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, // 标题居中 - title: quickText('我的作业管理'), - systemOverlayStyle: SystemUiOverlayStyle.dark, - ), - backgroundColor: Color.fromRGBO(244, 244, 244, 1), - body: RefreshIndicator( - onRefresh: () async { - _future = getData(); - toUpState(setState, () {}, mounted); - }, - child: MyFutureBuilder.buildFutureBuilderOfSingleInstance(context, _future, (data) { - if (data == null) - return Center( - child: Container( - child: TextButton( - onPressed: () { - _future = getData(); - toUpState(setState, () {}, mounted); - }, - child: quickText('没有获取到数据,点击重试'), - ), + child: RefreshIndicator( + onRefresh: () async => eventFire(model: JobHomeRefreshBus()), + child: ListView( + children: [ + Container( + height: 200.h, + width: double.infinity, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/job_home_top_bgm.png'), + fit: BoxFit.fill, // 完全填充 ), - ); - - return Container( - padding: EdgeInsets.symmetric(vertical: 40.h, horizontal: 20.w), - child: GridView( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - mainAxisSpacing: 24.r, - crossAxisSpacing: 24.r, - childAspectRatio: 556 / 200, - ), - children: entrances.map((e) { - bool isJob = e.title == '作业批阅'; - - return InkWell( - onTap: () => easyThrottle('GO_TO_JOB_HOME_NAVIGATION', () { - if(e.page != ''){ - RouterManager.router.navigateTo(context, '${e.navigationUrl}?page=${e.page}', transition: getTransition()); - }else{ - RouterManager.router.navigateTo(context, e.navigationUrl, transition: getTransition()); - } - - }), - child: badges.Badge( - showBadge: isJob && data > 0, - ignorePointer: false, - badgeContent: quickText(data, color: Colors.white), - badgeAnimation: badges.BadgeAnimation.rotation( - animationDuration: Duration(seconds: 1), - colorChangeAnimationDuration: Duration(seconds: 1), - loopAnimation: false, - curve: Curves.fastOutSlowIn, - colorChangeAnimationCurve: Curves.easeInCubic, - ), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6.r)), - border: Border.all( - width: 0.5.w, - color: Color.fromARGB(255, 219, 226, 250), - ), - ), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // Image(image: e.image), - quickText(e.title, size: 12.sp), - ], - ), - ), - )); - }).toList(), ), - ); - }), + ), + SizedBox(height: 30.h), + SlidingData([ + EntranceModel(title: '作业批阅', image: 'assets/images/job_home_marking.png', navigationUrl: ''), + EntranceModel( + title: '学生历史作业', + image: 'assets/images/job_home_history.png', + navigationUrl: '${RouterManager.jobStudentGroupPath}?page=history', + ), + EntranceModel(title: '知识点点掌握', image: 'assets/images/job_home_knowledge.png', navigationUrl: '') + ]), + spaceWidth, + $TermRow([ + EntranceModel(title: '答题轨迹', image: 'assets/images/job_home_answer_record.png', navigationUrl: ''), + EntranceModel( + title: '优先批阅设定', + image: 'assets/images/job_home_youxian.png', + navigationUrl: '${RouterManager.jobStudentGroupPath}?page=set', + ) + ], 0), + spaceWidth, + $TermRow([EntranceModel(title: '批阅设置', image: 'assets/images/job_home_marking_set.png', navigationUrl: '')], 0), + ], ), ), ); @@ -196,6 +117,146 @@ class EntranceModel extends Object { String title; String image; String navigationUrl; - String? page; - EntranceModel({required this.title, required this.image, required this.navigationUrl,this.page = ''}); + EntranceModel({required this.title, required this.image, required this.navigationUrl}); +} + +class QuantityToBeReviewedData extends Object { + int num; + QuantityToBeReviewedData(this.num); +} + +@swidget +Widget $termRow(BuildContext context, List items, int data) { + var leng = items.length; + Widget childWidget; + switch (leng) { + case 1: + childWidget = Row(children: [Expanded(child: $TermItem(items[0], data))]); + break; + case 2: + childWidget = Row(children: [ + Expanded(flex: 9, child: $TermItem(items[0], data)), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 9, child: $TermItem(items[1], data)), + ]); + break; + case 3: + double _theHeight = ScreenUtil().screenWidth / 19 + 54.h * 2; + childWidget = Row( + children: [ + Expanded(child: $TermItem(items[0], data, theHeight: _theHeight)), + SizedBox(width: ScreenUtil().screenWidth / 19), + Expanded( + child: SizedBox( + height: _theHeight, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + $TermItem(items[1], data), + $TermItem(items[2], data), + ], + ), + ), + ), + ], + ); + break; + default: + childWidget = Container(); + } + + return Container(padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget); +} + +@swidget +Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) { + bool isJob = e.title == '作业批阅'; + + return Material( + color: Colors.white, + elevation: 3.r, + shadowColor: const Color.fromRGBO(231, 231, 231, 1), + borderRadius: BorderRadius.all(Radius.circular(8.r)), + child: InkWell( + onTap: () => easyThrottle('GO_TO_JOB_HOME_NAVIGATION', () { + RouterManager.router.navigateTo(context, e.navigationUrl, transition: getTransition()); + }), + + // splashColor: splashColor, + borderRadius: BorderRadius.all(Radius.circular(8.r)), + child: badges.Badge( + showBadge: isJob && data > 0, + ignorePointer: false, + badgeContent: quickText(data, color: Colors.white, size: 10.sp), + badgeAnimation: badges.BadgeAnimation.rotation( + animationDuration: Duration(seconds: 1), + colorChangeAnimationDuration: Duration(seconds: 1), + loopAnimation: false, + curve: Curves.fastOutSlowIn, + colorChangeAnimationCurve: Curves.easeInCubic, + ), + badgeStyle: badges.BadgeStyle( + badgeColor: Color.fromRGBO(255, 105, 105, 1), + shape: badges.BadgeShape.square, + borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.r)), + // borderSide: BorderSide(color: Colors.white, width: 2), + elevation: 1, + padding: EdgeInsets.symmetric(horizontal: isPad() ? 11.w : 16.w, vertical: 2.h), + ), + position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r), + child: Container( + height: theHeight, + padding: EdgeInsets.symmetric(vertical: 12.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.r)), + // boxShadow: [ + // BoxShadow( + // color: const Color.fromRGBO(231, 231, 231, 1), + // offset: Offset(4.w, 6.h), //阴影y轴偏移量 + // blurRadius: 8, //阴影模糊程度 + // spreadRadius: 0.2, //阴影扩散程度 + // ) + // ], + // border: Border.all(width: 0.5.w, color: Color.fromARGB(255, 219, 226, 250)), + ), + alignment: Alignment.center, + child: isJob + ? Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), + SizedBox(height: 6.r), + quickText(e.title, size: 12.sp, color: Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover), + SizedBox(width: 6.r), + quickText(e.title, size: 12.sp, color: Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500), + ], + ), + ), + )), + ); +} + +class SlidingData extends HookWidget with EventBusMixin { + final List items; + SlidingData(this.items); + + @override + Widget build(BuildContext context) { + var dataNumber = useState(null); + + useEffect(() { + eventOn(callback: (QuantityToBeReviewedData data) => (dataNumber.value = data)); + return () { + eventCancel(); + }; + }, []); + + return $TermRow(items, dataNumber.value?.num ?? 0); + } } diff --git a/marking_app/lib/pages/mainPage.dart b/marking_app/lib/pages/mainPage.dart index acad5d6..5b7521b 100644 --- a/marking_app/lib/pages/mainPage.dart +++ b/marking_app/lib/pages/mainPage.dart @@ -155,7 +155,8 @@ class TheMainPageState extends ConsumerState with CommonMixin { child: Scaffold( body: PageView( controller: _pageController, - physics: const BouncingScrollPhysics(), + // physics: const BouncingScrollPhysics(), + physics: NeverScrollableScrollPhysics(), onPageChanged: (index) => toUpState(setState, () => tabIndex = index, mounted), children: _bodyList, ), diff --git a/marking_app/pubspec.yaml b/marking_app/pubspec.yaml index dd3a2a1..bde00aa 100644 --- a/marking_app/pubspec.yaml +++ b/marking_app/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.102 +version: 1.0.104 environment: sdk: ">=2.17.1 <3.0.0"