待批阅筛选修改

This commit is contained in:
machuanyu 2025-03-13 14:59:09 +08:00
parent 7fcd875c71
commit 829ac8fbad
3 changed files with 173 additions and 113 deletions

View File

@ -19,16 +19,20 @@ import 'package:making_school_asignment_app/common/job/work_student.dart';
part 'annotate_list.g.dart'; part 'annotate_list.g.dart';
class AnnotateList extends StatefulWidget{ class AnnotateList extends StatefulWidget {
final int tabIndex; final int tabIndex;
final int assessType; final int assessType;
const AnnotateList({Key? key,required this.tabIndex,required this.assessType}) : super(key: key);
const AnnotateList(
{Key? key, required this.tabIndex, required this.assessType})
: super(key: key);
@override @override
State<AnnotateList> createState() => _AnnotateListState(); State<AnnotateList> createState() => _AnnotateListState();
} }
class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, SingleTickerProviderStateMixin{ class _AnnotateListState extends State<AnnotateList>
with RequestToolMixin, SingleTickerProviderStateMixin {
late RxString customTimeStr = '自定义'.obs; late RxString customTimeStr = '自定义'.obs;
int active = 1; int active = 1;
late RxList<Items> unAnnotateList = RxList(); late RxList<Items> unAnnotateList = RxList();
@ -47,10 +51,12 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
WorkStudentParams params2 = WorkStudentParams( WorkStudentParams params2 = WorkStudentParams(
assessType: 0, assessType: 0,
pageSize: 10, pageSize: 10,
startDate: Utils.getWeekStartDate().toString().substring(0, 10),
endDate: Utils.getWeekEndDate().toString().substring(0, 10),
); );
@override @override
void initState(){ void initState() {
super.initState(); super.initState();
params.assessType = widget.assessType; params.assessType = widget.assessType;
params2.assessType = widget.assessType; params2.assessType = widget.assessType;
@ -95,19 +101,18 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
tab == 1 ? (markingDatas1 = lists) : (markingDatas2 = lists); tab == 1 ? (markingDatas1 = lists) : (markingDatas2 = lists);
} catch (e) {} } catch (e) {}
toUpState(setState, () {}, mounted);*/ toUpState(setState, () {}, mounted);*/
if(widget.tabIndex == 0){ if (widget.tabIndex == 0) {
getUnAnnotateList(); getUnAnnotateList();
}else{ } else {
getAnnotateList(); getAnnotateList();
} }
} }
Future<void> getCollect(item) async { Future<void> getCollect(item) async {
await getClient().getCollect(item.id); await getClient().getCollect(item.id);
if(widget.tabIndex == 0){ if (widget.tabIndex == 0) {
getUnAnnotateList(); getUnAnnotateList();
}else{ } else {
getAnnotateList(); getAnnotateList();
} }
} }
@ -128,45 +133,63 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
return Column( return Column(
children: [ children: [
if(widget.tabIndex == 1) if(widget.tabIndex == 1)
JobConditionFilter( Obx(() {
customTimeStr: customTimeStr.value, return JobConditionFilter(
controller: tabController2, customTimeStr: customTimeStr.value,
hasAll: true, controller: tabController2,
jobType: 1, hasAll: true,
customTime: tabController2.index != 3 || (params2.startDate == null && params2.endDate == null) jobType: 1,
? null customTime: tabController2.index != 2 ||
: PickerDateRange( (params2.startDate == null && params2.endDate == null)
params2.startDate == null ? null : DateTime.parse(params2.startDate!), ? null
params2.endDate == null ? null : DateTime.parse(params2.endDate!), : PickerDateRange(
), params2.startDate == null ? null : DateTime.parse(
onTimeFilter: (String? startTime, String? endTime) { params2.startDate!),
if (startTime == null && endTime == null && tabController2.index == 3) { params2.endDate == null ? null : DateTime.parse(
tabController2.animateTo(0); params2.endDate!),
} ),
params2.endDate = endTime; onTimeFilter: (String? startTime, String? endTime) {
params2.startDate = startTime; if (startTime == null && endTime == null &&
page = 1; tabController2.index == 2) {
if(widget.tabIndex == 0){ tabController2.animateTo(0);
getUnAnnotateList(); params2.endDate =
}else{ Utils.getWeekEndDate().toString().substring(0, 10);
getAnnotateList(); params2.startDate =
} Utils.getWeekStartDate().toString().substring(0, 10);
// refreshController2.callRefresh(); customTimeStr.value = '自定义';
},
refreshTime: (value) {
if (value != null && value.startDate != null) {
customTimeStr.value = value.startDate?.toString().substring(0, 10) ?? '';
if (value.endDate != null) {
if (!Utils.isPad() && value.startDate!.year == value.endDate!.year) {
customTimeStr.value =
'${value.startDate.toString().substring(5, 10)}~${value.endDate.toString().substring(5, 10)}';
} else { } else {
customTimeStr.value = '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}'; params2.endDate = endTime;
params2.startDate = startTime;
} }
} page = 1;
} EasyLoading.show(status: 'loading...');
}), if (widget.tabIndex == 0) {
getUnAnnotateList();
} else {
getAnnotateList();
}
// refreshController2.callRefresh();
},
refreshTime: (value) {
if (value != null && value.startDate != null) {
customTimeStr.value =
value.startDate?.toString().substring(0, 10) ?? '';
if (value.endDate != null) {
if (!Utils.isPad() &&
value.startDate!.year == value.endDate!.year) {
customTimeStr.value =
'${value.startDate.toString().substring(5, 10)}~${value
.endDate.toString().substring(5, 10)}';
} else {
customTimeStr.value =
'${customTimeStr.value}~${value.endDate?.toString()
.substring(0, 10)}';
}
}
}
});
}),
Expanded(child: IndexedStack( Expanded(child: IndexedStack(
index: widget.tabIndex, index: widget.tabIndex,
children: <Widget>[ children: <Widget>[
@ -199,8 +222,10 @@ class _AnnotateListState extends State<AnnotateList> with RequestToolMixin, Sing
@swidget @swidget
Widget $easyRefresh({ Widget $easyRefresh({
required EasyRefreshController controller, required EasyRefreshController controller,
required Future<void> Function(EasyRefreshController controller, int tab) onRefresh, required Future<
required Future<void> Function(EasyRefreshController controller, int tab) onLoad, void> Function(EasyRefreshController controller, int tab) onRefresh,
required Future<
void> Function(EasyRefreshController controller, int tab) onLoad,
required List<Items> data, required List<Items> data,
required int tab, required int tab,
required int type, required int type,
@ -220,7 +245,8 @@ Widget $easyRefresh({
footer: TaurusFooter(), footer: TaurusFooter(),
child: completed && isPadFlag child: completed && isPadFlag
? GridView( ? GridView(
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, //widget crossAxisCount: 2, //widget
mainAxisSpacing: 10.h, mainAxisSpacing: 10.h,
@ -230,19 +256,24 @@ Widget $easyRefresh({
children: List.generate(data.length, (index) { children: List.generate(data.length, (index) {
Items item = data[index]; Items item = data[index];
String subjectName = EnumUtils.formatSubject(item.subject); String subjectName = EnumUtils.formatSubject(item.subject);
return $reviewedItem(jobTaskItem: item, type: type, subjectName: subjectName, collectFun: collectFun,tabIndex:tab - 1); return $reviewedItem(jobTaskItem: item,
type: type,
subjectName: subjectName,
collectFun: collectFun,
tabIndex: tab - 1);
}), }),
) )
: ListView.builder( : ListView.builder(
padding: EdgeInsets.only(top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
Items item = data[index]; Items item = data[index];
return TaskListItem( return TaskListItem(
completed: completed, completed: completed,
jobTaskItem: item, jobTaskItem: item,
type: type, type: type,
collectFun: collectFun, collectFun: collectFun,
tabIndex:tab - 1 tabIndex: tab - 1
); );
}, },
itemCount: data.length, itemCount: data.length,
@ -266,10 +297,17 @@ Widget $reviewedItem({
return InkWell( return InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, Get.toNamed(Routes.annotateClassPage,
arguments: {'id': jobTaskItem.id, 'name': jobTaskItem.name, 'grade': jobTaskItem.grade,'subject':jobTaskItem.subject, 'completed': true,'tabIndex':tabIndex}); arguments: {
'id': jobTaskItem.id,
'name': jobTaskItem.name,
'grade': jobTaskItem.grade,
'subject': jobTaskItem.subject,
'completed': true,
'tabIndex': tabIndex
});
}, },
child: Container( child: Container(
padding: EdgeInsets.only(right: 5.w), padding: EdgeInsets.only(top: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6.r), borderRadius: BorderRadius.circular(6.r),
color: Colors.white, color: Colors.white,
@ -286,39 +324,47 @@ Widget $reviewedItem({
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
// //
Row( Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: padEdg,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 32.w, width: 32.w,
height: 18.h, height: 18.h,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.only(left: 2.w), padding: EdgeInsets.only(left: 2.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: type == 1 ? const Color(0xFFB2DA93) : const Color(0xFFEF8714), color: type == 1 ? const Color(0xFF4CC793) : const Color
borderRadius: BorderRadius.only( .fromRGBO(255, 175, 56, 1),
topLeft: Radius.circular(6.r), borderRadius: BorderRadius.only(
topRight: Radius.circular(0.r), topLeft: Radius.circular(14.r),
bottomLeft: Radius.circular(0.r), topRight: Radius.circular(3.r),
bottomRight: Radius.circular(12.r), bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
), ),
margin: EdgeInsets.only(top: 3.h, right: 4.w),
child: quickText(type == 1 ? '作业' : '考试', color: Colors.white,
size: 10.sp),
), ),
margin: EdgeInsets.only(top:0.h,right: 4.w), Expanded(
child: quickText(type == 1 ? '作业' : '考试', color: Colors.white, size: 10.sp), child: quickText(jobTaskItem.name, size: 14.sp,
), color: const Color.fromRGBO(70, 70, 70, 1),
Expanded( maxLines: 2),
child: quickText(jobTaskItem.name, size: 14.sp, color: const Color.fromRGBO(70, 70, 70, 1), maxLines: 2), ),
), if (jobTaskItem.isFixed!)
if (jobTaskItem.isFixed!) Padding(
Padding( padding: EdgeInsets.only(top: 3.r),
padding: EdgeInsets.only(top: 3.r), child: Text(
child: Text( '已订正',
'已订正', style: TextStyle(
style: TextStyle(fontSize: 10.sp, color: const Color(0xFFF16262)), fontSize: 10.sp, color: const Color(0xFFF16262)),
),
), ),
), ],
], ),
), ),
Padding( Padding(
@ -327,26 +373,31 @@ Widget $reviewedItem({
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
quickText( 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), color: const Color.fromRGBO(97, 97, 97, 1),
size: 10.sp, size: 10.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
quickText(' / ', color: const Color(0xFF8C68FF), size: 10.sp, fontWeight: FontWeight.w500), quickText(' / ', color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp,
fontWeight: FontWeight.w500),
quickText( quickText(
'参与班级:', '参与班级:',
color: const Color(0xFF8C68FF), color: const Color.fromRGBO(76, 199, 147, 1),
size: 9.sp, size: 9.sp,
), ),
quickText( quickText(
'${jobTaskItem.classCount}', '${jobTaskItem.classCount}',
color: const Color(0xFF8C68FF), color: const Color.fromRGBO(76, 199, 147, 1),
size: 10.sp, size: 10.sp,
), ),
quickText(' / ', color: const Color(0xFF8C68FF), size: 10.sp, fontWeight: FontWeight.w500), quickText(' / ', color: const Color.fromRGBO(116, 145, 253, 1),
size: 10.sp,
fontWeight: FontWeight.w500),
quickText( quickText(
'科目:$subjectName', '科目:$subjectName',
color: const Color(0xFF8C68FF), color: const Color.fromRGBO(116, 145, 253, 1),
size: 9.sp, size: 9.sp,
), ),
], ],
@ -363,7 +414,8 @@ Widget $reviewedItem({
Container( Container(
padding: EdgeInsets.symmetric(vertical: 6.h), padding: EdgeInsets.symmetric(vertical: 6.h),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r), bottomRight: Radius.circular(6.r)), borderRadius: BorderRadius.only(bottomLeft: Radius.circular(6.r),
bottomRight: Radius.circular(6.r)),
color: Colors.white, color: Colors.white,
boxShadow: const [ boxShadow: const [
BoxShadow( BoxShadow(
@ -375,7 +427,7 @@ Widget $reviewedItem({
], ],
), ),
child: Row(children: [ child: Row(children: [
/*if (!jobTaskItem.isFixed!) if (!jobTaskItem.isFixed!)
Expanded( Expanded(
flex: 1, flex: 1,
child: GestureDetector( child: GestureDetector(
@ -389,23 +441,31 @@ Widget $reviewedItem({
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border(right: BorderSide(width: 1.r, color: const Color(0xFFDCDCDC))), border: Border(right: BorderSide(
width: 1.r, color: const Color(0xFFDCDCDC))),
), ),
child: quickText('收集订正', color: const Color(0xFF8C68FF), size: 11.sp), child: quickText(
'收集订正', color: const Color(0xFF4CC793), size: 11.sp),
), ),
), ),
),*/ ),
Expanded( Expanded(
flex: 1, flex: 1,
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Get.toNamed(Routes.jobReportPage, Get.toNamed(Routes.jobReportPage,
arguments: {'title': jobTaskItem.name, 'homeworkId': jobTaskItem.id, 'grade': jobTaskItem.grade}); arguments: {
'title': jobTaskItem.name,
'homeworkId': jobTaskItem.id,
'grade': jobTaskItem.grade
});
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: quickText('查看报告', color: const Color.fromRGBO(118, 118, 118, 1), size: 11.sp), child: quickText(
'查看报告', color: const Color.fromRGBO(118, 118, 118, 1),
size: 11.sp),
), ),
), ),
), ),

View File

@ -70,14 +70,14 @@ class _JobConditionFilterState extends State<JobConditionFilter> {
customTimeStr: widget.customTimeStr, customTimeStr: widget.customTimeStr,
hasAll: widget.hasAll, hasAll: widget.hasAll,
onTap: (int val) async { onTap: (int val) async {
if (val == 0 && widget.hasAll == true) { if (val == 3 && widget.hasAll == true) {
widget.onTimeFilter(null, null); widget.onTimeFilter(null, null);
} else if ((val == 1 && widget.hasAll == true) || (val == 0 && widget.hasAll == false)) { } else if ((val == 0 && widget.hasAll == true) || (val == 0 && widget.hasAll == false)) {
widget.onTimeFilter( widget.onTimeFilter(
Utils.getWeekStartDate().toString().substring(0, 10), Utils.getWeekStartDate().toString().substring(0, 10),
Utils.getWeekEndDate().toString().substring(0, 10), Utils.getWeekEndDate().toString().substring(0, 10),
); );
} else if ((val == 2 && widget.hasAll == true) || (val == 1 && widget.hasAll == false)) { } else if ((val == 1 && widget.hasAll == true) || (val == 1 && widget.hasAll == false)) {
widget.onTimeFilter( widget.onTimeFilter(
getMonthStartDate().toString().substring(0, 10), getMonthStartDate().toString().substring(0, 10),
getMonthEndDate().toString().substring(0, 10), getMonthEndDate().toString().substring(0, 10),

View File

@ -13,10 +13,10 @@ class PersonalDetailTopBar extends StatefulWidget {
} }
class _PersonalDetailTopBarState extends State<PersonalDetailTopBar> { class _PersonalDetailTopBarState extends State<PersonalDetailTopBar> {
@override @override
void initState(){ void initState(){
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,26 +33,26 @@ class _PersonalDetailTopBarState extends State<PersonalDetailTopBar> {
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: const Color(0xFF8C68FF), color: const Color(0xFF4CC793),
), ),
isScrollable: true, isScrollable: true,
labelColor:const Color(0xFF8C68FF), labelColor: const Color(0xFF4CC793),
unselectedLabelColor: const Color(0xFF505E6E), unselectedLabelColor: const Color(0xFF505E6E),
padding: EdgeInsets.symmetric(horizontal: 14.r), padding: EdgeInsets.symmetric(horizontal: 14.r),
// indicatorSize: TabBarIndicatorSize.label, // // indicatorSize: TabBarIndicatorSize.label, //
onTap: widget.onTap, onTap: widget.onTap,
indicator: UnderlineTabIndicator( indicator: UnderlineTabIndicator(
borderSide: BorderSide( borderSide: BorderSide(
width: 2.r, width: 2.r,
color:const Color(0xFF8C68FF) color:const Color(0xFF4CC793)
), ),
), ),
tabs: <Widget>[ tabs: <Widget>[
if(widget.hasAll == true)
const Tab(text: '全部'),
const Tab(text: '近一周'), const Tab(text: '近一周'),
const Tab(text: '近一月'), const Tab(text: '近一月'),
Tab(text: widget.customTimeStr), Tab(text: widget.customTimeStr),
if(widget.hasAll == true)
const Tab(text: '全部'),
], ],
), ),
); );