收集订正

This commit is contained in:
machuanyu 2024-05-28 16:17:32 +08:00
parent 3dcbf121aa
commit 8874d64281
6 changed files with 482 additions and 387 deletions

View File

@ -92,4 +92,10 @@ abstract class RetrofitClient {
@GET("/api/hms/HmsReport/GetQuestionStudentState") @GET("/api/hms/HmsReport/GetQuestionStudentState")
Future<List<Students>> getQuestionStudentState(@Query('HomeworkId') String homeworkId,@Query('TemplateId') int templateId,@Query('QuestionNo') int questionNo); Future<List<Students>> getQuestionStudentState(@Query('HomeworkId') String homeworkId,@Query('TemplateId') int templateId,@Query('QuestionNo') int questionNo);
//
@POST("/api/hms/Homework/Collect")
Future getCollect(@Field() String homeworkId);
} }

View File

@ -69,6 +69,8 @@ class Items extends Object {
@JsonKey(name: 'classCount') @JsonKey(name: 'classCount')
int? classCount; int? classCount;
@JsonKey(name: 'isFixed')
bool? isFixed;
Items(this.id,this.assessType,this.name,this.grade,this.subject,this.publishTime,this.state,this.collectRate,this.questionCount,this.annotateCount,this.annotateRate,this.classes,this.creatorName,this.creationTime,this.classCount); Items(this.id,this.assessType,this.name,this.grade,this.subject,this.publishTime,this.state,this.collectRate,this.questionCount,this.annotateCount,this.annotateRate,this.classes,this.creatorName,this.creationTime,this.classCount);

View File

@ -24,7 +24,9 @@ class KnowledgePointsGraspDetailPage extends StatefulWidget {
class _KnowledgePointsGraspDetailPageState class _KnowledgePointsGraspDetailPageState
extends State<KnowledgePointsGraspDetailPage> { extends State<KnowledgePointsGraspDetailPage> {
final logic = Get.find<KnowledgePointsGraspDetailLogic>(); final logic = Get.find<KnowledgePointsGraspDetailLogic>();
final state = Get.find<KnowledgePointsGraspDetailLogic>().state; final state = Get
.find<KnowledgePointsGraspDetailLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -40,7 +42,10 @@ class _KnowledgePointsGraspDetailPageState
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.r))), borderRadius: BorderRadius.all(Radius.circular(15.r))),
content: Container( content: Container(
width: MediaQuery.of(context).size.width, width: MediaQuery
.of(context)
.size
.width,
// height: MediaQuery.of(context).size.height, // height: MediaQuery.of(context).size.height,
child: Image.network(imgUrl), child: Image.network(imgUrl),
), ),
@ -54,13 +59,17 @@ class _KnowledgePointsGraspDetailPageState
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
void showStudent(homeworkId,templateId,questionNo, title) async { void showStudent(homeworkId, templateId, questionNo, title) async {
await logic.getStudents(homeworkId,templateId,questionNo); logic.getStudents(homeworkId, templateId, questionNo);
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowStudentList(title:title,studentList:state.studentList.value,homeworkId: homeworkId,); return Obx(() {
return ShowStudentList(title: title,
studentList: state.studentList.value,
homeworkId: homeworkId,);
});
}, },
); );
EasyLoading.dismiss(); EasyLoading.dismiss();
@ -188,7 +197,8 @@ class _KnowledgePointsGraspDetailPageState
onTap: () { onTap: () {
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
showStudent( showStudent(
item.homeworkId, item.templateId,item.questionNo,item.homeworkName); item.homeworkId, item.templateId,
item.questionNo, item.homeworkName);
}, },
child: Container( child: Container(
margin: EdgeInsets.only(right: 6.r), margin: EdgeInsets.only(right: 6.r),
@ -244,7 +254,8 @@ class _KnowledgePointsGraspDetailPageState
), ),
SizedBox(width: 4.w), SizedBox(width: 4.w),
quickText( quickText(
'${item.correctRate.toStringAsFixed(0)}%', '${item.correctRate.toStringAsFixed(
0)}%',
size: 10.sp, size: 10.sp,
color: Color(0xFF606060)) color: Color(0xFF606060))
], ],

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:school_asignment_app/common/job/enum_subject.dart'; import 'package:school_asignment_app/common/job/enum_subject.dart';
@ -36,6 +37,7 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
vsync: this, vsync: this,
); );
tabController2 = TabController(length: 4, vsync: this); tabController2 = TabController(length: 4, vsync: this);
EasyLoading.show(status:'loading...');
getList(); getList();
} }
// //
@ -52,6 +54,7 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
state.workList.value = data.items; state.workList.value = data.items;
refreshController1.finishRefresh(); refreshController1.finishRefresh();
refreshController2.finishRefresh(); refreshController2.finishRefresh();
EasyLoading.dismiss();
print('state.workList.length=${state.workList.length}'); print('state.workList.length=${state.workList.length}');
} }
/// ///
@ -65,6 +68,11 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
getList(); getList();
} }
void getCollect(item) async{
await getClient().getCollect(item.id);
getList();
}
/// ///
Future<void> onMyLoad(EasyRefreshController controller, int tab) async { Future<void> onMyLoad(EasyRefreshController controller, int tab) async {
/*params.page++; /*params.page++;

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:functional_widget_annotation/functional_widget_annotation.dart';
@ -25,9 +26,7 @@ class ReadOverPage extends StatefulWidget {
class _ReadOverPageState extends State<ReadOverPage> { class _ReadOverPageState extends State<ReadOverPage> {
final logic = Get.find<ReadOverLogic>(); final logic = Get.find<ReadOverLogic>();
final state = Get final state = Get.find<ReadOverLogic>().state;
.find<ReadOverLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -48,10 +47,8 @@ class _ReadOverPageState extends State<ReadOverPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
color: Colors.white, color: Colors.white,
margin: EdgeInsets.only(top: MediaQuery margin:
.of(context) EdgeInsets.only(top: MediaQuery.of(context).padding.top),
.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, crossAxisAlignment: CrossAxisAlignment.center,
@ -124,9 +121,9 @@ class _ReadOverPageState extends State<ReadOverPage> {
child: quickText( child: quickText(
'待批阅', '待批阅',
size: 14.sp, size: 14.sp,
color: state.tabIndex.value == 0 ? Theme color: state.tabIndex.value == 0
.of(context) ? Theme.of(context).primaryColor
.primaryColor : const Color.fromRGBO( : const Color.fromRGBO(
80, 94, 110, 1), 80, 94, 110, 1),
fontWeight: state.tabIndex.value == 0 fontWeight: state.tabIndex.value == 0
? FontWeight.bold ? FontWeight.bold
@ -153,9 +150,9 @@ class _ReadOverPageState extends State<ReadOverPage> {
child: quickText( child: quickText(
'已批阅', '已批阅',
size: 14.sp, size: 14.sp,
color: state.tabIndex.value == 1 ? Theme color: state.tabIndex.value == 1
.of(context) ? Theme.of(context).primaryColor
.primaryColor : const Color.fromRGBO( : const Color.fromRGBO(
80, 94, 110, 1), 80, 94, 110, 1),
fontWeight: state.tabIndex.value == 1 fontWeight: state.tabIndex.value == 1
? FontWeight.bold ? FontWeight.bold
@ -172,10 +169,8 @@ class _ReadOverPageState extends State<ReadOverPage> {
flex: 1, flex: 1,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
/* RouterManager.router Get.toNamed(Routes.studentHistoryWorkPage,
.navigateTo( arguments: {'page': 'set'});
context, RouterManager.jobStudentGroupPath,
transition: getTransition());*/
}, },
child: Icon( child: Icon(
const IconData(0xe63e, fontFamily: "AlibabaIcon"), const IconData(0xe63e, fontFamily: "AlibabaIcon"),
@ -187,22 +182,28 @@ class _ReadOverPageState extends State<ReadOverPage> {
), ),
), ),
Obx(() { Obx(() {
return state.tabIndex.value == 1? return state.tabIndex.value == 1
JobConditionFilter( ? JobConditionFilter(
customTimeStr: state.customTimeStr.value, customTimeStr: state.customTimeStr.value,
controller: logic.tabController2, controller: logic.tabController2,
hasAll:true, hasAll: true,
jobType: 1, jobType: 1,
customTime: logic.tabController2.index != 3 || customTime: logic.tabController2.index != 3 ||
(logic.params2.startDate == null && logic.params2.endDate == null) (logic.params2.startDate == null &&
logic.params2.endDate == null)
? null ? null
: PickerDateRange( : PickerDateRange(
logic.params2.startDate == null ? null : DateTime.parse( logic.params2.startDate == null
? null
: DateTime.parse(
logic.params2.startDate!), logic.params2.startDate!),
logic.params2.endDate == null ? null : DateTime.parse(logic.params2.endDate!), logic.params2.endDate == null
? null
: DateTime.parse(logic.params2.endDate!),
), ),
onTimeFilter: (String? startTime, String? endTime) { onTimeFilter: (String? startTime, String? endTime) {
if (startTime == null && endTime == null && if (startTime == null &&
endTime == null &&
logic.tabController2.index == 3) { logic.tabController2.index == 3) {
logic.tabController2.animateTo(0); logic.tabController2.animateTo(0);
} }
@ -214,29 +215,27 @@ class _ReadOverPageState extends State<ReadOverPage> {
}, },
refreshTime: (value) { refreshTime: (value) {
if (value != null && value.startDate != null) { if (value != null && value.startDate != null) {
state.customTimeStr.value = state.customTimeStr.value = value.startDate
value.startDate?.toString().substring(0, 10) ?? ''; ?.toString()
.substring(0, 10) ??
'';
if (value.endDate != null) { if (value.endDate != null) {
if (!Utils.isPad() && if (!Utils.isPad() &&
value.startDate!.year == value.endDate!.year) { value.startDate!.year ==
value.endDate!.year) {
state.customTimeStr.value = state.customTimeStr.value =
'${value.startDate.toString().substring(5, 10)}~${value '${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}';
.endDate.toString().substring(5, 10)}';
} else { } else {
state.customTimeStr.value = state.customTimeStr.value =
'${state.customTimeStr.value}~${value.endDate '${state.customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
?.toString()
.substring(
0, 10)}';
} }
} }
} }
} })
):Container(); : Container();
}), }),
Expanded( Expanded(child: Obx(() {
child: Obx(() {
return IndexedStack( return IndexedStack(
index: state.tabIndex.value, index: state.tabIndex.value,
children: <Widget>[ children: <Widget>[
@ -274,17 +273,16 @@ class _ReadOverPageState extends State<ReadOverPage> {
} }
} }
/// ///
/// OnRefreshCallback? onRefresh /// OnRefreshCallback? onRefresh
/// ///
@swidget @swidget
Widget $easyRefresh({ Widget $easyRefresh({
required EasyRefreshController controller, required EasyRefreshController controller,
required Future< required Future<void> Function(EasyRefreshController controller, int tab)
void> Function(EasyRefreshController controller, int tab) onRefresh, onRefresh,
required Future< required Future<void> Function(EasyRefreshController controller, int tab)
void> Function(EasyRefreshController controller, int tab) onLoad, onLoad,
required List<Items> data, required List<Items> data,
required int tab, required int tab,
required int type, required int type,
@ -316,7 +314,7 @@ Widget $easyRefresh({
Items item = data[index]; Items item = data[index];
String subjectName = EnumUtils.formatSubject(item.subject); String subjectName = EnumUtils.formatSubject(item.subject);
return $reviewedItem( return $reviewedItem(
jobTaskItem: item, type: type, subjectName: subjectName); jobTaskItem: item, type: type, subjectName: subjectName,logic: logic);
}), }),
) )
: ListView.builder( : ListView.builder(
@ -328,6 +326,7 @@ Widget $easyRefresh({
completed: completed, completed: completed,
jobTaskItem: item, jobTaskItem: item,
type: type, type: type,
logic: logic,
); );
}, },
itemCount: data.length, itemCount: data.length,
@ -340,12 +339,20 @@ Widget $easyRefresh({
@swidget @swidget
Widget $reviewedItem( Widget $reviewedItem(
{required Items jobTaskItem, required int type, required String subjectName}) { {required Items jobTaskItem,
required int type,
required String subjectName,
required ReadOverLogic logic,}) {
EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w); EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w);
return InkWell( return InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage,arguments: {'id':jobTaskItem.id,'name':jobTaskItem.name,'grade':jobTaskItem.grade,'completed':true}); Get.toNamed(Routes.annotateClassPage, arguments: {
'id': jobTaskItem.id,
'name': jobTaskItem.name,
'grade': jobTaskItem.grade,
'completed': true
});
}, },
child: Container( child: Container(
padding: EdgeInsets.only(top: 10.h), padding: EdgeInsets.only(top: 10.h),
@ -387,31 +394,47 @@ Widget $reviewedItem(
), ),
), ),
margin: EdgeInsets.only(right: 4.w), margin: EdgeInsets.only(right: 4.w),
child: quickText(type == 1 ? '作业' : '考试', color: Colors.white, child: quickText(type == 1 ? '作业' : '考试',
size: 10.sp), color: Colors.white, size: 10.sp),
), ),
Expanded( Expanded(
child: quickText(jobTaskItem.name, size: 14.sp, child: quickText(jobTaskItem.name,
size: 14.sp,
color: const Color.fromRGBO(70, 70, 70, 1), color: const Color.fromRGBO(70, 70, 70, 1),
maxLines: 2), maxLines: 2),
) )
], ],
), ),
), ),
if(jobTaskItem.isFixed!)
Padding(
padding: padEdg,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'已订正',
style: TextStyle(
fontSize: 10.sp, color: const Color(0xFFF16262)),
),
],
),
),
Padding( Padding(
padding: padEdg, padding: padEdg,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
quickText( quickText(
DateTime.parse(jobTaskItem.publishTime).toString().substring( DateTime.parse(jobTaskItem.publishTime)
0, 10), .toString()
.substring(0, 10),
color: const Color.fromRGBO(97, 97, 97, 1), color: const Color.fromRGBO(97, 97, 97, 1),
size: 10.sp, size: 10.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
quickText(' / ', color: const Color.fromRGBO(76, 199, 147, 1), quickText(' / ',
color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp, size: 10.sp,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
quickText( quickText(
@ -424,7 +447,8 @@ Widget $reviewedItem(
color: const Color.fromRGBO(76, 199, 147, 1), color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp, size: 10.sp,
), ),
quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1), quickText(' / ',
color: const Color.fromRGBO(116, 145, 253, 1),
size: 10.sp, size: 10.sp,
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
quickText( quickText(
@ -443,11 +467,7 @@ Widget $reviewedItem(
margin: EdgeInsets.only(top: 4.h, bottom: 6.h), margin: EdgeInsets.only(top: 4.h, bottom: 6.h),
), ),
),*/ ),*/
GestureDetector( Container(
onTap: () {
Get.toNamed(Routes.jobReportPage,arguments: {'title':jobTaskItem.name,'homeworkId':jobTaskItem.id,'grade':jobTaskItem.grade});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 6.h), padding: EdgeInsets.symmetric(vertical: 6.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -464,16 +484,47 @@ Widget $reviewedItem(
], ],
), ),
child: Row(children: [ child: Row(children: [
if (!jobTaskItem.isFixed!)
Expanded( Expanded(
flex: 1,
child: InkWell(
onTap: (){
if(!jobTaskItem.isFixed!){
EasyLoading.show(status:'loading...');
logic.getCollect(jobTaskItem);
}
},
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: quickText( decoration: BoxDecoration(
'查看报告', color: const Color.fromRGBO(118, 118, 118, 1), border: Border(
right: BorderSide(
width: 1.r, color: const Color(0xFFDCDCDC))),
),
child: quickText('收集订正',
color: const Color(0xFF4CC793), size: 11.sp),
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () {
Get.toNamed(Routes.jobReportPage, arguments: {
'title': jobTaskItem.name,
'homeworkId': jobTaskItem.id,
'grade': jobTaskItem.grade
});
},
child: Container(
alignment: Alignment.center,
child: quickText('查看报告',
color: const Color.fromRGBO(118, 118, 118, 1),
size: 11.sp), size: 11.sp),
), ),
), ),
]),
), ),
]),
), ),
], ],
), ),

View File

@ -1,26 +1,30 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:percent_indicator/percent_indicator.dart'; import 'package:percent_indicator/percent_indicator.dart';
import 'package:school_asignment_app/common/job/work_student.dart'; import 'package:school_asignment_app/common/job/work_student.dart';
import 'package:school_asignment_app/common/mixins/request_tool_mixin.dart';
import 'package:school_asignment_app/common/utils/enum_untils.dart'; import 'package:school_asignment_app/common/utils/enum_untils.dart';
import 'package:school_asignment_app/common/utils/toast_utils.dart';
import 'package:school_asignment_app/page/global_widget/my_text.dart'; import 'package:school_asignment_app/page/global_widget/my_text.dart';
import 'package:school_asignment_app/common/utils/utils.dart'; import 'package:school_asignment_app/common/utils/utils.dart';
import 'package:school_asignment_app/page/home_page/children/read_over/read_over_logic.dart';
import 'package:school_asignment_app/routes/app_pages.dart'; import 'package:school_asignment_app/routes/app_pages.dart';
class TaskListItem extends StatefulWidget { class TaskListItem extends StatefulWidget {
final bool completed; final bool completed;
final Items jobTaskItem; final Items jobTaskItem;
final int type; final int type;
final ReadOverLogic logic;
const TaskListItem({Key? key,required this.completed,required this.jobTaskItem,required this.type}) : super(key: key); const TaskListItem({Key? key,required this.completed,required this.jobTaskItem,required this.type,required this.logic}) : super(key: key);
@override @override
State<TaskListItem> createState() => _TaskListItemState(); State<TaskListItem> createState() => _TaskListItemState();
} }
class _TaskListItemState extends State<TaskListItem> { class _TaskListItemState extends State<TaskListItem>{
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -159,10 +163,6 @@ class _TaskListItemState extends State<TaskListItem> {
children: [ children: [
Container( Container(
margin: EdgeInsets.only(bottom: 16.h), margin: EdgeInsets.only(bottom: 16.h),
child: Column(
children: [
SizedBox(height: 30.h),
Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w), padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -179,7 +179,9 @@ class _TaskListItemState extends State<TaskListItem> {
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox(height: 30.h),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -243,13 +245,28 @@ class _TaskListItemState extends State<TaskListItem> {
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp), color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
], ],
), ),
SizedBox(height: 10.h),
InkWell(
onTap: (){
if(!widget.jobTaskItem.isFixed!){
EasyLoading.show(status:'loading...');
widget.logic.getCollect(widget.jobTaskItem);
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 4.r,horizontal: 20.r),
decoration: BoxDecoration(
color: widget.jobTaskItem.isFixed!?Color(0xFFF4F4F4):Color(0xFFF2FFFA),
border: Border.all(width: 1.r,color:widget.jobTaskItem.isFixed!?Colors.transparent:Color(0xFF4CC793)),
borderRadius: BorderRadius.all(Radius.circular(20.r)),
),
child: Text(widget.jobTaskItem.isFixed!?'已订正':'收集订正',style: TextStyle(fontSize: 10.sp,color: const Color(0xFF4CC793)),),
),
),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title), // FavoriteButton(jobTaskItem.id, jobTaskItem.title),
], ],
), ),
), ),
],
),
),
Container( Container(
padding: EdgeInsets.all(9.r), padding: EdgeInsets.all(9.r),
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.white), decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.white),