no message

This commit is contained in:
1147192855@qq.com 2024-03-06 18:15:43 +08:00
parent 39d0686b91
commit e1db8ae9b9
9 changed files with 555 additions and 662 deletions

View File

@ -15,15 +15,16 @@ class RequestConfig {
static const devLoginBaseUrl = "http://192.168.2.9:6400"; // static const devLoginBaseUrl = "http://192.168.2.9:6400"; //
static const devBaseUrlOfReport = "http://192.168.2.9:4000"; // */ static const devBaseUrlOfReport = "http://192.168.2.9:4000"; // */
static const devBaseUrl = "https://mk-hw.23544.com"; // static const devBaseUrl = "https://mhw.qwit.top"; //
static const devLoginBaseUrl = "https://mk-hw.23544.com"; // static const devLoginBaseUrl = "https://mhw.qwit.top"; //
static const devBaseUrlOfReport = "https://dc-api.23544.com"; // static const devBaseUrlOfReport = "https://mhw.qwit.top"; //
static const proBaseUrlOfHomework = "https://mhw.qwit.top/hw"; //
/* 正式地址 */ /* 正式地址 */
static const proBaseUrl = "https://mk-hw.23544.com"; // static const proBaseUrl = "https://mk-hw.23544.com"; //
static const proLoginBaseUrl = "https://mk-hw.23544.com"; // static const proLoginBaseUrl = "https://mk-hw.23544.com"; //
static const proBaseUrlOfReport = "https://dc-api.23544.com"; // static const proBaseUrlOfReport = "https://dc-api.23544.com"; //
static const proBaseUrlOfHomework = "https://mk-hw.23544.com/hw"; // // static const proBaseUrlOfHomework = "https://mk-hw.23544.com/hw"; //
static const hwProxyKeywords = "/hw"; // static const hwProxyKeywords = "/hw"; //

View File

@ -0,0 +1,10 @@
//
enum JobMarkingTypeEnum {
UNUSED(name: '未使用废弃', indexValue: 0),
JOB(name: '作业', indexValue: 1),
EXAMINATION(name: '考试', indexValue: 2);
const JobMarkingTypeEnum({required this.name, required this.indexValue});
final String name;
final int indexValue;
}

View File

@ -1,4 +1,5 @@
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:marking_app/common/model/enum/job_marking_type_enum.dart';
part 'job_task_item.g.dart'; part 'job_task_item.g.dart';
@ -40,8 +41,8 @@ class JobTaskItem extends Object {
@JsonKey(name: 'precision') @JsonKey(name: 'precision')
double precision; double precision;
@JsonKey(name: 'markingTasks') // @JsonKey(name: 'markingTasks')
List<MarkingTasks> markingTasks; // List<MarkingTasks> markingTasks;
@JsonKey(name: 'createTime') @JsonKey(name: 'createTime')
String createTime; String createTime;
@ -49,6 +50,12 @@ class JobTaskItem extends Object {
@JsonKey(name: 'progressPercentage') @JsonKey(name: 'progressPercentage')
double progressPercentage; // double progressPercentage; //
@JsonKey(name: 'markingType')
int markingType; //
@JsonKey(name: 'markingTypeEnum')
JobMarkingTypeEnum markingTypeEnum; //
JobTaskItem( JobTaskItem(
this.id, this.id,
this.title, this.title,
@ -62,10 +69,11 @@ class JobTaskItem extends Object {
this.objectivePrecision, this.objectivePrecision,
this.subjectivePrecision, this.subjectivePrecision,
this.precision, this.precision,
this.markingTasks, // this.markingTasks,
this.createTime, { this.createTime,
this.progressPercentage = 0, this.markingType,
}) { {this.progressPercentage = 0,
this.markingTypeEnum = JobMarkingTypeEnum.UNUSED}) {
try { try {
progressPercentage = (finishCount / totalCount) * 100; progressPercentage = (finishCount / totalCount) * 100;
if (progressPercentage.isNaN) { if (progressPercentage.isNaN) {
@ -76,6 +84,11 @@ class JobTaskItem extends Object {
} catch (e) { } catch (e) {
progressPercentage = 0; progressPercentage = 0;
} }
try {
markingTypeEnum = JobMarkingTypeEnum.values[this.markingType];
} catch (e) {
markingTypeEnum = JobMarkingTypeEnum.UNUSED;
}
} }
factory JobTaskItem.fromJson(Map<String, dynamic> srcJson) => _$JobTaskItemFromJson(srcJson); factory JobTaskItem.fromJson(Map<String, dynamic> srcJson) => _$JobTaskItemFromJson(srcJson);

View File

@ -46,30 +46,29 @@ class HomeworkTasksViewItem extends StatelessWidget with CommonMixin {
/// @param {bool} className /// @param {bool} className
/// @param {bool} submitted () /// @param {bool} submitted ()
Future<void> showStudents( Future<void> showStudents(
BuildContext context, BuildContext context, [
List<int> taskIds, [
bool? submitted = false, bool? submitted = false,
String? className, String? className,
]) async { ]) async {
ToastUtils.showLoading(); ToastUtils.showLoading();
List<JobConcernedWithStudent> students = []; List<JobConcernedWithStudent> students = [];
try { // try {
RestClient _client = await getClient(); // RestClient _client = await getClient();
BaseStructureResult<List<JobConcernedWithStudent>> _result = await _client.getJobWithStudents( // BaseStructureResult<List<JobConcernedWithStudent>> _result = await _client.getJobWithStudents(
JobConcernedWithStudentParams(taskIds, isCommit: submitted), // JobConcernedWithStudentParams(taskIds, isCommit: submitted),
); // );
if (!_result.success) { // if (!_result.success) {
return ToastUtils.showError(_result.message ?? '获取学生列表失败'); // return ToastUtils.showError(_result.message ?? '获取学生列表失败');
} // }
if (_result.data?.isEmpty ?? true) { // if (_result.data?.isEmpty ?? true) {
return ToastUtils.showError('获取到的学生列表为空'); // return ToastUtils.showError('获取到的学生列表为空');
} // }
students = _result.data!; // students = _result.data!;
} catch (e) { // } catch (e) {
return ToastUtils.showError('获取学生列表失败'); // return ToastUtils.showError('获取学生列表失败');
} finally { // } finally {
ToastUtils.dismiss(); // ToastUtils.dismiss();
} // }
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
@ -125,28 +124,19 @@ class HomeworkTasksViewItem extends StatelessWidget with CommonMixin {
); );
} }
void oneClickReview(int taskId) async {
try {
ToastUtils.showLoading();
RestClient _client = await getClient();
BaseStructureResult<bool> res = await _client.toJobOneClickReview(taskId);
if (res.success) return call();
ToastUtils.showError(res.message ?? '操作失败');
} catch (e) {
} finally {
ToastUtils.dismiss();
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return completed return completed
? $CompletedHomeworkView(jobTaskItem: jobTaskItem, showStudentsCall: showStudents) ? $CompletedHomeworkView(jobTaskItem: jobTaskItem, showStudentsCall: showStudents)
: $UnfinishedHomework( : InkWell(
jobTaskItem: jobTaskItem, onTap: () {
refreshCallback: call, String url =
endReviewCallback: endReview, '${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}';
oneClickReviewCallback: oneClickReview, RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value != null && value == true) call();
});
},
child: $UnfinishedHomework(jobTaskItem: jobTaskItem),
); );
} }
} }
@ -244,7 +234,6 @@ Widget $completedHomeworkView(BuildContext context,
precision: jobTaskItem.precision / 100, precision: jobTaskItem.precision / 100,
objectivePrecision: jobTaskItem.objectivePrecision / 100, objectivePrecision: jobTaskItem.objectivePrecision / 100,
subjectivePrecision: jobTaskItem.subjectivePrecision / 100, subjectivePrecision: jobTaskItem.subjectivePrecision / 100,
taskIds: jobTaskItem.markingTasks.map((e) => e.id).toList(),
), ),
InkWell( InkWell(
onTap: () { onTap: () {
@ -277,55 +266,7 @@ Widget $completedHomeworkView(BuildContext context,
Expanded(flex: 1, child: SizedBox()), Expanded(flex: 1, child: SizedBox()),
], ],
), ),
), )
SizedBox(height: 10.h),
ExpansionTile(
tilePadding: EdgeInsets.only(right: 10.w, bottom: 0),
title: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
// badges.Badge(
// position: badges.BadgePosition.topEnd(top: -3.r, end: -12.r),
// badgeStyle: BadgeStyle(badgeColor: Theme.of(context).primaryColor.withOpacity(0.7)),
// badgeContent: Text(
// jobTaskItem.markingTasks.length.toString(),
// style: TextStyle(color: Colors.white, fontSize: 10.sp),
// ),
// child: quickText('班级列表 ', size: 17.sp),
// ),
badges.Badge(
badgeStyle: badges.BadgeStyle(
shape: badges.BadgeShape.square,
borderRadius: BorderRadius.circular(5.r),
padding: EdgeInsets.all(2.r),
badgeGradient: badges.BadgeGradient.linear(
colors: [
Colors.purple,
Colors.blue,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
position: badges.BadgePosition.topEnd(top: -2.r, end: -8.r),
badgeContent: Text(
jobTaskItem.markingTasks.length.toString(),
style: TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold),
),
child: quickText('班级列表 ', size: 17.sp),
),
],
),
childrenPadding: EdgeInsets.only(top: 0.h),
children: jobTaskItem.markingTasks.map((e) {
return $CompletedHomeworkChildView(
jobTaskItem: jobTaskItem,
taskItem: e,
showStudentsCall: showStudentsCall,
);
}).toList(),
),
], ],
), ),
); );
@ -364,7 +305,6 @@ Widget $completedHomeworkChildView(
submittedQuantity: taskItem.commitStudentCount, submittedQuantity: taskItem.commitStudentCount,
unsubmittedQuantity: taskItem.studentCount - taskItem.commitStudentCount, unsubmittedQuantity: taskItem.studentCount - taskItem.commitStudentCount,
showStudentsCall: showStudentsCall, showStudentsCall: showStudentsCall,
taskIds: [taskItem.id],
className: taskItem.className, className: taskItem.className,
), ),
], ],
@ -375,7 +315,6 @@ Widget $completedHomeworkChildView(
@swidget @swidget
Widget $completedHomeworkBtn( Widget $completedHomeworkBtn(
BuildContext context, { BuildContext context, {
required List<int> taskIds,
required int submittedQuantity, required int submittedQuantity,
required int unsubmittedQuantity, required int unsubmittedQuantity,
required ShowStudentsCall showStudentsCall, required ShowStudentsCall showStudentsCall,
@ -391,7 +330,7 @@ Widget $completedHomeworkBtn(
child: InkWell( child: InkWell(
onTap: () { onTap: () {
if (unsubmittedQuantity <= 0) return ToastUtils.showInfo('没有未提交的作业'); if (unsubmittedQuantity <= 0) return ToastUtils.showInfo('没有未提交的作业');
showStudentsCall(context, taskIds, false, className); showStudentsCall(context, false, className);
}, },
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
child: Container( child: Container(
@ -413,7 +352,7 @@ Widget $completedHomeworkBtn(
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
if (submittedQuantity <= 0) return ToastUtils.showInfo('没有已提交的作业'); if (submittedQuantity <= 0) return ToastUtils.showInfo('没有已提交的作业');
showStudentsCall(context, taskIds, true, className); showStudentsCall(context, true, className);
}, },
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
child: Container( child: Container(
@ -511,7 +450,6 @@ Widget $completedHomeworkProgressBar(
@swidget @swidget
Widget $completedHomeworkInfoBox( Widget $completedHomeworkInfoBox(
BuildContext context, { BuildContext context, {
required List<int> taskIds,
required int unsubmittedQuantity, required int unsubmittedQuantity,
required int submittedQuantity, required int submittedQuantity,
required double objectivePrecision, // required double objectivePrecision, //
@ -524,7 +462,6 @@ Widget $completedHomeworkInfoBox(
return Column( return Column(
children: [ children: [
$CompletedHomeworkBtn( $CompletedHomeworkBtn(
taskIds: taskIds,
className: className, className: className,
unsubmittedQuantity: unsubmittedQuantity, unsubmittedQuantity: unsubmittedQuantity,
submittedQuantity: submittedQuantity, submittedQuantity: submittedQuantity,
@ -557,13 +494,7 @@ Widget $completedHomeworkInfoBox(
// view // view
@swidget @swidget
Widget $unfinishedHomework( Widget $unfinishedHomework(BuildContext context, {required JobTaskItem jobTaskItem}) {
BuildContext context, {
required JobTaskItem jobTaskItem,
required VoidCallback refreshCallback,
required EndReviewCall endReviewCallback,
required Function(int) oneClickReviewCallback,
}) {
return Stack( return Stack(
alignment: const FractionalOffset(0.95, 0), alignment: const FractionalOffset(0.95, 0),
children: [ children: [
@ -599,7 +530,9 @@ Widget $unfinishedHomework(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.only(left: 2.w), padding: EdgeInsets.only(left: 2.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromRGBO(104, 136, 253, 1), color: jobTaskItem.markingTypeEnum.name == '作业'
? const Color.fromRGBO(104, 136, 253, 1)
: const Color.fromRGBO(255, 175, 56, 1),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(18.r), topLeft: Radius.circular(18.r),
topRight: Radius.circular(3.r), topRight: Radius.circular(3.r),
@ -608,7 +541,7 @@ Widget $unfinishedHomework(
), ),
), ),
margin: EdgeInsets.only(right: 4.w), margin: EdgeInsets.only(right: 4.w),
child: quickText('作业', color: Colors.white, size: 10.sp), child: quickText(jobTaskItem.markingTypeEnum.name, color: Colors.white, size: 10.sp),
), ),
quickText( quickText(
jobTaskItem.title, jobTaskItem.title,
@ -653,50 +586,6 @@ Widget $unfinishedHomework(
), ),
], ],
), ),
//
$UnfinishedBtn(
isChild: false,
jobTaskItem: jobTaskItem,
endCallback: endReviewCallback,
refreshcall: refreshCallback,
),
SizedBox(height: 20.h),
ExpansionTile(
tilePadding: EdgeInsets.only(right: 10.w),
title: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
badges.Badge(
badgeStyle: badges.BadgeStyle(
shape: badges.BadgeShape.square,
borderRadius: BorderRadius.circular(5.r),
padding: EdgeInsets.all(2.r),
badgeGradient: badges.BadgeGradient.linear(
colors: [Colors.purple, Colors.blue],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
position: badges.BadgePosition.topEnd(top: -2.r, end: -8.r),
badgeContent: Text(
jobTaskItem.markingTasks.length.toString(),
style: TextStyle(color: Colors.white, fontSize: 10, fontWeight: FontWeight.bold),
),
child: quickText('班级列表 ', size: 17.sp),
),
],
),
children: jobTaskItem.markingTasks.map((e) {
return $UnfinishedClassItem(
jobTaskItem: jobTaskItem,
jobTaskClassItem: e,
endReviewCallback: endReviewCallback,
refreshCallback: refreshCallback,
oneClickReviewCallback: oneClickReviewCallback,
);
}).toList(),
),
], ],
), ),
), ),
@ -752,500 +641,9 @@ Widget $unfinishedHomework(
); );
} }
// ()
@swidget
Widget $unfinishedBtn(
BuildContext context, {
required JobTaskItem jobTaskItem,
required VoidCallback refreshcall,
required EndReviewCall endCallback,
MarkingTasks? jobTaskClassItem,
bool isChild = true,
}) {
if (!isChild) {
MarkingTasks? theCanReviewChild = jobTaskItem.markingTasks.firstWhereOrNull((e) => e.canGoReview);
List<MarkingTasks> canEndTaskChilds = jobTaskItem.markingTasks.where((e) => !e.isFinish && e.canMarking).toList();
return Container(
margin: EdgeInsets.only(top: 22.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
flex: 2,
child: Material(
color: theCanReviewChild != null ? Colors.white : Colors.grey[300],
borderRadius: BorderRadius.circular(30.r),
child: InkWell(
onTap: () {
MarkingTasks? markingTask =
jobTaskItem.markingTasks.firstWhereOrNull((e) => e.canMarking && e.totalCount > 0 && !e.isFinish);
if (markingTask == null) {
ToastUtils.showInfo('没有找到可以批阅的任务');
// AchievementView(
// elevation: 0.5,
// duration: Duration(seconds: 1),
// title: "提示",
// subTitle: "没有找到可以批阅的任务",
// color: Theme.of(context).primaryColor,
// ).show(context);
return;
}
String url =
'${RouterManager.markingHomeworkDoPath}?taskId=${markingTask.id}&jobId=${jobTaskItem.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + markingTask.className)}';
RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value != null && value == true) refreshcall();
});
},
borderRadius: BorderRadius.circular(30.r),
child: Container(
height: 36.h,
padding: EdgeInsets.symmetric(vertical: 3.h),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.r),
border: Border.all(color: Theme.of(context).primaryColor),
),
child: quickText('批阅', color: Theme.of(context).primaryColor, size: 14.sp),
),
),
),
),
Expanded(
flex: 1,
child: SizedBox(width: 5.w),
),
Expanded(
flex: 2,
child: Material(
color: canEndTaskChilds.isNotEmpty ? Color.fromRGBO(104, 136, 253, 1) : Colors.grey,
borderRadius: BorderRadius.circular(30.r),
child: InkWell(
onTap: () async {
List<MarkingTasks> childTasks =
jobTaskItem.markingTasks.where((e) => !e.isFinish && e.canMarking).toList();
if (childTasks.isEmpty) return ToastUtils.showInfo('没有可以结束的任务');
//
List<MarkingTasks> incompleteTasks = childTasks.where((e) => e.finishCount < e.totalCount).toList();
if (incompleteTasks.isNotEmpty) {
var continueFlag = await showDialog<bool>(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('未完成批阅提示'),
content: Text('当前批阅任务未完成,请确认需要结束此任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop(false);
},
),
TextButton(
child: Text(''),
onPressed: () {
Navigator.of(context1).pop(true);
},
),
],
);
},
);
if (continueFlag == null || !continueFlag) {
return;
}
}
showDialog(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('提示'),
content: Text('确认完成以下${childTasks.map((e) => e.className).toList().join(",")}的批阅任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop();
},
),
TextButton(
child: Text('确定'),
onPressed: () async {
try {
bool result = await endCallback(childTasks);
if (result) refreshcall();
} catch (e) {
} finally {
ToastUtils.dismiss();
Navigator.of(context1).pop();
}
},
),
],
);
},
);
},
borderRadius: BorderRadius.circular(30.r),
child: Container(
height: 36.h,
padding: EdgeInsets.symmetric(vertical: 3.5.h),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.r),
),
child: quickText('结束批阅', size: 14.sp, color: Colors.white),
),
),
),
),
],
),
);
}
if (!jobTaskClassItem!.canMarking)
return Container(
alignment: Alignment.centerRight,
child: jobTaskClassItem.isFinish
? Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(jobTaskClassItem.finishTime?.substring(0, 16),
size: 10.sp, color: Color.fromRGBO(170, 170, 170, 1)),
SizedBox(width: 4.w),
quickText('已批阅', size: 10.sp, color: Theme.of(context).primaryColor),
],
)
: quickText(
'待批阅',
size: 10.sp,
color: Color.fromRGBO(255, 138, 0, 1),
),
);
return Container(
child: jobTaskClassItem.isFinish
? Row(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(jobTaskClassItem.finishTime?.substring(0, 16),
size: 12.sp, color: Color.fromRGBO(170, 170, 170, 1)),
SizedBox(width: 4.w),
quickText('已批阅', size: 13.sp, color: Theme.of(context).primaryColor),
],
)
: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
flex: 5,
child: Material(
color: jobTaskClassItem.canGoReview ? Colors.white : Colors.grey[300],
borderRadius: BorderRadius.circular(4.r),
child: InkWell(
onTap: () {
if (jobTaskClassItem.totalCount <= 0) {
return ToastUtils.showInfo('没有找到可以批阅的任务');
}
if (!jobTaskClassItem.canMarking) {
return AchievementView(
elevation: 0.5,
duration: Duration(seconds: 1),
title: "提示",
subTitle: "此账号无法批阅该任务",
color: Theme.of(context).primaryColor,
).show(context);
}
if (jobTaskClassItem.isFinish) {
return AchievementView(
elevation: 0.5,
duration: Duration(seconds: 1),
title: "提示",
subTitle: "此批阅任务已完成",
color: Theme.of(context).primaryColor,
).show(context);
}
String url =
'${RouterManager.markingHomeworkDoPath}?taskId=${jobTaskClassItem.id}&jobId=${jobTaskItem.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + jobTaskClassItem.className)}';
RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value == true) refreshcall();
});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
border: Border.all(color: Theme.of(context).primaryColor),
),
child: quickText('批阅', color: Theme.of(context).primaryColor, size: 12.sp),
),
),
)),
Expanded(flex: 1, child: SizedBox()),
Expanded(
flex: 5,
child: Material(
color: !jobTaskClassItem.isFinish && jobTaskClassItem.canMarking
? Color.fromRGBO(237, 240, 255, 1)
: Colors.grey,
borderRadius: BorderRadius.circular(4.r),
child: InkWell(
onTap: () async {
if (!jobTaskClassItem.canMarking) return ToastUtils.showInfo('此任务非该账号任务');
if (jobTaskClassItem.isFinish) return ToastUtils.showInfo('此任务已经结束');
//
if (jobTaskClassItem.finishCount < jobTaskClassItem.totalCount) {
var continueFlag = await showDialog<bool>(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('未完成批阅提示'),
content: Text('当前批阅任务未完成,请确认需要结束此任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop(false);
},
),
TextButton(
child: Text(''),
onPressed: () {
Navigator.of(context1).pop(true);
},
),
],
);
},
);
if (continueFlag == null || !continueFlag) {
return;
}
}
showDialog(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('提示'),
content: Text('确认完成当前${jobTaskClassItem.className}批阅任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop();
},
),
TextButton(
child: Text('确定'),
onPressed: () async {
try {
bool result = await endCallback([jobTaskClassItem]);
if (result) refreshcall();
} catch (e) {
} finally {
ToastUtils.dismiss();
Navigator.of(context1).pop();
}
},
),
],
);
},
);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
border: Border.all(color: Color.fromRGBO(130, 156, 255, 1)),
),
child: quickText('结束批阅', size: 12.sp, color: Color.fromRGBO(104, 136, 253, 1)),
),
),
)),
],
),
);
}
// view
@swidget
Widget $unfinishedClassItem(
BuildContext context, {
required JobTaskItem jobTaskItem,
required MarkingTasks jobTaskClassItem,
required VoidCallback refreshCallback,
required EndReviewCall endReviewCallback,
required Function(int) oneClickReviewCallback,
}) {
return Container(
padding: EdgeInsets.only(bottom: 14.w),
margin: EdgeInsets.only(bottom: 20.h),
decoration: BoxDecoration(border: Border(bottom: BorderSide(color: Color.fromRGBO(233, 233, 233, 1), width: 1.r))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Expanded(
child: quickText(jobTaskItem.genderName + jobTaskClassItem.className,
color: Color.fromRGBO(255, 123, 1, 1), size: 14.sp)),
if (!jobTaskClassItem.isFinish)
Expanded(
child: Container(
child: Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.r),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(104, 136, 253, 1),
spreadRadius: 0.5,
blurRadius: 1,
offset: Offset(0, 0),
),
],
),
child: LinearPercentIndicator(
padding: EdgeInsets.zero,
animation: true,
lineHeight: 10.h,
animationDuration: 2500,
percent: jobTaskClassItem.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: [
Theme.of(context).primaryColor.withOpacity(0.1),
Theme.of(context).primaryColor,
],
),
// linearStrokeCap: LinearStrokeCap.butt,
// progressColor: Theme.of(context).primaryColor,
backgroundColor: Colors.white,
barRadius: Radius.circular(10.r),
),
),
),
SizedBox(width: 4.w),
quickText('${getDoubleRemoveZero(jobTaskClassItem.progressPercentage)}%',
size: 10.sp, color: Color.fromRGBO(104, 136, 253, 1))
],
),
),
),
],
),
SizedBox(height: 14.h),
Container(
child: Row(
children: [
Expanded(
child: Row(children: [
quickText('题量:${jobTaskClassItem.totalCount}'),
SizedBox(width: 20.w),
quickText(jobTaskClassItem.teacherName)
])),
Expanded(
child: $UnfinishedBtn(
jobTaskItem: jobTaskItem,
jobTaskClassItem: jobTaskClassItem,
endCallback: endReviewCallback,
refreshcall: refreshCallback,
),
),
],
),
),
if (jobTaskClassItem.canGoReview) SizedBox(height: 6.h),
if (jobTaskClassItem.canGoReview)
Material(
borderRadius: BorderRadius.circular(30.r),
child: InkWell(
onTap: () => easyThrottle('OneClickReview', () async {
var continueFlag = await showDialog<bool>(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('一键批阅'),
content: Text('一键批阅后,默认学生答题结果全部正确,是否进行此操作?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop(false);
},
),
TextButton(
child: Text(''),
onPressed: () {
Navigator.of(context1).pop(true);
},
),
],
);
},
);
if (continueFlag == null || !continueFlag) return;
oneClickReviewCallback(jobTaskClassItem.id);
}),
borderRadius: BorderRadius.circular(30.r),
child: Container(
height: 20.h,
constraints: BoxConstraints(minWidth: 50.w, maxWidth: 60.w),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30.r),
border: Border.all(color: Color.fromRGBO(76, 199, 147, 1)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
quickText('一键批阅', color: Color.fromRGBO(76, 199, 147, 1), size: 10.sp),
Padding(
padding: EdgeInsets.only(top: 1.1.h),
child: Icon(Icons.arrow_forward_ios, size: 8.sp, color: Color.fromRGBO(76, 199, 147, 1)),
),
],
),
),
),
),
],
),
);
}
typedef EndReviewCall = Future<bool> Function(List<MarkingTasks> markingTasks); typedef EndReviewCall = Future<bool> Function(List<MarkingTasks> markingTasks);
typedef ShowStudentsCall = Future<void> Function( typedef ShowStudentsCall = Future<void> Function(
BuildContext context, BuildContext context, [
List<int> taskIds, [
bool? submitted, bool? submitted,
String? className, String? className,
]); ]);

View File

@ -167,6 +167,7 @@ class _HomeworkCorrectionState extends ConsumerState<HomeworkCorrection>
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
padding: EdgeInsets.only(bottom: 9.h, top: 4.h), padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
@ -254,7 +255,10 @@ class _HomeworkCorrectionState extends ConsumerState<HomeworkCorrection>
), ),
Expanded( Expanded(
flex: 1, flex: 1,
child: SizedBox(), child: InkWell(
onTap: () {},
child: Icon(Icons.settings_outlined, color: Color.fromRGBO(44, 48, 63, 1), size: 24.sp),
),
), ),
], ],
), ),

View File

@ -0,0 +1,447 @@
import 'package:achievement_view/achievement_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/common/mixin/common.dart';
import 'package:marking_app/common/model/common/base_structure_result.dart';
import 'package:marking_app/common/model/job/job_task_item.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/my_future_builder.dart';
import 'package:marking_app/utils/my_text.dart';
import 'package:marking_app/utils/request/rest_client.dart';
import 'package:percent_indicator/linear_percent_indicator.dart';
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});
@override
State<JobListParticipateInClass> createState() => _JobListParticipateInClassState();
}
class _JobListParticipateInClassState extends State<JobListParticipateInClass> with CommonMixin {
late Future<List<MarkingTasks>?> _future;
bool isRefresh = false;
@override
void initState() {
// TODO: implement initState
super.initState();
_future = getData();
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
}
Future<List<MarkingTasks>?> getData() async {
RestClient _client = await getClient();
BaseStructureResult<List<MarkingTasks>> _result = await _client.getJobListParticipateInClass(widget.jobId);
return _result.data;
}
//
Future<bool> endReview(List<MarkingTasks> markingTasks) async {
try {
ToastUtils.showLoading();
RestClient client = await getClient();
BaseStructureResult res = await client.toEndReviewJob(markingTasks.map((e) => e.id).toList());
if (!res.success) ToastUtils.showError('结束失败,请重试');
return res.success;
} catch (e) {
ToastUtils.showError('结束失败,请重试');
return false;
}
}
void oneClickReview(int taskId) async {
try {
ToastUtils.showLoading();
RestClient _client = await getClient();
BaseStructureResult<bool> res = await _client.toJobOneClickReview(taskId);
if (res.success) {
isRefresh = true;
_future = getData();
toUpState(setState, () {}, mounted);
return;
}
ToastUtils.showError(res.message ?? '操作失败');
} catch (e) {
} finally {
ToastUtils.dismiss();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios, color: Color.fromRGBO(51, 51, 51, 1)),
onPressed: () => Navigator.of(context).pop()),
title: Container(
child:
quickText(widget.jobName, size: 16.sp, color: Color.fromRGBO(51, 51, 51, 1), fontWeight: FontWeight.w500),
alignment: Alignment.center,
),
backgroundColor: Colors.white,
),
body: MyFutureBuilder.buildFutureBuilderOfSingleInstance<List<MarkingTasks>?>(context, _future, (value) {
if (value == null) return Container();
return ListView(
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 16.w),
children: value.map((e) {
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: EdgeInsets.only(left: 10.w, right: 10.w),
child: Row(
children: [
quickText(widget.genderName + e.className, color: Color.fromRGBO(0, 0, 0, 1), size: 14.sp),
Expanded(child: SizedBox()),
quickText('已交:${e.commitStudentCount}', color: Color.fromRGBO(104, 136, 253, 1), size: 12.sp),
SizedBox(width: 16.w),
quickText('未交:${e.studentCount - e.commitStudentCount}',
color: Color.fromRGBO(255, 86, 86, 1), size: 12.sp),
],
),
),
SizedBox(height: 13.h),
Padding(
padding: EdgeInsets.only(left: 10.w, right: 10.w),
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', () async {
var continueFlag = await showDialog<bool>(
context: context,
builder: (BuildContext context1) {
return Center(
child: Container(
padding: EdgeInsets.symmetric(vertical: 25.h, horizontal: 18.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadiusDirectional.circular(12.r)),
height: 150.h,
width: 280.w,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Expanded(
child: quickText('一键批阅后,默认学生答题结果全部正确,是否进行此操作?',
maxLines: 3,
size: 14.sp,
color: Color.fromRGBO(80, 94, 110, 1)))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
InkWell(
onTap: () {
Navigator.of(context1).pop(false);
},
child: Container(
padding: EdgeInsetsDirectional.symmetric(
horizontal: 36.w, vertical: 7.h),
decoration: BoxDecoration(
color: Color.fromRGBO(244, 244, 244, 1),
borderRadius: BorderRadius.circular(20.r)),
child: quickText('取消',
size: 14.sp, color: Color.fromRGBO(102, 102, 102, 1)),
),
),
InkWell(
onTap: () {
Navigator.of(context1).pop(true);
},
child: Container(
padding: EdgeInsetsDirectional.symmetric(
horizontal: 36.w, vertical: 7.h),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(20.r)),
child: quickText('确认',
size: 14.sp, color: Color.fromRGBO(255, 255, 255, 1)),
),
),
],
)
],
),
));
},
);
if (continueFlag == null || !continueFlag) return;
oneClickReview(e.id);
}),
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: EdgeInsets.only(left: 10.w, right: 10.w),
child: Row(
children: [
Expanded(
child: LinearPercentIndicator(
padding: EdgeInsets.zero,
animation: true,
lineHeight: 6.h,
animationDuration: 2500,
percent: e.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: e.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(e.progressPercentage)}%',
size: 10.sp, color: Color.fromRGBO(70, 70, 70, 1))
],
),
),
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: [
Expanded(
child: InkWell(
onTap: () {
if (e.totalCount <= 0) {
return ToastUtils.showInfo('没有找到可以批阅的任务');
}
if (!e.canMarking) {
return AchievementView(
elevation: 0.5,
duration: Duration(seconds: 1),
title: "提示",
subTitle: "此账号无法批阅该任务",
color: Theme.of(context).primaryColor,
).show(context);
}
if (e.isFinish) {
return AchievementView(
elevation: 0.5,
duration: Duration(seconds: 1),
title: "提示",
subTitle: "此批阅任务已完成",
color: Theme.of(context).primaryColor,
).show(context);
}
String url =
'${RouterManager.markingHomeworkDoPath}?taskId=${e.id}&jobId=${widget.jobId}&taskName=${Uri.encodeComponent(widget.jobName)}&className=${Uri.encodeComponent(widget.genderName + e.className)}';
RouterManager.router
.navigateTo(context, url, transition: getTransition())
.then((value) {
if (value == true) {
isRefresh = true;
_future = getData();
toUpState(setState, () {}, mounted);
}
});
},
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: () async {
if (!e.canMarking) return ToastUtils.showInfo('此任务非该账号任务');
if (e.isFinish) return ToastUtils.showInfo('此任务已经结束');
//
if (e.finishCount < e.totalCount) {
var continueFlag = await showDialog<bool>(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('未完成批阅提示'),
content: Text('当前批阅任务未完成,请确认需要结束此任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop(false);
},
),
TextButton(
child: Text(''),
onPressed: () {
Navigator.of(context1).pop(true);
},
),
],
);
},
);
if (continueFlag == null || !continueFlag) {
return;
}
}
showDialog(
context: context,
builder: (BuildContext context1) {
return AlertDialog(
title: Text('提示'),
content: Text('确认完成当前${e.className}批阅任务?'),
actions: <Widget>[
TextButton(
child: Text(''),
onPressed: () {
//
Navigator.of(context1).pop();
},
),
TextButton(
child: Text('确定'),
onPressed: () async {
try {
bool result = await endReview([e]);
if (result) {
isRefresh = true;
_future = getData();
toUpState(setState, () {}, mounted);
}
} catch (e) {
} finally {
ToastUtils.dismiss();
Navigator.of(context1).pop();
}
},
),
],
);
},
);
},
child: Container(
alignment: Alignment.center,
child: quickText('结束批阅', color: Color.fromRGBO(118, 118, 118, 1), size: 12.sp),
),
)),
],
),
),
],
));
}).toList(),
);
}),
);
}
}

View File

@ -15,6 +15,7 @@ import 'package:marking_app/common/model/enum/marking_list_type.dart';
import 'package:marking_app/pages/common/startUpPage.dart'; import 'package:marking_app/pages/common/startUpPage.dart';
import 'package:marking_app/pages/homework_correction/do_papers_job_exam.dart'; import 'package:marking_app/pages/homework_correction/do_papers_job_exam.dart';
import 'package:marking_app/pages/homework_correction/job_report.dart'; import 'package:marking_app/pages/homework_correction/job_report.dart';
import 'package:marking_app/pages/homework_correction/pages/job_list_participate_in_class.dart';
import 'package:marking_app/pages/homework_correction/review_job.dart'; import 'package:marking_app/pages/homework_correction/review_job.dart';
import 'package:marking_app/pages/login/index.dart'; import 'package:marking_app/pages/login/index.dart';
@ -53,6 +54,8 @@ class RouterManager {
static const String jobReportPagePath = '/job/report/index'; static const String jobReportPagePath = '/job/report/index';
// ==> // ==>
static const String jobExamPagePath = '/job/exam/index'; static const String jobExamPagePath = '/job/exam/index';
// ==> ==>
static const String jobListParticipateInClassPath = '/job/list/participateInClass';
static const String reportClassTeacherPath = 'report/details/reportClassTeacher'; static const String reportClassTeacherPath = 'report/details/reportClassTeacher';
static const String reportSubjectTeacherPath = 'report/details/reportSubjectTeacher'; static const String reportSubjectTeacherPath = 'report/details/reportSubjectTeacher';
@ -239,6 +242,16 @@ class RouterManager {
}, },
); );
static final _jobListParticipateInClassHandler = Handler(
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
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);
},
);
// //
// static final _doMarkingPapers = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) => MarkingPapers()); // static final _doMarkingPapers = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) => MarkingPapers());
@ -273,6 +286,8 @@ class RouterManager {
router.define(reportDetailPath, handler: _reportDetailPath, transitionType: TransitionType.material); router.define(reportDetailPath, handler: _reportDetailPath, transitionType: TransitionType.material);
router.define(jobReportPagePath, handler: _jobReportPageHandler, transitionType: TransitionType.material); router.define(jobReportPagePath, handler: _jobReportPageHandler, transitionType: TransitionType.material);
router.define(jobExamPagePath, handler: _jobExamPageHandler, transitionType: TransitionType.material); router.define(jobExamPagePath, handler: _jobExamPageHandler, transitionType: TransitionType.material);
router.define(jobListParticipateInClassPath,
handler: _jobListParticipateInClassHandler, transitionType: TransitionType.material);
// getTransition() // getTransition()

View File

@ -285,4 +285,9 @@ abstract class RestClient {
@the_retrofit.GET("/api/jobs/job-report-question-detail") @the_retrofit.GET("/api/jobs/job-report-question-detail")
Future<BaseStructureResult<List<JobReportQuestionDeatilModel>>> getJobReportQuestionDetail( Future<BaseStructureResult<List<JobReportQuestionDeatilModel>>> getJobReportQuestionDetail(
@the_retrofit.Query("jobid") int jobId, @the_retrofit.Query("questionid") int questionid); @the_retrofit.Query("jobid") int jobId, @the_retrofit.Query("questionid") int questionid);
// => ==>
@the_retrofit.GET("${RequestConfig.hwProxyKeywords}/api/Task/tasks")
Future<BaseStructureResult<List<MarkingTasks>>> getJobListParticipateInClass(
@the_retrofit.Query("markingId") int jobId);
} }

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.95 version: 1.0.87
environment: environment:
sdk: ">=2.17.1 <3.0.0" sdk: ">=2.17.1 <3.0.0"