From 02a7b748e11eba3071ff4fe0b5348c66c1af3ce4 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Sat, 9 Mar 2024 21:56:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/model/job/job_data_report.g.dart | 91 ++++ .../lib/common/model/job/job_task_item.dart | 3 + .../model/marking/marking_list_params.dart | 12 +- marking_app/lib/main.dart | 23 + marking_app/lib/pages/home/index.dart | 23 - .../homework_tasks_view_item.dart | 296 +++++------ .../lib/pages/homework_correction/index.dart | 464 ++++++++++++---- .../pages/job_list_participate_in_class.dart | 500 +++++++++++++++++- marking_app/lib/pages/marking/index.dart | 3 - marking_app/lib/routes/RouterManager.dart | 16 +- marking_app/pubspec.yaml | 16 +- 11 files changed, 1146 insertions(+), 301 deletions(-) create mode 100644 marking_app/lib/common/model/job/job_data_report.g.dart diff --git a/marking_app/lib/common/model/job/job_data_report.g.dart b/marking_app/lib/common/model/job/job_data_report.g.dart new file mode 100644 index 0000000..dcd6608 --- /dev/null +++ b/marking_app/lib/common/model/job/job_data_report.g.dart @@ -0,0 +1,91 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'job_data_report.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +JobDataReport _$JobDataReportFromJson(Map json) => + JobDataReport( + json['jobId'] as int, + json['jobName'] as String, + json['gradeName'] as String, + json['className'] as String?, + json['validCount'] as int, + json['noAnswerCount'] as int, + (json['kgValidRate'] as num).toDouble(), + json['kgQuestionCount'] as int, + (json['zgValidRate'] as num).toDouble(), + json['zgQuestionCount'] as int, + (json['studentDetails'] as List) + .map((e) => StudentDetails.fromJson(e as Map)) + .toList(), + ); + +Map _$JobDataReportToJson(JobDataReport instance) => + { + 'jobId': instance.jobId, + 'jobName': instance.jobName, + 'gradeName': instance.gradeName, + 'className': instance.className, + 'validCount': instance.validCount, + 'noAnswerCount': instance.noAnswerCount, + 'kgValidRate': instance.kgValidRate, + 'kgQuestionCount': instance.kgQuestionCount, + 'zgValidRate': instance.zgValidRate, + 'zgQuestionCount': instance.zgQuestionCount, + 'studentDetails': instance.studentDetails, + }; + +StudentDetails _$StudentDetailsFromJson(Map json) => + StudentDetails( + json['studentId'] as int, + json['studentName'] as String, + json['kgValidCount'] as int, + json['kgValidRate'] as int, + json['zgValidCount'] as int, + json['zgValidRate'] as int, + (json['kgDetails'] as List) + .map((e) => KgDetails.fromJson(e as Map)) + .toList(), + (json['zgDetails'] as List) + .map((e) => KgDetails.fromJson(e as Map)) + .toList(), + ); + +Map _$StudentDetailsToJson(StudentDetails instance) => + { + 'studentId': instance.studentId, + 'studentName': instance.studentName, + 'kgValidCount': instance.kgValidCount, + 'kgValidRate': instance.kgValidRate, + 'zgValidCount': instance.zgValidCount, + 'zgValidRate': instance.zgValidRate, + 'kgDetails': instance.kgDetails, + 'zgDetails': instance.zgDetails, + }; + +KgDetails _$KgDetailsFromJson(Map json) => KgDetails( + json['questionNo'] as String, + json['questionId'] as int, + json['partName'] as String, + json['state'] as int, + json['studentAnswer'] as String?, + json['questionAnswer'] as String?, + json['useTime'] as int?, + json['annotateAnswers'] as String?, + (json['score'] as num?)?.toDouble(), + ); + +Map _$KgDetailsToJson(KgDetails instance) => { + 'questionNo': instance.questionNo, + 'questionId': instance.questionId, + 'partName': instance.partName, + 'state': instance.state, + 'studentAnswer': instance.studentAnswer, + 'questionAnswer': instance.questionAnswer, + 'useTime': instance.useTime, + 'annotateAnswers': instance.annotateAnswers, + 'score': instance.score, + }; diff --git a/marking_app/lib/common/model/job/job_task_item.dart b/marking_app/lib/common/model/job/job_task_item.dart index 70ba21c..1cd83ff 100644 --- a/marking_app/lib/common/model/job/job_task_item.dart +++ b/marking_app/lib/common/model/job/job_task_item.dart @@ -56,6 +56,8 @@ class JobTaskItem extends Object { @JsonKey(name: 'markingTypeEnum') JobMarkingTypeEnum markingTypeEnum; // 考试类型 + int taskCount; // 参与班级数量 + JobTaskItem( this.id, this.title, @@ -72,6 +74,7 @@ class JobTaskItem extends Object { // this.markingTasks, this.createTime, this.markingType, + this.taskCount, {this.progressPercentage = 0, this.markingTypeEnum = JobMarkingTypeEnum.UNUSED}) { try { diff --git a/marking_app/lib/common/model/marking/marking_list_params.dart b/marking_app/lib/common/model/marking/marking_list_params.dart index da455b5..2906d6e 100644 --- a/marking_app/lib/common/model/marking/marking_list_params.dart +++ b/marking_app/lib/common/model/marking/marking_list_params.dart @@ -21,12 +21,22 @@ class MarkingListParams extends BasePage { @JsonKey(name: 'PageType') int pageType; + String? startTime; + String? endTime; + + int? markingType; // 1 作业 2考试 + MarkingListParams({ required this.isFinish, required this.pageType, required page, required limit, - }) : super(page, limit); + this.markingType, + this.startTime, + this.endTime, + }) : super(page, limit) { + this.markingType ??= 1; + } factory MarkingListParams.fromJson(Map srcJson) => _$MarkingListParamsFromJson(srcJson); diff --git a/marking_app/lib/main.dart b/marking_app/lib/main.dart index 6b57722..96d52e9 100644 --- a/marking_app/lib/main.dart +++ b/marking_app/lib/main.dart @@ -10,6 +10,7 @@ import 'dart:async'; import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter/services.dart'; @@ -83,6 +84,28 @@ class _MyAppState extends State { title: '远轩阅卷系统', navigatorKey: TheGlobal.navigatorKey, debugShowCheckedModeBanner: false, + // locale: const Locale('zh', 'CN'), // 中文简体 , + // supportedLocales: [ + // const Locale('zh', 'CN'), // 中文简体 + // // 其他支持的locale可以在这里添加 + // ], + // 这里是国际化支持,确保添加flutter_localizations依赖 + supportedLocales: [ + const Locale('zh', 'CN'), // 中文简体 + // 其他支持的locale可以在这里添加 + ], + localizationsDelegates: [ + // ...其他delegates + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, // 如果你使用了Cupertino风格的组件 + // ...添加其他必要的delegates + ], + localeResolutionCallback: (locale, supportedLocales) { + // 在这里可以实现自定义的locale解析逻辑 + // 如果需要,返回你想要的Locale对象 + return locale; + }, theme: ThemeData( primarySwatch: createMaterialColor(const Color.fromRGBO(46, 91, 255, 1)), // textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp,), diff --git a/marking_app/lib/pages/home/index.dart b/marking_app/lib/pages/home/index.dart index 20a94c6..978c9a3 100644 --- a/marking_app/lib/pages/home/index.dart +++ b/marking_app/lib/pages/home/index.dart @@ -357,29 +357,6 @@ Widget $theTabBar({required TabController controller, ValueChanged? onTap}) isScrollable: true, labelColor: const Color.fromRGBO(45, 56, 76, 1), indicatorSize: TabBarIndicatorSize.label, // 设置指示器高度和标签一样高 - // labelPadding: EdgeInsets.symmetric(vertical: 0), // 设置标签的内边距 - // background: linear-gradient(270deg, #2E5BFF 30.23%, rgba(46, 91, 255, 0.00) 96.59%); - // indicatorColor: RectangleIndicator(), - // indicator: BoxDecoration( - // gradient: LinearGradient( - // begin: Alignment.centerLeft, - // end: Alignment.centerRight, - // colors: [ - // Color.fromRGBO(46, 91, 255, 0.00), - // Color(0xFF2E5BFF), - // ], - // stops: [0.3023, 0.9659], - // // transform: GradientRotation(3.14 / 2), //将270度转换为弧度 - // ), - // ), - // indicator: BoxDecoration( - // // 设置指示器样式 - // gradient: LinearGradient( - // colors: [Colors.yellow, Colors.green], // 设置渐变色 - // begin: Alignment.centerLeft, - // end: Alignment.centerRight, - // ), - // ), onTap: onTap, tabs: const [Tab(text: '阅卷'), Tab(text: '作业')], ), diff --git a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart index d757d83..872261a 100644 --- a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart +++ b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart @@ -145,154 +145,161 @@ class HomeworkTasksViewItem extends StatelessWidget with CommonMixin { @hwidget Widget $completedHomeworkView(BuildContext context, {required JobTaskItem jobTaskItem, required ShowStudentsCall showStudentsCall}) { - return Container( - width: double.infinity, - padding: EdgeInsets.only(top: 20.h), - margin: EdgeInsets.only(bottom: 12.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.r), - color: const Color.fromRGBO(255, 255, 255, 1), - boxShadow: [ - BoxShadow( - color: const Color.fromRGBO(210, 216, 241, 1), - offset: Offset.zero, //阴影y轴偏移量 - blurRadius: 5.8, //阴影模糊程度 - spreadRadius: 0, //阴影扩散程度 - ) - ], - ), - child: Column( - children: [ - // 顶部任务名称 - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w), - child: Row( - children: [ - Container( - width: 32.w, - height: 18.h, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 2.w), - decoration: BoxDecoration( - color: Color.fromRGBO(104, 136, 253, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(18.r), - topRight: Radius.circular(3.r), - bottomLeft: Radius.circular(4.r), - bottomRight: Radius.circular(4.r), + return InkWell( + onTap: () { + String url = + '${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}&completed=${true}'; + RouterManager.router.navigateTo(context, url, transition: getTransition()); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.only(top: 20.h), + margin: EdgeInsets.only(bottom: 12.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.r), + color: const Color.fromRGBO(255, 255, 255, 1), + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(210, 216, 241, 1), + offset: Offset.zero, //阴影y轴偏移量 + blurRadius: 5.8, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Column( + children: [ + // 顶部任务名称 + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.w), + child: Row( + children: [ + Container( + width: 32.w, + height: 18.h, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 2.w), + decoration: BoxDecoration( + color: Color.fromRGBO(104, 136, 253, 1), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(18.r), + topRight: Radius.circular(3.r), + bottomLeft: Radius.circular(4.r), + bottomRight: Radius.circular(4.r), + ), ), + margin: EdgeInsets.only(right: 4.w), + child: quickText('作业', color: Colors.white, size: 10.sp), ), - margin: EdgeInsets.only(right: 4.w), - child: quickText('作业', color: Colors.white, size: 10.sp), - ), - quickText( - jobTaskItem.title, - size: 16.sp, - color: Color.fromRGBO(70, 70, 70, 1), - fontWeight: FontWeight.bold, - ) - ], + quickText( + jobTaskItem.title, + size: 16.sp, + color: Color.fromRGBO(70, 70, 70, 1), + fontWeight: FontWeight.bold, + ) + ], + ), ), - ), - SizedBox(height: 12.h), - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.w), - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - quickText( - jobTaskItem.createTime.substring(0, 10), - color: Color.fromRGBO(97, 97, 97, 1), - size: 14.sp, - fontWeight: FontWeight.w500, - ), - quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.w500), - quickText( - '参与班级:字段待定', - color: Color.fromRGBO(76, 199, 147, 1), - size: 12.sp, - fontWeight: FontWeight.w600, - ), - quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 12.sp, fontWeight: FontWeight.w500), - quickText( - '科目:' + jobTaskItem.subjectName, - color: Color.fromRGBO(116, 145, 253, 1), - size: 12.sp, - fontWeight: FontWeight.w600, - ), - ], + SizedBox(height: 12.h), + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.w), + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + quickText( + jobTaskItem.createTime.substring(0, 10), + color: Color.fromRGBO(97, 97, 97, 1), + size: 14.sp, + fontWeight: FontWeight.w500, + ), + quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.w500), + quickText( + '参与班级:${jobTaskItem.taskCount}', + color: Color.fromRGBO(76, 199, 147, 1), + size: 12.sp, + fontWeight: FontWeight.w600, + ), + quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 12.sp, fontWeight: FontWeight.w500), + quickText( + '科目:' + jobTaskItem.subjectName, + color: Color.fromRGBO(116, 145, 253, 1), + size: 12.sp, + fontWeight: FontWeight.w600, + ), + ], + ), ), - ), - SizedBox(height: 20.h), - Container( - padding: EdgeInsets.symmetric(vertical: 8.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: const Color.fromRGBO(0, 0, 0, 0.15), - offset: Offset(0, -0.0001), //阴影y轴偏移量 - blurRadius: 4, //阴影模糊程度 - spreadRadius: 0, //阴影扩散程度 - ) - ], + SizedBox(height: 20.h), + Container( + padding: EdgeInsets.symmetric(vertical: 8.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(0, 0, 0, 0.15), + offset: Offset(0, -0.0001), //阴影y轴偏移量 + blurRadius: 4, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Row(children: [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_homework_report', () => {}), + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ]), ), - child: Row(children: [ - Expanded( - child: InkWell( - onTap: () => easyThrottle('go_to_homework_report', () => {}), - child: Container( - alignment: Alignment.center, - child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), - ), - )), - ]), - ), - // $CompletedHomeworkInfoBox( - // segmentation: false, - // showStudentsCall: showStudentsCall, - // unsubmittedQuantity: jobTaskItem.studentCount - jobTaskItem.commitStudentCount, - // submittedQuantity: jobTaskItem.commitStudentCount, - // precision: jobTaskItem.precision / 100, - // objectivePrecision: jobTaskItem.objectivePrecision / 100, - // subjectivePrecision: jobTaskItem.subjectivePrecision / 100, - // ), - // InkWell( - // onTap: () { - // RouterManager.router.navigateTo( - // context, - // RouterManager.jobReportPagePath + '?title=${Uri.encodeComponent(jobTaskItem.title)}&id=${jobTaskItem.id}', - // transition: getTransition(), - // ); - // }, - // child: Row( - // children: [ - // Expanded(flex: 1, child: SizedBox()), - // Expanded( - // flex: 9, - // child: Container( - // alignment: Alignment.center, - // margin: EdgeInsets.only(top: 20.h), - // padding: EdgeInsets.symmetric(vertical: 7.h), - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(20), - // gradient: LinearGradient( - // begin: Alignment.centerLeft, - // end: Alignment.centerRight, - // colors: [Color.fromRGBO(95, 197, 255, 1), Color.fromRGBO(61, 68, 255, 0.82)], - // ), - // ), - // child: quickText('查看报告', color: Colors.white, size: 12.sp), - // ), - // ), - // Expanded(flex: 1, child: SizedBox()), - // ], - // ), - // ) - ], + // $CompletedHomeworkInfoBox( + // segmentation: false, + // showStudentsCall: showStudentsCall, + // unsubmittedQuantity: jobTaskItem.studentCount - jobTaskItem.commitStudentCount, + // submittedQuantity: jobTaskItem.commitStudentCount, + // precision: jobTaskItem.precision / 100, + // objectivePrecision: jobTaskItem.objectivePrecision / 100, + // subjectivePrecision: jobTaskItem.subjectivePrecision / 100, + // ), + // InkWell( + // onTap: () { + // RouterManager.router.navigateTo( + // context, + // RouterManager.jobReportPagePath + '?title=${Uri.encodeComponent(jobTaskItem.title)}&id=${jobTaskItem.id}', + // transition: getTransition(), + // ); + // }, + // child: Row( + // children: [ + // Expanded(flex: 1, child: SizedBox()), + // Expanded( + // flex: 9, + // child: Container( + // alignment: Alignment.center, + // margin: EdgeInsets.only(top: 20.h), + // padding: EdgeInsets.symmetric(vertical: 7.h), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(20), + // gradient: LinearGradient( + // begin: Alignment.centerLeft, + // end: Alignment.centerRight, + // colors: [Color.fromRGBO(95, 197, 255, 1), Color.fromRGBO(61, 68, 255, 0.82)], + // ), + // ), + // child: quickText('查看报告', color: Colors.white, size: 12.sp), + // ), + // ), + // Expanded(flex: 1, child: SizedBox()), + // ], + // ), + // ) + ], + ), ), ); } @@ -654,13 +661,6 @@ Widget $unfinishedHomework(BuildContext context, {required JobTaskItem jobTaskIt ), backgroundColor: Color.fromRGBO(244, 244, 244, 1), ), - // Container( - // child: Container( - // color: Colors.red, - // height: 40.r, - // width: 40.r, - // ) - // ), ), ], ); diff --git a/marking_app/lib/pages/homework_correction/index.dart b/marking_app/lib/pages/homework_correction/index.dart index 2c45474..0706791 100644 --- a/marking_app/lib/pages/homework_correction/index.dart +++ b/marking_app/lib/pages/homework_correction/index.dart @@ -9,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:marking_app/common/mixin/common.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -18,6 +19,7 @@ import 'package:marking_app/common/config/request_config.dart'; import 'package:marking_app/common/model/job/job_task_item.dart'; import 'package:marking_app/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart'; import 'package:marking_app/provider/review_provider.dart'; +import 'package:marking_app/routes/RouterManager.dart'; import 'package:marking_app/utils/index.dart'; import 'package:marking_app/utils/my_text.dart'; import 'package:marking_app/utils/request/rest_client.dart'; @@ -25,6 +27,7 @@ import 'package:marking_app/common/model/common/base_page_data.dart'; import 'package:marking_app/common/model/marking/marking_list_params.dart'; import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart'; import 'package:marking_app/utils/easy_refresh/mixin/refresh_data_handle.dart'; +import 'package:syncfusion_flutter_datepicker/datepicker.dart'; part 'index.g.dart'; @@ -39,7 +42,7 @@ class HomeworkCorrection extends StatefulHookConsumerWidget { class _HomeworkCorrectionState extends ConsumerState with CommonMixin, - SingleTickerProviderStateMixin, + TickerProviderStateMixin, RefreshDataHandle, AutomaticKeepAliveClientMixin { @override @@ -47,6 +50,8 @@ class _HomeworkCorrectionState extends ConsumerState /* Tab控制器 */ late TabController _tabController; + late TabController _tabController2; + int _tabIndex = 0; bool completedToRefresh = true; @@ -95,6 +100,7 @@ class _HomeworkCorrectionState extends ConsumerState length: 2, vsync: this, ); + _tabController2 = TabController(length: 4, vsync: this); _refreshController1 = EasyRefreshController(); _refreshController2 = EasyRefreshController(); @@ -117,6 +123,7 @@ class _HomeworkCorrectionState extends ConsumerState if (_currentTaskIdListener != null) { _currentTaskIdListener!(); } + _tabController2.dispose(); _tabController.dispose(); _refreshController1.dispose(); _refreshController2.dispose(); @@ -169,10 +176,7 @@ class _HomeworkCorrectionState extends ConsumerState child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - flex: 1, - child: SizedBox(), - ), + Expanded(flex: 1, child: SizedBox()), Expanded( flex: 4, child: Container( @@ -263,6 +267,29 @@ class _HomeworkCorrectionState extends ConsumerState ], ), ), + if (_tabIndex == 1) + $CompletedJobConditionFilter( + controller: _tabController2, + jobType: params2.markingType ?? 1, + customTime: _tabController2.index != 3 || (params2.startTime == null && params2.endTime == null) + ? null + : PickerDateRange( + params2.startTime == null ? null : DateTime.parse(params2.startTime!), + params2.endTime == null ? null : DateTime.parse(params2.endTime!), + ), + onJobTypeTap: (int jobTypeVal) { + params2.markingType = jobTypeVal; + _refreshController2.callRefresh(); + }, + onTimeFilter: (String? startTime, String? endTime) { + if (startTime == null && endTime == null && _tabController2.index == 3) { + _tabController2.animateTo(0); + } + params2.endTime = endTime; + params2.startTime = startTime; + _refreshController2.callRefresh(); + }, + ), Expanded( child: IndexedStack( index: _tabIndex, @@ -350,111 +377,336 @@ Widget $easyRefresh({ @swidget Widget $reviewedItem(BuildContext context, {required JobTaskItem jobTaskItem}) { EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w); - return Container( - padding: EdgeInsets.only(top: 10.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.r), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: const Color.fromRGBO(210, 216, 241, 1), - offset: Offset.zero, //阴影y轴偏移量 - blurRadius: 5.8, //阴影模糊程度 - spreadRadius: 0, //阴影扩散程度 - ) - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - // 顶部任务名称 - Padding( - padding: padEdg, - child: Row( - children: [ - Container( - width: 32.w, - height: 18.h, - alignment: Alignment.center, - padding: EdgeInsets.only(left: 2.w), - decoration: BoxDecoration( - color: jobTaskItem.markingTypeEnum.name == '作业' - ? const Color.fromRGBO(104, 136, 253, 1) - : const Color.fromRGBO(255, 175, 56, 1), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(18.r), - topRight: Radius.circular(3.r), - bottomLeft: Radius.circular(4.r), - bottomRight: Radius.circular(4.r), + return InkWell( + onTap: () { + String url = + '${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}&completed=${true}'; + RouterManager.router.navigateTo(context, url, transition: getTransition()); + }, + child: Container( + padding: EdgeInsets.only(top: 10.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.r), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(210, 216, 241, 1), + offset: Offset.zero, //阴影y轴偏移量 + blurRadius: 5.8, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // 顶部任务名称 + Padding( + padding: padEdg, + child: Row( + children: [ + Container( + width: 32.w, + height: 18.h, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 2.w), + decoration: BoxDecoration( + color: jobTaskItem.markingTypeEnum.name == '作业' + ? const Color.fromRGBO(104, 136, 253, 1) + : const Color.fromRGBO(255, 175, 56, 1), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(18.r), + topRight: Radius.circular(3.r), + bottomLeft: Radius.circular(4.r), + bottomRight: Radius.circular(4.r), + ), + ), + margin: EdgeInsets.only(right: 4.w), + child: quickText(jobTaskItem.markingTypeEnum.name, color: Colors.white, size: 10.sp), + ), + quickText( + jobTaskItem.title, + size: 16.sp, + color: Color.fromRGBO(70, 70, 70, 1), + fontWeight: FontWeight.bold, + ) + ], + ), + ), + + Padding( + padding: padEdg, + child: Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + quickText( + jobTaskItem.createTime.substring(0, 10), + color: Color.fromRGBO(97, 97, 97, 1), + size: 10.sp, + fontWeight: FontWeight.w500, + ), + quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 10.sp, fontWeight: FontWeight.w500), + quickText( + '参与班级:${jobTaskItem.taskCount}', + color: Color.fromRGBO(76, 199, 147, 1), + size: 10.sp, + fontWeight: FontWeight.w600, + ), + quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 10.sp, fontWeight: FontWeight.w500), + quickText( + '科目:' + jobTaskItem.subjectName, + color: Color.fromRGBO(116, 145, 253, 1), + size: 10.sp, + fontWeight: FontWeight.w600, + ), + ], + ), + ), + GestureDetector( + onTap: () => easyThrottle('go_to_homework_report', () { + print('子级点击方法'); + }), + child: Container( + padding: EdgeInsets.symmetric(vertical: 6.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(0, 0, 0, 0.15), + offset: Offset(0, -0.0001), //阴影y轴偏移量 + blurRadius: 4, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Row(children: [ + Expanded( + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 11.sp), ), ), - margin: EdgeInsets.only(right: 4.w), - child: quickText(jobTaskItem.markingTypeEnum.name, color: Colors.white, size: 10.sp), - ), - quickText( - jobTaskItem.title, - size: 16.sp, - color: Color.fromRGBO(70, 70, 70, 1), - fontWeight: FontWeight.bold, - ) - ], + ]), + ), ), - ), + ], + ), + ), + ); +} - Padding( - padding: padEdg, - child: Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - quickText( - jobTaskItem.createTime.substring(0, 10), - color: Color.fromRGBO(97, 97, 97, 1), - size: 10.sp, - fontWeight: FontWeight.w500, - ), - quickText(' / ', color: Color.fromRGBO(76, 199, 147, 1), size: 10.sp, fontWeight: FontWeight.w500), - quickText( - '参与班级:2', - color: Color.fromRGBO(76, 199, 147, 1), - size: 10.sp, - fontWeight: FontWeight.w600, - ), - quickText(' / ', color: Color.fromRGBO(116, 145, 253, 1), size: 10.sp, fontWeight: FontWeight.w500), - quickText( - '科目:' + jobTaskItem.subjectName, - color: Color.fromRGBO(116, 145, 253, 1), - size: 10.sp, - fontWeight: FontWeight.w600, - ), - ], - ), - ), - - Container( - padding: EdgeInsets.symmetric(vertical: 6.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), - color: Colors.white, - boxShadow: [ - BoxShadow( - color: const Color.fromRGBO(0, 0, 0, 0.15), - offset: Offset(0, -0.0001), //阴影y轴偏移量 - blurRadius: 4, //阴影模糊程度 - spreadRadius: 0, //阴影扩散程度 - ) - ], - ), - child: Row(children: [ - Expanded( - child: InkWell( - onTap: () => easyThrottle('go_to_homework_report', () => {}), - child: Container( - alignment: Alignment.center, - child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 11.sp), - ), - )), - ]), - ), +// 筛选时间 +@swidget +Widget $theTabBar({required TabController controller, ValueChanged? onTap, PickerDateRange? customTime}) { + var customTimeStr = '自定义'; + if (customTime != null) { + customTimeStr = customTime.startDate?.toString().substring(0, 10) ?? ''; + if (customTime.endDate != null) { + print(customTime.startDate!.year == customTime.endDate!.year); + if (!isPad() && customTime.startDate!.year == customTime.endDate!.year) { + customTimeStr = + customTime.startDate.toString().substring(5, 10) + '~${customTime.endDate.toString().substring(5, 10)}'; + } else { + customTimeStr += '~${customTime.endDate?.toString().substring(0, 10)}'; + } + } + } + return Container( + alignment: Alignment.centerLeft, + child: TabBar( + controller: controller, + unselectedLabelStyle: TextStyle(fontSize: 12.sp, color: const Color.fromRGBO(102, 102, 102, 1)), + labelStyle: TextStyle( + fontSize: 12.sp, + fontWeight: FontWeight.bold, + color: Color.fromRGBO(116, 145, 253, 1), + ), + isScrollable: true, + labelColor: const Color.fromRGBO(45, 56, 76, 1), + indicatorSize: TabBarIndicatorSize.label, // 设置指示器高度和标签一样高 + onTap: onTap, + tabs: [ + const Tab(text: '全部'), + const Tab(text: '近一周'), + const Tab(text: '近一月'), + Tab(text: customTimeStr), + ], + ), + ); +} + +/// 已完成作业条件筛选栏 +@hwidget +Widget $completedJobConditionFilter(BuildContext context, + {required TabController controller, + required int jobType, + PickerDateRange? customTime, + required ValueChanged onJobTypeTap, + required Function(String? startTime, String? endTime) onTimeFilter}) { + List> jobTypes = [ + {'type': 1, 'name': '作业'}, + {'type': 2, 'name': '考试'} + ]; + var jobTypeState = useState(0); + var customTimeState = useState(null); + + useEffect(() { + if (jobTypeState.value != jobType) jobTypeState.value = jobType; + if (customTimeState.value != customTime) customTimeState.value = customTime; + + return () {}; + }, []); + + DateTime getWeekStartDate() { + DateTime now = DateTime.now(); + int dayOfWeek = now.weekday; // 获取今天是周几(1代表周一,7代表周日) + int diff = dayOfWeek - 1; // 计算今天距离周一的天数差 + if (diff < 0) { + diff += 7; // 如果是周日,则需要加上一周的天数 + } + return now.subtract(Duration(days: diff)); // 减去天数差,得到本周一的时间 + } + + DateTime getWeekEndDate() { + DateTime now = DateTime.now(); + int dayOfWeek = now.weekday; // 获取今天是周几 + int diff = 7 - dayOfWeek; // 计算今天距离周日的天数差 + if (diff == 0) { + diff = 7; // 如果是周日,则加上一周的天数 + } + return now.add(Duration(days: diff)); // 加上天数差减一,得到本周日的时间 + } + + DateTime getMonthStartDate() { + DateTime now = DateTime.now(); + return DateTime(now.year, now.month, 1); // 获取当前月份的第一天 + } + + DateTime getMonthEndDate() { + DateTime now = DateTime.now(); + int nextMonth = now.month + 1; + if (nextMonth > 12) { + nextMonth = 1; + now = now.add(Duration(days: 31 - now.day)); // 跨年了,所以加到当前月的最后一天 + } else { + now = now.add(Duration(days: DateTime(now.year, nextMonth, 0).day - now.day)); // 加到下个月的第一天的前一天,即本月最后一天 + } + return now; + } + + return Container( + height: 36.h, + padding: EdgeInsets.only(left: 4.w, right: 12.w), + decoration: BoxDecoration( + color: Color.fromRGBO(244, 244, 244, 1), + border: Border(bottom: BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 1)), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + $TheTabBar( + controller: controller, + customTime: customTimeState.value, + onTap: (int val) async { + switch (val) { + case 0: // 全部 + onTimeFilter(null, null); + break; + case 1: // 近一周 + onTimeFilter( + getWeekStartDate().toString().substring(0, 10), + getWeekEndDate().toString().substring(0, 10), + ); + break; + case 2: // 近一个月 + onTimeFilter( + getMonthStartDate().toString().substring(0, 10), + getMonthEndDate().toString().substring(0, 10), + ); + break; + default: // 自定义 + // DateTimeRange? range = await showDateRangePicker( + // // locale: const Locale('zh', 'CN'), + // locale: const Locale('zh', 'CN'), + // context: context, + // confirmText: '搜索', + // initialEntryMode: DatePickerEntryMode.calendarOnly, + // currentDate: DateTime.now(), + // firstDate: DateTime.now().subtract(const Duration(days: 4)), + // lastDate: DateTime.now().add(const Duration(days: 3)), + // ); + + var dialogData = await showDialog( + context: context, + builder: (BuildContext context1) { + return Center( + child: Container( + color: Colors.white, + width: isPad() ? ScreenUtil().screenWidth / 2 : ScreenUtil().screenWidth / 1.3, + height: ScreenUtil().screenHeight / 2, + child: SfDateRangePicker( + showActionButtons: true, + confirmText: '确定', + cancelText: '取消', + onSubmit: (p0) { + print(p0); + Navigator.of(context1).pop(p0); + }, + onCancel: () { + Navigator.of(context1).pop(); + }, + selectionMode: DateRangePickerSelectionMode.range, + initialSelectedRange: customTimeState.value, + ), + ), + ); + }); + // startDate: 2024-03-04 18:47:00.117958, endDate: 2024-03-11 18:47:00.117986 + // if (dialogData != null && (dialogData.startDate != null || dialogData.endDate != null)) {} + onTimeFilter( + dialogData?.startDate?.toString().substring(0, 10), + dialogData?.endDate?.toString().substring(0, 10), + ); + customTimeState.value = dialogData; + } + }, + ), + Expanded(child: SizedBox()), + Container( + width: 74.r, + margin: EdgeInsets.symmetric(vertical: 5.h), + padding: EdgeInsets.symmetric(horizontal: 10.r), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical( + top: Radius.elliptical(6, 6), + bottom: Radius.elliptical(6, 6), + ), + ), + child: DropdownButton( + icon: Icon(Icons.expand_more_outlined), + padding: EdgeInsets.zero, + // value: params2.jobType ?? 1, + value: jobType, + style: TextStyle(color: Color.fromRGBO(89, 89, 89, 1), fontSize: 12.sp), + underline: Container(), + isExpanded: true, + items: jobTypes.map((e) { + return DropdownMenuItem( + value: e['type'], + child: quickText(e['name'], size: 12.sp, color: Colors.black), + ); + }).toList(), + onChanged: (dynamic value) { + if (value != null) { + jobTypeState.value = value; + onJobTypeTap(value as int); + } + // jobTypeState + }, + ), + ) ], ), ); diff --git a/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart b/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart index 429bb86..3842766 100644 --- a/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart +++ b/marking_app/lib/pages/homework_correction/pages/job_list_participate_in_class.dart @@ -17,7 +17,9 @@ class JobListParticipateInClass extends StatefulWidget { final int jobId; final String jobName; final String genderName; - const JobListParticipateInClass({required this.jobId, required this.jobName, required this.genderName, super.key}); + final bool completed; + const JobListParticipateInClass( + {required this.jobId, required this.jobName, required this.genderName, this.completed = false, super.key}); @override State createState() => _JobListParticipateInClassState(); @@ -254,6 +256,9 @@ class _JobListParticipateInClassState extends State w // 查看作业报告 void jobViewReport(MarkingTasks task) {} + + /// 查看学生名单 + void showStudentList([bool submitted = false]) {} @override Widget build(BuildContext context) { return Scaffold( @@ -271,8 +276,31 @@ class _JobListParticipateInClassState extends State w ), body: MyFutureBuilder.buildFutureBuilderOfSingleInstance?>(context, _future, (value) { if (value == null) return Container(); + bool thePadTerminal = isPad(); + if (widget.completed) { + // 已完成 + if (thePadTerminal) + return TabletEndCompleted( + data: value, + genderName: widget.genderName, + bookmarks: bookmarks, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + ); - if (isPad()) + // 已完成手机端 + return MobileEndCompleted( + data: value, + genderName: widget.genderName, + bookmarks: bookmarks, + jobViewReport: jobViewReport, + quickDataCheck: quickDataCheck, + showStudentList: showStudentList, + ); + } + + // 未完成页面 + if (thePadTerminal) return TabletEnd( data: value, genderName: widget.genderName, @@ -299,7 +327,7 @@ class _JobListParticipateInClassState extends State w } } -/// 平板电脑端 +/// 平板电脑端(未完成) class TabletEnd extends StatelessWidget { final String genderName; final List data; @@ -332,7 +360,7 @@ class TabletEnd extends StatelessWidget { child: Wrap( spacing: 8.0.w, // 子元素之间的间距 runSpacing: 10.h, // 主轴方向上不同行之间的间距 - children: [...data, ...data, ...data] + children: data .map((e) => $ItemDataViewOfPad( task: e, bookmarks: bookmarks, @@ -349,6 +377,462 @@ class TabletEnd extends StatelessWidget { } } +/// 平板展示(已完成) +class TabletEndCompleted extends StatelessWidget { + final String genderName; + final List data; + + final Bookmarks bookmarks; // 收藏夹 + final JobViewReport jobViewReport; + final QuickDataCheck quickDataCheck; // 数据快查 + const TabletEndCompleted({ + required this.genderName, + required this.data, + + /// 方法 + required this.bookmarks, + required this.jobViewReport, + required this.quickDataCheck, + super.key, + }); + + @override + Widget build(BuildContext context) { + var padingEdg = EdgeInsets.only(left: 10.w, right: 10.w); + return Container( + width: ScreenUtil().screenWidth, + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 16.h), + child: GridView( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, //横轴三个子widget + mainAxisSpacing: 10.h, + crossAxisSpacing: 6.w, + childAspectRatio: 1.48 //宽高比为1时,子widget + ), + children: data.map((taskItem) { + return Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(6.r)), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 6.h), + alignment: Alignment.centerLeft, + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Color.fromRGBO(238, 238, 238, 1), width: 0.5.r)), + ), + child: quickText(taskItem.className, color: Color.fromRGBO(104, 136, 253, 1), size: 12.sp), + ), + Column( + mainAxisSize: MainAxisSize.min, + children: [ + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(76, 199, 147, 1), + percent: taskItem.objectivePrecision, + title: '客观题正确率:', + padingEdg: padingEdg, + fontSize: 8.sp, + lineHeight: 5.h, + marginEdg: EdgeInsets.only(top: 5.h), + ), + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(255, 190, 91, 1), + percent: taskItem.subjectivePrecision, + title: '主观题正确率:', + fontSize: 8.sp, + lineHeight: 5.h, + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 5.h), + ), + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(166, 139, 242, 1), + percent: taskItem.precision, + title: '总正确率:', + fontSize: 8.sp, + lineHeight: 5.h, + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 5.h), + ), + ], + ), + SizedBox(height: 4.h), + Padding( + padding: padingEdg, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(104, 136, 253, 1), + borderRadius: BorderRadius.circular(16.r), + child: InkWell( + onTap: () => easyThrottle('OneClickReview', () {}), + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 4.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.r), + ), + child: quickText('已提交(${taskItem.commitStudentCount})', size: 8.sp, color: Colors.white), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 4.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('数据快查', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 4.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + ], + ), + ), + SizedBox(height: 4.h), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.r), + bottomRight: Radius.circular(10.r), + ), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(0, 0, 0, 0.15), + offset: Offset(0, -0.0001), //阴影y轴偏移量 + blurRadius: 5, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Row(children: [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => quickDataCheck(taskItem)), + child: Container( + alignment: Alignment.center, + child: quickText('数据快查', color: Color.fromRGBO(79, 79, 79, 1), size: 11.sp), + ), + ), + ), + Container(width: 1.w, height: 26.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => jobViewReport(taskItem)), + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 10.sp), + ), + )), + ]), + ), + ], + ), + ); + }).toList(), + ), + ); + } +} + +/// 手机端(已完成) +class MobileEndCompleted extends StatelessWidget { + final String genderName; + final List data; + + final Bookmarks bookmarks; // 收藏夹 + final JobViewReport jobViewReport; // 查看报告 + final QuickDataCheck quickDataCheck; // 数据快查 + final ShowStudentList showStudentList; + + const MobileEndCompleted({ + required this.genderName, + required this.data, + + /// 方法 + required this.bookmarks, + required this.showStudentList, + required this.jobViewReport, + required this.quickDataCheck, + super.key, + }); + + @override + Widget build(BuildContext context) { + var padingEdg = EdgeInsets.only(left: 10.w, right: 10.w); + return ListView( + padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 16.h), + children: data.map((task) { + return Container( + padding: EdgeInsets.only(top: 11.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadiusDirectional.circular(10.r), + boxShadow: [BoxShadow(color: Color.fromRGBO(0, 0, 0, 0.15), blurRadius: 10)], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: padingEdg, + child: Row( + children: [ + quickText(genderName + task.className, color: Color.fromRGBO(0, 0, 0, 1), size: 14.sp), + Expanded(child: SizedBox()), + quickText('已交:${task.commitStudentCount}', color: Color.fromRGBO(104, 136, 253, 1), size: 12.sp), + SizedBox(width: 16.w), + quickText('未交:${task.studentCount - task.commitStudentCount}', + color: Color.fromRGBO(255, 86, 86, 1), size: 12.sp), + ], + ), + ), + SizedBox(height: 13.h), + Padding( + padding: padingEdg, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: task.isFinish + ? [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + Expanded(flex: 1, child: SizedBox()), + Expanded(flex: 3, child: SizedBox()), + ] + : [ + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(104, 136, 253, 1), + borderRadius: BorderRadius.circular(16.r), + child: InkWell( + onTap: () => easyThrottle('OneClickReview', () {}), + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20.r), + ), + child: quickText('一键批阅', size: 10.sp, color: Colors.white), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('数据快查', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + ), + ), + Expanded(flex: 1, child: SizedBox()), + Expanded( + flex: 3, + child: Material( + color: Color.fromRGBO(244, 244, 244, 1), + borderRadius: BorderRadius.circular(20.r), + child: InkWell( + onTap: () async {}, + borderRadius: BorderRadius.circular(8.r), + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5.h), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), + child: quickText('收藏夹(2)', size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)), + ), + ), + )), + ], + ), + ), + SizedBox(height: 13.h), + Padding( + padding: padingEdg, + child: Row( + children: [ + Expanded( + child: LinearPercentIndicator( + padding: EdgeInsets.zero, + animation: true, + lineHeight: 8.h, + animationDuration: 2500, + + percent: task.progressPercentage / 100, + // center: Text( + // '${getDoubleRemoveZero(jobTaskClassItem.progressPercentage)}%', + // style: TextStyle(color: Colors.white, fontSize: 8.sp), + // ), + linearGradient: LinearGradient( + tileMode: TileMode.mirror, + stops: [0.0, 1.0], + colors: task.progressPercentage / 100 != 1 + ? [Theme.of(context).primaryColor.withOpacity(0.1), Theme.of(context).primaryColor] + : [ + Color.fromRGBO(144, 224, 190, 1).withOpacity(0.1), + Color.fromRGBO(144, 224, 190, 1), + ], + ), + // linearStrokeCap: LinearStrokeCap.butt, + // progressColor: Theme.of(context).primaryColor, + backgroundColor: Color.fromRGBO(232, 232, 232, 1), + barRadius: Radius.circular(10.r), + ), + ), + SizedBox(width: 7.w), + quickText('${getDoubleRemoveZero(task.progressPercentage)}%', + size: 10.sp, color: Color.fromRGBO(70, 70, 70, 1)) + ], + ), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(76, 199, 147, 1), + percent: task.objectivePrecision, + title: '客观题正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(255, 190, 91, 1), + percent: task.subjectivePrecision, + title: '主观题正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + if (task.isFinish) + $CompletedHomeworkProgressBar( + color: Color.fromRGBO(166, 139, 242, 1), + percent: task.precision, + title: '总正确率:', + padingEdg: padingEdg, + marginEdg: EdgeInsets.only(top: 8.h), + ), + SizedBox(height: 13.h), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(10.r), + bottomRight: Radius.circular(10.r), + ), + color: Colors.white, + boxShadow: [ + BoxShadow( + color: const Color.fromRGBO(0, 0, 0, 0.15), + offset: Offset(0, -0.0001), //阴影y轴偏移量 + blurRadius: 5, //阴影模糊程度 + spreadRadius: 0, //阴影扩散程度 + ) + ], + ), + child: Row( + children: task.isFinish + ? [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () => quickDataCheck(task)), + child: Container( + alignment: Alignment.center, + child: quickText('数据快查', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), + ), + ), + ), + Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => jobViewReport(task)), + child: Container( + alignment: Alignment.center, + child: quickText('查看报告', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ] + : [ + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_review_homework', () {}), + child: Container( + alignment: Alignment.center, + child: quickText('批阅', color: Color.fromRGBO(79, 79, 79, 1), size: 13.sp), + ), + ), + ), + Container(width: 1.w, height: 32.h, color: Color.fromRGBO(221, 221, 221, 1)), + Expanded( + child: InkWell( + onTap: () => easyThrottle('go_to_end_review_homework', () => {}), + child: Container( + alignment: Alignment.center, + child: quickText('结束批阅', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp), + ), + )), + ], + ), + ), + ], + )); + }).toList(), + ); + } +} + /// 移动端 class MobileEnd extends StatelessWidget { final String genderName; @@ -991,3 +1475,11 @@ typedef Bookmarks = void Function(MarkingTasks); /// 查看作业报告 typedef JobViewReport = void Function(MarkingTasks); + +/// 展示学生名单 +typedef ShowStudentList = void Function([bool submitted]); + +/// 查看学生名单 +// void showStudentList([bool submitted = false]) { + +// } diff --git a/marking_app/lib/pages/marking/index.dart b/marking_app/lib/pages/marking/index.dart index 9800ff3..612e3f7 100644 --- a/marking_app/lib/pages/marking/index.dart +++ b/marking_app/lib/pages/marking/index.dart @@ -10,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:marking_app/common/config/request_config.dart'; @@ -21,8 +20,6 @@ import 'package:marking_app/common/model/event_bus/marking_statistics_bus.dart'; import 'package:marking_app/common/model/marking/marking_statistics.dart'; import 'package:marking_app/pages/common/event_bus_mixin.dart'; import 'package:marking_app/provider/review_provider.dart'; -import 'package:marking_app/utils/anti_shake_throttling.dart'; -import 'package:marking_app/utils/index.dart'; import 'package:marking_app/utils/request/rest_client.dart'; import 'package:marking_app/common/model/common/base_page_data.dart'; import 'package:marking_app/common/model/marking/marking_item.dart'; diff --git a/marking_app/lib/routes/RouterManager.dart b/marking_app/lib/routes/RouterManager.dart index a75d82d..e98c78b 100644 --- a/marking_app/lib/routes/RouterManager.dart +++ b/marking_app/lib/routes/RouterManager.dart @@ -251,26 +251,27 @@ class RouterManager { int jobId = int.parse(params['jobId']![0]); String jobName = params['jobName']![0]; String genderName = params['genderName']![0]; - - return JobListParticipateInClass(jobId: jobId, jobName: jobName, genderName: genderName); + // ignore: sdk_version_since + bool completed = bool.parse(params['completed']?[0] ?? 'false'); + return JobListParticipateInClass(jobId: jobId, jobName: jobName, genderName: genderName, completed: completed); }, ); // 数据快查 static final _quickDataCheckPageHandler = Handler( - handlerFunc: (BuildContext? context, Map> params){ + handlerFunc: (BuildContext? context, Map> params) { int jobId = int.parse(params['jobId']![0]); String className = params['className']![0]; - return QuickDataCheckPage(jobId: jobId,className:className); + return QuickDataCheckPage(jobId: jobId, className: className); }, ); // 数据快查-个人信息 static final _quickCheckPersonalPageHandler = Handler( - handlerFunc: (BuildContext? context, Map> params){ + handlerFunc: (BuildContext? context, Map> params) { int jobId = int.parse(params['jobId']![0]); int studentId = int.parse(params['studentId']![0]); - return QuickCheckPersonal(jobId: jobId,studentId:studentId); + return QuickCheckPersonal(jobId: jobId, studentId: studentId); }, ); // 开始阅卷页面 @@ -310,7 +311,8 @@ class RouterManager { router.define(jobListParticipateInClassPath, handler: _jobListParticipateInClassHandler, transitionType: TransitionType.material); router.define(quickDataCheckPath, handler: _quickDataCheckPageHandler, transitionType: TransitionType.material); - router.define(quickCheckPersonalPath, handler: _quickCheckPersonalPageHandler, transitionType: TransitionType.material); + router.define(quickCheckPersonalPath, + handler: _quickCheckPersonalPageHandler, transitionType: TransitionType.material); // getTransition() diff --git a/marking_app/pubspec.yaml b/marking_app/pubspec.yaml index 92c49cc..5cebb4e 100644 --- a/marking_app/pubspec.yaml +++ b/marking_app/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: "none" # Remove this line if you wish to publish to pub.dev +publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -18,7 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.87 environment: - sdk: ">=2.17.1 <3.0.0" + sdk: '>=2.17.1 <3.0.0' # Dependencies specify other packages that your package needs in order to woyrk. # To automatically upgrade your package dependencies to the latest versions @@ -29,7 +29,8 @@ environment: dependencies: flutter: sdk: flutter - + flutter_localizations: + sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 @@ -39,7 +40,7 @@ dependencies: # easy_refresh: ^3.3.2+1 retrofit: ^3.3.1 logger: ^1.1.0 - + flutter_lints: ^2.0.0 fluttertoast: ^8.2.3 json_annotation: ^4.8.1 @@ -60,7 +61,6 @@ dependencies: permission_handler: ^11.0.1 flutter_widget_from_html_core: ^0.10.3 - # 事件总线 event_bus: ^2.0.0 image_picker: ^0.8.6 @@ -108,6 +108,7 @@ dependencies: badges: ^3.1.2 horizontal_data_table: ^4.1.1 data_table_2: ^2.5.10 + syncfusion_flutter_datepicker: ^21.2.4 dev_dependencies: flutter_test: @@ -117,16 +118,13 @@ dev_dependencies: json_serializable: ^6.3.1 # 分离样式 functional_widget: ^0.10.1 - - + # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - - # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec