Compare commits

...

11 Commits

Author SHA1 Message Date
machuanyu 21183f11bc Merge branch 'job_new_demand' into mcy_revision
# Conflicts:
#	marking_app/lib/pages/homework_correction/job_home.dart
2024-04-16 13:47:19 +08:00
1147192855@qq.com d9adbe845b no message 2024-04-16 12:05:27 +08:00
1147192855@qq.com 4c78d903a1 Merge branch 'main' into job_new_demand
# Conflicts:
#	.gitignore
2024-04-15 18:22:40 +08:00
1147192855@qq.com 727c774ea0 no message 2024-04-15 18:16:52 +08:00
1147192855@qq.com 4e812bc5c0 no message 2024-04-15 15:41:13 +08:00
1147192855@qq.com 6e2010a7cc no message 2024-04-15 14:15:48 +08:00
豌杂 abb0d41d39 no message 2024-04-15 14:04:20 +08:00
1147192855@qq.com a614c90458 no message 2024-04-15 13:40:43 +08:00
1147192855@qq.com c43e75fafd 处理无法切换下一题BUG 2024-04-15 11:47:28 +08:00
1147192855@qq.com ecfb2c33b6 更新此次批阅优化问题 2024-04-12 12:20:36 +08:00
1147192855@qq.com d5249ba0af 处理异常 2024-04-12 10:03:42 +08:00
39 changed files with 280 additions and 269 deletions

6
.gitignore vendored
View File

@ -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_detail.g.dart
marking_app/lib/common/model/job/job_knowledge_points.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.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -352,7 +352,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 20; CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_TEAM = CYDU583KN6; DEVELOPMENT_TEAM = CYDU583KN6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@ -360,7 +360,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.102; MARKETING_VERSION = 1.0.104;
PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -490,7 +490,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 20; CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_TEAM = CYDU583KN6; DEVELOPMENT_TEAM = CYDU583KN6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@ -498,7 +498,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.102; MARKETING_VERSION = 1.0.104;
PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -520,7 +520,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES; ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = ""; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 20; CURRENT_PROJECT_VERSION = 21;
DEVELOPMENT_TEAM = CYDU583KN6; DEVELOPMENT_TEAM = CYDU583KN6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@ -528,7 +528,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.102; MARKETING_VERSION = 1.0.104;
PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.markingApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:marking_app/common/model/job/job_page_tab.dart'; import 'package:marking_app/common/model/job/job_page_tab.dart';
@ -14,14 +15,21 @@ class JobDoSynchroTab extends Object {
Map<String, dynamic> toJson() => _$JobDoSynchroTabToJson(this); Map<String, dynamic> toJson() => _$JobDoSynchroTabToJson(this);
/// tab下一个tab的pageIndex /// tab下一个tab的pageIndex
int? getNextPageIndex([int? indexLocated]) { int? getNextPageIndex([int? pageIndex]) {
if (indexLocated == null) return null; if (pageIndex == null) return null;
return indexLocated == tabs.length - 1 ? null : tabs[indexLocated + 1].pageIndex; 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 /// tab上一个tab的pageIndex
int? getPreviousPageIndex([int? indexLocated]) { int? getPreviousPageIndex([int? pageIndex]) {
if (indexLocated == null) return null; if (pageIndex == null) return null;
return indexLocated == 0 ? null : tabs[indexLocated - 1].pageIndex; 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;
} }
} }

View File

@ -1,25 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'job_knowledge_detail_student.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
JobKnowledgeDetailStudent _$JobKnowledgeDetailStudentFromJson(
Map<String, dynamic> json) =>
JobKnowledgeDetailStudent(
json['studentId'] as int,
json['studentName'] as String,
json['isAnswer'] as bool,
json['isCorrect'] as bool,
);
Map<String, dynamic> _$JobKnowledgeDetailStudentToJson(
JobKnowledgeDetailStudent instance) =>
<String, dynamic>{
'studentId': instance.studentId,
'studentName': instance.studentName,
'isAnswer': instance.isAnswer,
'isCorrect': instance.isCorrect,
};

View File

@ -1,18 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'keyboard_assist_event.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
KeyboardAssistEvent _$KeyboardAssistEventFromJson(Map<String, dynamic> json) =>
KeyboardAssistEvent(
openAuxiliary: json['openAuxiliary'] as bool? ?? false,
);
Map<String, dynamic> _$KeyboardAssistEventToJson(
KeyboardAssistEvent instance) =>
<String, dynamic>{
'openAuxiliary': instance.openAuxiliary,
};

View File

@ -1,27 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'marking_history_zoom_info.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
MarkingHistoryZoomInfo _$MarkingHistoryZoomInfoFromJson(
Map<String, dynamic> 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<String, dynamic> _$MarkingHistoryZoomInfoToJson(
MarkingHistoryZoomInfo instance) =>
<String, dynamic>{
'markingUserId': instance.markingUserId,
'questionNum': instance.questionNum,
'scale': instance.scale,
'positionY': instance.positionY,
'positionX': instance.positionX,
};

View File

@ -290,7 +290,9 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
var _currentTab = _useSwitchStudentAndType.currentTab.value; var _currentTab = _useSwitchStudentAndType.currentTab.value;
var _pageIndex = _currentTab?.pageIndex; var _pageIndex = _currentTab?.pageIndex;
if (_currentTab == null || _pageIndex == null) return; if (_currentTab == null || _pageIndex == null) return;
_useSwitchStudentAndType.refreshQuestionTypeData(context, taskId: taskId, exitCallback: exitCallback, getNewData: false).then((value) {
var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex); var params = MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex);
if (_currentTab.finishCount < _currentTab.total) {
if (_currentTab.finishCount + 1 == _currentTab.total) { if (_currentTab.finishCount + 1 == _currentTab.total) {
var _currentTabNew = var _currentTabNew =
_useSwitchStudentAndType.tabs.value.firstWhereOrNull((e) => e.pageIndex != _currentTab.pageIndex && e.finishCount != e.total); _useSwitchStudentAndType.tabs.value.firstWhereOrNull((e) => e.pageIndex != _currentTab.pageIndex && e.finishCount != e.total);
@ -302,7 +304,10 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
_theCurrentPage.finishCount += 1; _theCurrentPage.finishCount += 1;
_useSwitchStudentAndType.tabs.value = _useSwitchStudentAndType.tabs.value.map((e) => JobPageTab.fromJson(e.toJson())).toList(); _useSwitchStudentAndType.tabs.value = _useSwitchStudentAndType.tabs.value.map((e) => JobPageTab.fromJson(e.toJson())).toList();
} }
}
_useSwitchStudentAndType.eventFire(model: params); _useSwitchStudentAndType.eventFire(model: params);
});
break; break;
default: default:
} }
@ -396,7 +401,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
), ),
Expanded(flex: 1, child: SizedBox()), Expanded(flex: 1, child: SizedBox()),
Expanded( Expanded(
flex: 4, flex: isPad() ? 4 : 5,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -415,9 +420,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
'DO_PAPERS_JOB_CONTINUE_TO_REVIEW', 'DO_PAPERS_JOB_CONTINUE_TO_REVIEW',
() { () {
var _currentTabNew = _useSwitchStudentAndType.tabs.value.firstWhere((e) => e.finishCount < e.total); var _currentTabNew = _useSwitchStudentAndType.tabs.value.firstWhere((e) => e.finishCount < e.total);
_useSwitchStudentAndType.eventFire( _useSwitchStudentAndType.eventFire(model: MarkingTextQuestionJobTabParamsBus(taskId, _currentTabNew.pageIndex));
model: MarkingTextQuestionJobTabParamsBus(taskId, _currentTabNew.pageIndex),
);
}, },
), ),
child: quickText( 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<ExamPaperAndScoringVi
var theEventVal = eventVal as MarkingTextQuestionJobTabParamsBus; var theEventVal = eventVal as MarkingTextQuestionJobTabParamsBus;
bool? isDefaultFirst; bool? isDefaultFirst;
if (theJobData != null) { if (theJobData != null) {
isDefaultFirst = theJobData!.pageIndex < theEventVal.pageIndex; isDefaultFirst = theJobData!.pageIndex == theEventVal.pageIndex ? null : theJobData!.pageIndex < theEventVal.pageIndex;
} else {
if (synchroTabs?.tabs.isNotEmpty ?? false) {
var _theTab = synchroTabs?.tabs.firstWhereOrNull((e) => e.pageIndex == theEventVal.pageIndex);
if (_theTab != null && _theTab.finishCount == _theTab.total) {
isDefaultFirst = false;
}
}
} }
ref.read(doJobObtainGradingDataProvider.notifier).setVal(MarkingTextQuestionJobTabParams( ref.read(doJobObtainGradingDataProvider.notifier).setVal(MarkingTextQuestionJobTabParams(
pageIndex: theEventVal.pageIndex, pageIndex: theEventVal.pageIndex,
@ -579,8 +554,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
var jobDetails = _result.data; var jobDetails = _result.data;
theJobData = jobDetails; theJobData = jobDetails;
if (jobDetails != null) { if (jobDetails != null) {
jobDetails.previousPageIndex = synchroTabs?.getPreviousPageIndex(jobDetails.pageIndex - 1); jobDetails.previousPageIndex = synchroTabs?.getPreviousPageIndex(jobDetails.pageIndex);
jobDetails.nextPageIndex = synchroTabs?.getNextPageIndex(jobDetails.pageIndex - 1); jobDetails.nextPageIndex = synchroTabs?.getNextPageIndex(jobDetails.pageIndex);
// //
try { try {
// //
@ -618,8 +593,15 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
pageIndex: jobData.pageIndex, pageIndex: jobData.pageIndex,
nextPageIndex: jobData.nextPageIndex, nextPageIndex: jobData.nextPageIndex,
previousPageIndex: jobData.previousPageIndex, previousPageIndex: jobData.previousPageIndex,
isDefaultFirst: true,
); );
if (jobData.nextId == 0 && (synchroTabs?.tabs.isNotEmpty ?? false)) {
var _pageIndex = jobData.pageIndex;
var _tabIndex = synchroTabs!.tabs.indexWhere((e) => e.pageIndex == _pageIndex);
if (_tabIndex != -1 && _tabIndex + 1 <= synchroTabs!.tabs.length - 1) {
model.isDefaultFirst = true;
}
}
if (model.paperId == 0 && jobData.nextPageIndex != null) { if (model.paperId == 0 && jobData.nextPageIndex != null) {
// //
model.paperId = null; model.paperId = null;
@ -635,8 +617,16 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
paperId: jobData.prevId, paperId: jobData.prevId,
nextPageIndex: jobData.nextPageIndex, nextPageIndex: jobData.nextPageIndex,
previousPageIndex: jobData.previousPageIndex, previousPageIndex: jobData.previousPageIndex,
isDefaultFirst: false,
); );
if (jobData.prevId == 0 && (synchroTabs?.tabs.isNotEmpty ?? false)) {
var _pageIndex = jobData.pageIndex;
var _tabIndex = synchroTabs!.tabs.indexWhere((e) => 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) { if (model.paperId == 0 && jobData.previousPageIndex != null) {
model.paperId = null; model.paperId = null;
model.pageIndex = jobData.previousPageIndex!; model.pageIndex = jobData.previousPageIndex!;

View File

@ -99,8 +99,12 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
} }
/// tab类型数据 /// tab类型数据
Future<JobPageTab?> refreshQuestionTypeData(BuildContext context, {required int taskId, required Function() exitCallback}) async { Future<JobPageTab?> refreshQuestionTypeData(BuildContext context,
List<JobPageTab>? tabDatas = await getDataForTestpaper(taskId: taskId, synchronization: false); {required int taskId, required Function() exitCallback, bool getNewData = true}) async {
List<JobPageTab>? tabDatas = tabs.value;
if (getNewData) {
tabDatas = await getDataForTestpaper(taskId: taskId, synchronization: false);
}
if (tabDatas?.isNotEmpty ?? false) { if (tabDatas?.isNotEmpty ?? false) {
JobPageTab? tabJob = tabDatas!.firstWhereOrNull((e) => e.finishCount < e.total); JobPageTab? tabJob = tabDatas!.firstWhereOrNull((e) => e.finishCount < e.total);
if (tabJob == null && !exitPromptFlag.value) { if (tabJob == null && !exitPromptFlag.value) {
@ -124,9 +128,20 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
exitCallback(); exitCallback();
} else { } else {
// //
if (!getNewData) return tabJob;
tabs.value = tabDatas; tabs.value = tabDatas;
if (tabJob != null) currentTab.value = tabJob; 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; return tabJob;
} }
} }

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:flutter_screenutil/flutter_screenutil.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/mixin/common.dart';
import 'package:marking_app/common/model/event_bus/job_home_refresh_bus.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'; 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'; import '../../utils/my_future_builder.dart';
part 'job_home.g.dart';
class JobHome extends StatefulWidget { class JobHome extends StatefulWidget {
const JobHome({super.key}); const JobHome({super.key});
@ -24,50 +28,10 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
late Future<int> _future;
List<EntranceModel> 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 @override
void initState() { void initState() {
_future = getData(); getData();
eventOn(callback: (JobHomeRefreshBus item) { eventOn(callback: (JobHomeRefreshBus item) => getData());
_future = getData();
toUpState(setState, () {}, mounted);
});
super.initState(); super.initState();
} }
@ -86,7 +50,9 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
limit: 1, limit: 1,
pageType: 0, pageType: 0,
)); ));
return _result.data?.total ?? 0; var data = _result.data?.total ?? 0;
eventFire(model: QuantityToBeReviewedData(data));
return data;
} catch (e) { } catch (e) {
return 0; return 0;
} }
@ -95,7 +61,7 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
var spaceWidth = SizedBox(height: ScreenUtil().screenWidth / 19);
return AnnotatedRegion( return AnnotatedRegion(
value: const SystemUiOverlayStyle( value: const SystemUiOverlayStyle(
systemNavigationBarColor: Color(0xFF000000), systemNavigationBarColor: Color(0xFF000000),
@ -105,89 +71,44 @@ class _JobHomeState extends State<JobHome> with CommonMixin, EventBusMixin, Auto
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light, statusBarBrightness: Brightness.light,
), ),
child: Scaffold( child: RefreshIndicator(
appBar: AppBar( onRefresh: () async => eventFire(model: JobHomeRefreshBus()),
backgroundColor: Colors.white, child: ListView(
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<int>(context, _future, (data) {
if (data == null)
return Center(
child: Container(
child: TextButton(
onPressed: () {
_future = getData();
toUpState(setState, () {}, mounted);
},
child: quickText('没有获取到数据,点击重试'),
),
),
);
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: [ children: [
// Image(image: e.image), Container(
quickText(e.title, size: 12.sp), height: 200.h,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/job_home_top_bgm.png'),
fit: BoxFit.fill, //
),
),
),
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),
], ],
), ),
), ),
));
}).toList(),
),
);
}),
),
),
); );
} }
} }
@ -196,6 +117,146 @@ class EntranceModel extends Object {
String title; String title;
String image; String image;
String navigationUrl; String navigationUrl;
String? page; EntranceModel({required this.title, required this.image, required this.navigationUrl});
EntranceModel({required this.title, required this.image, required this.navigationUrl,this.page = ''}); }
class QuantityToBeReviewedData extends Object {
int num;
QuantityToBeReviewedData(this.num);
}
@swidget
Widget $termRow(BuildContext context, List<EntranceModel> 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<EntranceModel> items;
SlidingData(this.items);
@override
Widget build(BuildContext context) {
var dataNumber = useState<QuantityToBeReviewedData?>(null);
useEffect(() {
eventOn(callback: (QuantityToBeReviewedData data) => (dataNumber.value = data));
return () {
eventCancel();
};
}, []);
return $TermRow(items, dataNumber.value?.num ?? 0);
}
} }

View File

@ -155,7 +155,8 @@ class TheMainPageState extends ConsumerState<TheMainPage> with CommonMixin {
child: Scaffold( child: Scaffold(
body: PageView( body: PageView(
controller: _pageController, controller: _pageController,
physics: const BouncingScrollPhysics(), // physics: const BouncingScrollPhysics(),
physics: NeverScrollableScrollPhysics(),
onPageChanged: (index) => toUpState(setState, () => tabIndex = index, mounted), onPageChanged: (index) => toUpState(setState, () => tabIndex = index, mounted),
children: _bodyList, children: _bodyList,
), ),

View File

@ -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. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.102 version: 1.0.104
environment: environment:
sdk: ">=2.17.1 <3.0.0" sdk: ">=2.17.1 <3.0.0"