收集订正

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")
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')
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);

View File

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

View File

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

View File

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

View File

@ -1,19 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:percent_indicator/percent_indicator.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/toast_utils.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/page/home_page/children/read_over/read_over_logic.dart';
import 'package:school_asignment_app/routes/app_pages.dart';
class TaskListItem extends StatefulWidget {
final bool completed;
final Items jobTaskItem;
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
State<TaskListItem> createState() => _TaskListItemState();
@ -21,7 +26,6 @@ class TaskListItem extends StatefulWidget {
class _TaskListItemState extends State<TaskListItem>{
@override
Widget build(BuildContext context) {
return widget.completed
@ -159,10 +163,6 @@ class _TaskListItemState extends State<TaskListItem> {
children: [
Container(
margin: EdgeInsets.only(bottom: 16.h),
child: Column(
children: [
SizedBox(height: 30.h),
Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
width: double.infinity,
decoration: BoxDecoration(
@ -179,7 +179,9 @@ class _TaskListItemState extends State<TaskListItem> {
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 30.h),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -243,13 +245,28 @@ class _TaskListItemState extends State<TaskListItem> {
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),
],
),
),
],
),
),
Container(
padding: EdgeInsets.all(9.r),
decoration: const BoxDecoration(shape: BoxShape.circle, color: Colors.white),