主页列表

This commit is contained in:
machuanyu 2024-05-27 09:01:09 +08:00
parent 1f0f1d4879
commit aef50dd53b
11 changed files with 431 additions and 119 deletions

View File

@ -52,10 +52,10 @@ class Items extends Object {
int? questionCount; int? questionCount;
@JsonKey(name: 'annotateCount') @JsonKey(name: 'annotateCount')
int annotateCount; int? annotateCount;
@JsonKey(name: 'annotateRate') @JsonKey(name: 'annotateRate')
double annotateRate; double? annotateRate;
@JsonKey(name: 'classes') @JsonKey(name: 'classes')
List<Classes>? classes; List<Classes>? classes;

View File

@ -99,8 +99,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
child: ItemBtn(title: "数据快查",font: widget.font - 2.sp,clickFunction: (){ child: ItemBtn(title: "数据快查",font: widget.font - 2.sp,clickFunction: (){
Get.toNamed(Routes.quickDataCheckPage,arguments: {'homeworkId':widget.state.homeworkId.value,'classId':widget.item.classId,'grade':widget.state.grade,'className':widget.item.className Get.toNamed(Routes.quickDataCheckPage,arguments: {'homeworkId':widget.state.homeworkId.value,'classId':widget.item.classId,'grade':widget.state.grade,'className':widget.item.className
}); });
// Get.toNamed(Routes.jobReportPage,arguments: {'title':widget.name,'homeworkId':widget.state.homeworkId.value,'classId':widget.item.classId,'grade':widget.state.grade,'className':widget.item.className}); },),
},),
), ),
const Expanded(flex: 1,child: Text(''),), const Expanded(flex: 1,child: Text(''),),
Expanded( Expanded(

View File

@ -12,10 +12,20 @@ import 'read_over_state.dart';
class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin{ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin{
final ReadOverState state = ReadOverState(); final ReadOverState state = ReadOverState();
late TabController tabController; late TabController tabController;
late TabController tabController2;
/* 待阅卷 */ /* 待阅卷 */
late final EasyRefreshController refreshController1; late final EasyRefreshController refreshController1;
late final EasyRefreshController refreshController2; late final EasyRefreshController refreshController2;
WorkStudentParams params = WorkStudentParams(
assessType: 0,
pageSize: 10,
);
WorkStudentParams params2 = WorkStudentParams(
assessType: 0,
pageSize: 10,
);
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
@ -25,25 +35,24 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
length: 2, length: 2,
vsync: this, vsync: this,
); );
tabController2 = TabController(length: 4, vsync: this);
getList(); getList();
} }
// //
void getList() async { void getList() async {
WorkStudentParams params = WorkStudentParams(
assessType: 0,
);
WorkStudent data = WorkStudent([], 0); WorkStudent data = WorkStudent([], 0);
if(state.tabIndex.value == 0){ if(state.tabIndex.value == 0){
params.pageNumber = state.page;
data = await getClient().getUnAnnotateList(params); data = await getClient().getUnAnnotateList(params);
}else{ }else{
data = await getClient().getAnnotatedList(params); params2.pageNumber = state.page;
data = await getClient().getAnnotatedList(params2);
} }
state.workList.value = data.items; state.workList.value = data.items;
refreshController1.finishRefresh(); refreshController1.finishRefresh();
refreshController2.finishRefresh(); refreshController2.finishRefresh();
print('state.workList.length='); print('state.workList.length=${state.workList.length}');
print(state.workList.length);
} }
/// ///
Future<void> onMyRefresh(EasyRefreshController controller, int tab) async { Future<void> onMyRefresh(EasyRefreshController controller, int tab) async {
@ -132,6 +141,7 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
void dispose() { void dispose() {
super.dispose(); super.dispose();
tabController.dispose(); tabController.dispose();
tabController2.dispose();
refreshController1.dispose(); refreshController1.dispose();
refreshController2.dispose(); refreshController2.dispose();
} }

View File

@ -10,4 +10,6 @@ class ReadOverState {
late RxList<Items> workList = RxList(); late RxList<Items> workList = RxList();
late RxInt tabIndex = 0.obs; late RxInt tabIndex = 0.obs;
late bool completedToRefresh = true; late bool completedToRefresh = true;
late RxString customTimeStr = '自定义'.obs;
late int page = 1;
} }

View File

@ -10,6 +10,9 @@ import 'package:school_asignment_app/common/utils/utils.dart';
import 'package:school_asignment_app/page/global_widget/MyEmptyWidget.dart'; import 'package:school_asignment_app/page/global_widget/MyEmptyWidget.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/page/home_page/children/read_over/widget/task_list_item.dart'; import 'package:school_asignment_app/page/home_page/children/read_over/widget/task_list_item.dart';
import 'package:school_asignment_app/page/home_page/children/student_work_detail/widget/job_condition_filter.dart';
import 'package:school_asignment_app/routes/app_pages.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'read_over_logic.dart'; import 'read_over_logic.dart';
@ -22,7 +25,9 @@ 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.find<ReadOverLogic>().state; final state = Get
.find<ReadOverLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -43,7 +48,10 @@ class _ReadOverPageState extends State<ReadOverPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
color: Colors.white, 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), padding: EdgeInsets.only(bottom: 9.h, top: 4.h),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -106,14 +114,23 @@ class _ReadOverPageState extends State<ReadOverPage> {
width: 140.w, width: 140.w,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.tabIndex.value == 0 ? const Color.fromRGBO(255, 255, 255, 1) : null, color: state.tabIndex.value == 0
borderRadius: BorderRadius.all(Radius.circular(8.r)), ? const Color.fromRGBO(
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
), ),
child: quickText( child: quickText(
'待批阅', '待批阅',
size: 14.sp, size: 14.sp,
color: state.tabIndex.value == 0 ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 94, 110, 1), color: state.tabIndex.value == 0 ? Theme
fontWeight: state.tabIndex.value == 0 ? FontWeight.bold : null, .of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 0
? FontWeight.bold
: null,
), ),
); );
}), }),
@ -126,14 +143,23 @@ class _ReadOverPageState extends State<ReadOverPage> {
width: 140.w, width: 140.w,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: state.tabIndex.value == 1 ? const Color.fromRGBO(255, 255, 255, 1) : null, color: state.tabIndex.value == 1
borderRadius: BorderRadius.all(Radius.circular(8.r)), ? const Color.fromRGBO(
255, 255, 255, 1)
: null,
borderRadius: BorderRadius.all(
Radius.circular(8.r)),
), ),
child: quickText( child: quickText(
'已批阅', '已批阅',
size: 14.sp, size: 14.sp,
color: state.tabIndex.value == 1 ? Theme.of(context).primaryColor : const Color.fromRGBO(80, 94, 110, 1), color: state.tabIndex.value == 1 ? Theme
fontWeight: state.tabIndex.value == 1 ? FontWeight.bold : null, .of(context)
.primaryColor : const Color.fromRGBO(
80, 94, 110, 1),
fontWeight: state.tabIndex.value == 1
? FontWeight.bold
: null,
), ),
); );
}), }),
@ -151,61 +177,88 @@ class _ReadOverPageState extends State<ReadOverPage> {
context, RouterManager.jobStudentGroupPath, context, RouterManager.jobStudentGroupPath,
transition: getTransition());*/ transition: getTransition());*/
}, },
child: Icon(const IconData(0xe63e, fontFamily: "AlibabaIcon"), color: const Color.fromRGBO(44, 48, 63, 1), size: 24.sp), child: Icon(
const IconData(0xe63e, fontFamily: "AlibabaIcon"),
color: const Color.fromRGBO(44, 48, 63, 1),
size: 24.sp),
), ),
), ),
], ],
), ),
), ),
/* if (state.tabIndex.value == 1) Obx(() {
$CompletedJobConditionFilter( return state.tabIndex.value == 1?
controller: _tabController2, JobConditionFilter(
jobType: params2.markingType ?? 1, customTimeStr: state.customTimeStr.value,
customTime: _tabController2.index != 3 || controller: logic.tabController2,
(params2.startTime == null && params2.endTime == null) hasAll:true,
? null jobType: 1,
: PickerDateRange( customTime: logic.tabController2.index != 3 ||
params2.startTime == null ? null : DateTime.parse( (logic.params2.startDate == null && logic.params2.endDate == null)
params2.startTime!), ? null
params2.endTime == null ? null : DateTime.parse(params2 : PickerDateRange(
.endTime!), logic.params2.startDate == null ? null : DateTime.parse(
), logic.params2.startDate!),
onJobTypeTap: (int jobTypeVal) { logic.params2.endDate == null ? null : DateTime.parse(logic.params2.endDate!),
params2.markingType = jobTypeVal; ),
_refreshController2.callRefresh(); onTimeFilter: (String? startTime, String? endTime) {
}, if (startTime == null && endTime == null &&
onTimeFilter: (String? startTime, String? endTime) { logic.tabController2.index == 3) {
if (startTime == null && endTime == null && logic.tabController2.animateTo(0);
_tabController2.index == 3) { }
_tabController2.animateTo(0); logic.params2.endDate = endTime;
} logic.params2.startDate = startTime;
params2.endTime = endTime; state.page = 1;
params2.startTime = startTime; logic.getList();
_refreshController2.callRefresh(); // logic.refreshController2.callRefresh();
}, },
),*/ refreshTime: (value) {
if (value != null && value.startDate != null) {
state.customTimeStr.value =
value.startDate?.toString().substring(0, 10) ?? '';
if (value.endDate != null) {
if (!Utils.isPad() &&
value.startDate!.year == value.endDate!.year) {
state.customTimeStr.value =
'${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)}';
}
}
}
}
):Container();
}),
Expanded( Expanded(
child: IndexedStack( child: Obx(() {
index: state.tabIndex.value, return IndexedStack(
children: <Widget>[ index: state.tabIndex.value,
$easyRefresh( children: <Widget>[
controller: logic.refreshController1, $easyRefresh(
tab: 1, controller: logic.refreshController1,
type: state.active, tab: 1,
data: state.workList, type: state.active,
onLoad: logic.onMyLoad, data: state.workList,
onRefresh: logic.onMyRefresh, onLoad: logic.onMyLoad,
logic: logic), onRefresh: logic.onMyRefresh,
$easyRefresh( logic: logic),
controller: logic.refreshController2, $easyRefresh(
tab: 2, controller: logic.refreshController2,
type: state.active, tab: 2,
data: state.workList, type: state.active,
onLoad: logic.onMyLoad, data: state.workList,
onRefresh: logic.onMyRefresh, onLoad: logic.onMyLoad,
logic: logic), onRefresh: logic.onMyRefresh,
], logic: logic),
)), ],
);
})),
], ],
); );
}, },
@ -228,8 +281,10 @@ class _ReadOverPageState extends State<ReadOverPage> {
@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,
@ -249,7 +304,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,
@ -259,11 +315,13 @@ 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); return $reviewedItem(
jobTaskItem: item, type: type, subjectName: subjectName);
}), }),
) )
: 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(
@ -271,11 +329,6 @@ Widget $easyRefresh({
jobTaskItem: item, jobTaskItem: item,
type: type, type: type,
); );
/*HomeworkTasksViewItem(
completed: completed,
jobTaskItem: data[index],
call: () => controller.callRefresh(),
);*/
}, },
itemCount: data.length, itemCount: data.length,
), ),
@ -286,7 +339,8 @@ Widget $easyRefresh({
} }
@swidget @swidget
Widget $reviewedItem({required Items jobTaskItem, required int type, required String subjectName}) { Widget $reviewedItem(
{required Items jobTaskItem, required int type, required String subjectName}) {
EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w); EdgeInsets padEdg = EdgeInsets.symmetric(horizontal: 10.w);
return InkWell( return InkWell(
@ -294,6 +348,7 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
/* String url = /* String url =
'${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}&completed=${true}'; '${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}&completed=${true}';
RouterManager.router.navigateTo(context, url, transition: getTransition());*/ RouterManager.router.navigateTo(context, url, transition: getTransition());*/
Get.toNamed(Routes.annotateClassPage,arguments: {'id':jobTaskItem.id,'name':jobTaskItem.name,'grade':jobTaskItem.grade});
}, },
child: Container( child: Container(
padding: EdgeInsets.only(top: 10.h), padding: EdgeInsets.only(top: 10.h),
@ -324,7 +379,9 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
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.fromRGBO(104, 136, 253, 1) : const Color.fromRGBO(255, 175, 56, 1), color: type == 1
? const Color.fromRGBO(104, 136, 253, 1)
: const Color.fromRGBO(255, 175, 56, 1),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(14.r), topLeft: Radius.circular(14.r),
topRight: Radius.circular(3.r), topRight: Radius.circular(3.r),
@ -333,10 +390,13 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
), ),
), ),
margin: EdgeInsets.only(right: 4.w), 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( Expanded(
child: quickText(jobTaskItem.name, size: 14.sp, color: const Color.fromRGBO(70, 70, 70, 1), maxLines: 2), child: quickText(jobTaskItem.name, size: 14.sp,
color: const Color.fromRGBO(70, 70, 70, 1),
maxLines: 2),
) )
], ],
), ),
@ -347,12 +407,16 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
quickText(DateTime.parse(jobTaskItem.publishTime).toString().substring(0,10), quickText(
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.fromRGBO(76, 199, 147, 1), 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.fromRGBO(76, 199, 147, 1), color: const Color.fromRGBO(76, 199, 147, 1),
@ -363,7 +427,9 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
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), 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.fromRGBO(116, 145, 253, 1), color: const Color.fromRGBO(116, 145, 253, 1),
@ -382,17 +448,15 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
),*/ ),*/
GestureDetector( GestureDetector(
onTap: () { onTap: () {
/* RouterManager.router.navigateTo( Get.toNamed(Routes.jobReportPage,arguments: {'title':jobTaskItem.name,'homeworkId':jobTaskItem.id,'grade':jobTaskItem.grade});
context,
RouterManager.jobReportPagePath +
'?title=${Uri.encodeComponent(jobTaskItem.title)}&id=${jobTaskItem.id}',
transition: getTransition(),
);*/
}, },
child: Container( child: 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(
@ -407,7 +471,9 @@ Widget $reviewedItem({required Items jobTaskItem, required int type, required St
Expanded( Expanded(
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

@ -154,11 +154,6 @@ class _TaskListItemState extends State<TaskListItem> {
: :
InkWell( InkWell(
onTap: () { onTap: () {
/*String url =
'${RouterManager.jobListParticipateInClassPath}?&jobId=${jobTaskItem.id}&genderName=${Uri.encodeComponent(jobTaskItem.genderName)}&jobName=${Uri.encodeComponent(jobTaskItem.title)}';
RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value != null && value == true) call();
});*/
Get.toNamed(Routes.annotateClassPage,arguments: {'id':widget.jobTaskItem.id,'name':widget.jobTaskItem.name,'grade':widget.jobTaskItem.grade}); Get.toNamed(Routes.annotateClassPage,arguments: {'id':widget.jobTaskItem.id,'name':widget.jobTaskItem.name,'grade':widget.jobTaskItem.grade});
}, },
child: Stack( child: Stack(
@ -264,7 +259,7 @@ class _TaskListItemState extends State<TaskListItem> {
radius: 40.r, radius: 40.r,
lineWidth: 10.r, lineWidth: 10.r,
animation: true, animation: true,
percent: widget.jobTaskItem.annotateRate / 100, percent: widget.jobTaskItem.annotateRate==null?0:widget.jobTaskItem.annotateRate! / 100,
center: Text.rich(TextSpan(children: [ center: Text.rich(TextSpan(children: [
TextSpan( TextSpan(
text: Utils.getDoubleRemoveZero(widget.jobTaskItem.annotateRate, '0'), text: Utils.getDoubleRemoveZero(widget.jobTaskItem.annotateRate, '0'),

View File

@ -25,7 +25,7 @@ class _StudentHistoryWorkPageState extends State<StudentHistoryWorkPage> {
appBar: AppBar( appBar: AppBar(
backgroundColor: Colors.white, backgroundColor: Colors.white,
title: Text( title: Text(
'我的学生分组', '我的班级 ',
style: TextStyle(fontSize: 14.sp, color: const Color(0xFF333333)), style: TextStyle(fontSize: 14.sp, color: const Color(0xFF333333)),
), ),
centerTitle: true, centerTitle: true,

View File

@ -9,16 +9,19 @@ class JobConditionFilter extends StatefulWidget {
final TabController controller; final TabController controller;
final int jobType; final int jobType;
final PickerDateRange? customTime; final PickerDateRange? customTime;
final Function refreshTime; final Function? refreshTime;
final String customTimeStr; final String customTimeStr;
final bool? hasAll;
final Function(String? startTime, String? endTime) onTimeFilter; final Function(String? startTime, String? endTime) onTimeFilter;
const JobConditionFilter({Key? key, const JobConditionFilter({Key? key,
required this.controller, required this.controller,
required this.jobType, required this.jobType,
this.customTime, this.customTime,
required this.refreshTime, this.refreshTime,
required this.customTimeStr, required this.customTimeStr,
required this.onTimeFilter}) : super(key: key); required this.onTimeFilter,
this.hasAll = false,
}) : super(key: key);
@override @override
State<JobConditionFilter> createState() => _JobConditionFilterState(); State<JobConditionFilter> createState() => _JobConditionFilterState();
@ -68,18 +71,66 @@ class _JobConditionFilterState extends State<JobConditionFilter> {
child: PersonalDetailTopBar( child: PersonalDetailTopBar(
controller: widget.controller, controller: widget.controller,
customTimeStr: widget.customTimeStr, customTimeStr: widget.customTimeStr,
hasAll: widget.hasAll,
onTap: (int val) async { onTap: (int val) async {
switch (val) { if(val == 0 && widget.hasAll == true){
/*case 0: // widget.onTimeFilter(null, null);
}else if(val == 1 || (val == 0 && widget.hasAll == false)){
widget.onTimeFilter(
Utils.getWeekStartDate().toString().substring(0, 10),
Utils.getWeekEndDate().toString().substring(0, 10),
);
}else if(val == 2 || (val == 1 && widget.hasAll == false)){
widget.onTimeFilter(
getMonthStartDate().toString().substring(0, 10),
getMonthEndDate().toString().substring(0, 10),
);
}else{
var dialogData = await showDialog<PickerDateRange?>(
context: context,
builder: (BuildContext context1) {
return Center(
child: Container(
color: Colors.white,
width: Utils.isPad() ? ScreenUtil().screenWidth / 2 : ScreenUtil().screenWidth / 1.3,
height: ScreenUtil().screenHeight / 2,
child: SfDateRangePicker(
showActionButtons: true,
confirmText: '确定',
cancelText: '取消',
onSubmit: (p0) {
print(p0);
Get.back(result: p0);
// Navigator.of(context1).pop(p0);
widget.refreshTime!(p0);
},
onCancel: () {
Get.back();
// Navigator.of(context1).pop();
},
selectionMode: DateRangePickerSelectionMode.range,
initialSelectedRange: customTimeState,
),
),
);
});
widget.onTimeFilter(
dialogData?.startDate?.toString().substring(0, 10),
dialogData?.endDate?.toString().substring(0, 10),
);
customTimeState = dialogData!;
}
/* switch (val) {
case 0: //
widget.onTimeFilter(null, null); widget.onTimeFilter(null, null);
break;*/ break;
case 0: // case 1: //
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),
); );
break; break;
case 1: // case 2: //
widget.onTimeFilter( widget.onTimeFilter(
getMonthStartDate().toString().substring(0, 10), getMonthStartDate().toString().substring(0, 10),
getMonthEndDate().toString().substring(0, 10), getMonthEndDate().toString().substring(0, 10),
@ -102,7 +153,7 @@ class _JobConditionFilterState extends State<JobConditionFilter> {
print(p0); print(p0);
Get.back(result: p0); Get.back(result: p0);
// Navigator.of(context1).pop(p0); // Navigator.of(context1).pop(p0);
widget.refreshTime(p0); widget.refreshTime!(p0);
}, },
onCancel: () { onCancel: () {
Get.back(); Get.back();
@ -119,7 +170,7 @@ class _JobConditionFilterState extends State<JobConditionFilter> {
dialogData?.endDate?.toString().substring(0, 10), dialogData?.endDate?.toString().substring(0, 10),
); );
customTimeState = dialogData!; customTimeState = dialogData!;
} }*/
}, },
), ),
); );

View File

@ -1,3 +1,4 @@
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.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/job/work_student_params.dart'; import 'package:school_asignment_app/common/job/work_student_params.dart';
@ -8,9 +9,12 @@ import 'home_state.dart';
class HomeLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin { class HomeLogic extends GetxController with RequestToolMixin, GetTickerProviderStateMixin {
final HomeState state = HomeState(); final HomeState state = HomeState();
late final EasyRefreshController refreshController;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
refreshController = EasyRefreshController();
getList(); getList();
} }
void getList() async { void getList() async {
@ -19,10 +23,12 @@ class HomeLogic extends GetxController with RequestToolMixin, GetTickerProviderS
); );
WorkStudent data = await getClient().getUnAnnotateList(params); WorkStudent data = await getClient().getUnAnnotateList(params);
UserStore.to.readOver.value = data.items.length; UserStore.to.readOver.value = data.items.length;
state.workList.value = data.items;
refreshController.finishRefresh();
} }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
refreshController.dispose();
} }
} }

View File

@ -1,6 +1,7 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:school_asignment_app/common/job/user_info.dart'; import 'package:school_asignment_app/common/job/user_info.dart';
import 'package:school_asignment_app/common/store/user_store.dart'; import 'package:school_asignment_app/common/store/user_store.dart';
import 'package:school_asignment_app/common/job/work_student.dart';
class HomeState { class HomeState {
HomeState() { HomeState() {
@ -9,5 +10,6 @@ class HomeState {
late Rx<UserInfo?> userInfo; late Rx<UserInfo?> userInfo;
late RxInt readOver = UserStore.to.readOver; late RxInt readOver = UserStore.to.readOver;
late RxList<Items> workList = RxList();
late int type = 1;
} }

View File

@ -1,10 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.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';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:badges/badges.dart' as badges; import 'package:badges/badges.dart' as badges;
import 'package:percent_indicator/percent_indicator.dart';
import 'package:school_asignment_app/common/job/work_student.dart';
import 'package:school_asignment_app/common/utils/enum_untils.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/global_widget/MyEmptyWidget.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/routes/app_pages.dart'; import 'package:school_asignment_app/routes/app_pages.dart';
@ -38,7 +43,7 @@ class _HomePageState extends State<HomePage>
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.light, statusBarBrightness: Brightness.light,
), ),
child: ListView( child: Column(
children: [ children: [
Container( Container(
height: 200.h, height: 200.h,
@ -88,8 +93,8 @@ class _HomePageState extends State<HomePage>
) )
], ],
0), 0),
spaceWidth,
$TermRow( /* $TermRow(
context, context,
[ [
EntranceModel( EntranceModel(
@ -97,7 +102,183 @@ class _HomePageState extends State<HomePage>
image: 'assets/images/job_home_marking_set.png', image: 'assets/images/job_home_marking_set.png',
navigationUrl: '') navigationUrl: '')
], ],
0), 0),*/
Expanded(child: Obx(() {
return EasyRefresh(
firstRefresh: false,
taskIndependence: true,
controller: logic.refreshController,
header: MaterialHeader(),
footer: TaurusFooter(),
child: ListView.builder(
padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w),
itemBuilder: (context, index) {
Items item = state.workList[index];
return InkWell(
onTap: () {
Get.toNamed(Routes.annotateClassPage, arguments: {
'id': item.id,
'name': item.name,
'grade': item.grade
});
},
child: 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(
borderRadius: BorderRadius.circular(6.r),
color: const Color.fromRGBO(255, 255, 255, 1),
boxShadow: const [
BoxShadow(
color: Color.fromRGBO(210, 216, 241, 1),
offset: Offset.zero, //y轴偏移量
blurRadius: 5.8, //
spreadRadius: 0, //
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: Utils.isPad() ? 32.w : 38.w,
height: 18.h,
alignment: Alignment.center,
padding: EdgeInsets.only(
left: Utils.isPad() ? 2.w : 3.w),
decoration: BoxDecoration(
color: state.type == 1
? const Color.fromRGBO(
104, 136, 253, 1)
: const Color.fromRGBO(
255, 175, 56, 1),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(14.r),
topRight: Radius.circular(3.r),
bottomLeft: Radius.circular(4.r),
bottomRight: Radius.circular(4.r),
),
),
margin: EdgeInsets.only(right: 4.w),
child: quickText(
state.type == 1 ? '作业' : '考试',
color: Colors.white,
size: 10.sp),
),
Expanded(
child: quickText(
item.name,
maxLines: 2,
size: Utils.isPad() ? 14.sp : 16.sp,
color:
const Color.fromRGBO(70, 70, 70, 1),
fontWeight: FontWeight.bold,
),
)
],
),
SizedBox(height: 10.h),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(
EnumUtils.formatSubject(item.subject),
color:
const Color.fromRGBO(97, 97, 97, 1),
size: 12.sp,
),
quickText(' / ',
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp,
fontWeight: FontWeight.w500),
Container(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
quickText('题量:',
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp),
quickText(
'10',
color: const Color.fromRGBO(
97, 97, 97, 1),
size: 13.sp,
),
],
),
),
quickText(' / ',
color: const Color.fromRGBO(
130, 130, 130, 1),
size: 11.sp,
fontWeight: FontWeight.w500),
quickText(
DateTime.parse(item.publishTime)
.toString()
.substring(0, 10),
color:
const Color.fromRGBO(97, 97, 97, 1),
size: 12.sp),
],
),
SizedBox(height: 10.h),
Row(
children: [
Expanded(
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(10.r),
),
child: LinearPercentIndicator(
padding: EdgeInsets.zero,
animation: true,
lineHeight: 8.h,
animationDuration: 2500,
percent: item.annotateRate == null?0:item.annotateRate! / 100,
progressColor:
const Color(0xFF6888FD),
backgroundColor:
const Color(0xFFE8E8E8),
barRadius: Radius.circular(10.r),
),
),
),
SizedBox(
width: 10.r,
),
quickText(
'${item.annotateRate!.toStringAsFixed(0)}%',
size: 10.sp,
color: const Color(0xFF464646)),
],
),
// FavoriteButton(jobTaskItem.id, jobTaskItem.title),
],
),
),
],
),
),
);
},
itemCount: state.workList.length,
),
);
})),
], ],
), ),
); );
@ -181,8 +362,8 @@ Widget $TermItem(BuildContext context, EntranceModel e, int data,
borderRadius: BorderRadius.all(Radius.circular(8.r)), borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Get.toNamed(e.navigationUrl,arguments: {'page':e.page??''}); Get.toNamed(e.navigationUrl, arguments: {'page': e.page ?? ''});
}, },
// splashColor: splashColor, // splashColor: splashColor,
borderRadius: BorderRadius.all(Radius.circular(8.r)), borderRadius: BorderRadius.all(Radius.circular(8.r)),