待批阅分页

This commit is contained in:
machuanyu 2025-04-22 11:00:48 +08:00
parent 094f0385dc
commit 9d760da027
2 changed files with 115 additions and 91 deletions

View File

@ -37,20 +37,23 @@ class _AnnotateListState extends State<AnnotateList>
int active = 1; int active = 1;
late RxList<Items> unAnnotateList = RxList(); late RxList<Items> unAnnotateList = RxList();
late RxList<Items> annotateList = RxList(); late RxList<Items> annotateList = RxList();
late int page = 1;
// late int page = 1;
late TabController tabController2; late TabController tabController2;
/* 待阅卷 */ /* 待阅卷 */
late final EasyRefreshController refreshController1; late final EasyRefreshController refreshController1;
late final EasyRefreshController refreshController2; late final EasyRefreshController refreshController2;
WorkStudentParams params = WorkStudentParams( WorkStudentParams params = WorkStudentParams(
assessType: 0, assessType: 0,
pageSize: 10, pageSize: 10,
pageNumber: 1,
); );
WorkStudentParams params2 = WorkStudentParams( WorkStudentParams params2 = WorkStudentParams(
assessType: 0, assessType: 0,
pageSize: 10, pageSize: 10,
pageNumber: 1,
startDate: Utils.getWeekStartDate().toString().substring(0, 10), startDate: Utils.getWeekStartDate().toString().substring(0, 10),
endDate: Utils.getWeekEndDate().toString().substring(0, 10), endDate: Utils.getWeekEndDate().toString().substring(0, 10),
); );
@ -67,32 +70,41 @@ class _AnnotateListState extends State<AnnotateList>
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
getUnAnnotateList(); getUnAnnotateList();
getAnnotateList(); getAnnotateList();
} }
// //
void getUnAnnotateList() async { void getUnAnnotateList() async {
WorkStudent data = WorkStudent([], 0); WorkStudent data = WorkStudent([], 0);
params.pageNumber = page;
data = await getClient().getUnAnnotateList(params); data = await getClient().getUnAnnotateList(params);
unAnnotateList.value = data.items; if (params.pageNumber == 1) {
unAnnotateList.value = data.items;
} else {
List<Items> list = unAnnotateList.value;
unAnnotateList.value = [...list,...data.items];
}
refreshController1.finishRefresh(); refreshController1.finishRefresh();
refreshController2.finishRefresh(); refreshController2.finishRefresh();
EasyLoading.dismiss(); EasyLoading.dismiss();
print('state.unAnnotateList.length=${unAnnotateList.length}'); print('state.unAnnotateList.length=${unAnnotateList.length}');
} }
// //
void getAnnotateList() async { void getAnnotateList() async {
WorkStudent data = WorkStudent([], 0); WorkStudent data = WorkStudent([], 0);
params2.pageNumber = page;
data = await getClient().getAnnotatedList(params2); data = await getClient().getAnnotatedList(params2);
if (params2.pageNumber == 1) {
annotateList.value = data.items;
} else {
List<Items> list = annotateList.value;
annotateList.value = [...list,...data.items];
}
annotateList.value = data.items;
refreshController1.finishRefresh(); refreshController1.finishRefresh();
refreshController2.finishRefresh(); refreshController2.finishRefresh();
EasyLoading.dismiss(); EasyLoading.dismiss();
print('state.annotateList.length=${annotateList.length}'); print('state.annotateList.length=${annotateList.length}');
} }
/// ///
Future<void> onMyRefresh(EasyRefreshController controller, int tab) async { Future<void> onMyRefresh(EasyRefreshController controller, int tab) async {
/* params.page = RequestConfig.basePage.page; /* params.page = RequestConfig.basePage.page;
@ -102,8 +114,10 @@ class _AnnotateListState extends State<AnnotateList>
} catch (e) {} } catch (e) {}
toUpState(setState, () {}, mounted);*/ toUpState(setState, () {}, mounted);*/
if (widget.tabIndex == 0) { if (widget.tabIndex == 0) {
params.pageNumber = 1;
getUnAnnotateList(); getUnAnnotateList();
} else { } else {
params2.pageNumber = 1;
getAnnotateList(); getAnnotateList();
} }
} }
@ -125,14 +139,20 @@ class _AnnotateListState extends State<AnnotateList>
tab == 1 ? markingDatas1.addAll(lists) : markingDatas2.addAll(lists); tab == 1 ? markingDatas1.addAll(lists) : markingDatas2.addAll(lists);
toUpState(setState, () {}, mounted); toUpState(setState, () {}, mounted);
}*/ }*/
if (widget.tabIndex == 0) {
params.pageNumber++;
getUnAnnotateList();
} else {
params2.pageNumber++;
getAnnotateList();
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
if(widget.tabIndex == 1) if (widget.tabIndex == 1)
Obx(() { Obx(() {
return JobConditionFilter( return JobConditionFilter(
customTimeStr: customTimeStr.value, customTimeStr: customTimeStr.value,
@ -140,16 +160,19 @@ class _AnnotateListState extends State<AnnotateList>
hasAll: true, hasAll: true,
jobType: 1, jobType: 1,
customTime: tabController2.index != 2 || customTime: tabController2.index != 2 ||
(params2.startDate == null && params2.endDate == null) (params2.startDate == null && params2.endDate == null)
? null ? null
: PickerDateRange( : PickerDateRange(
params2.startDate == null ? null : DateTime.parse( params2.startDate == null
params2.startDate!), ? null
params2.endDate == null ? null : DateTime.parse( : DateTime.parse(params2.startDate!),
params2.endDate!), params2.endDate == null
), ? null
: DateTime.parse(params2.endDate!),
),
onTimeFilter: (String? startTime, String? endTime) { onTimeFilter: (String? startTime, String? endTime) {
if (startTime == null && endTime == null && if (startTime == null &&
endTime == null &&
tabController2.index == 2) { tabController2.index == 2) {
tabController2.animateTo(0); tabController2.animateTo(0);
params2.endDate = params2.endDate =
@ -161,7 +184,7 @@ class _AnnotateListState extends State<AnnotateList>
params2.endDate = endTime; params2.endDate = endTime;
params2.startDate = startTime; params2.startDate = startTime;
} }
page = 1; params2.pageNumber = 1;
EasyLoading.show(status: 'loading...'); EasyLoading.show(status: 'loading...');
if (widget.tabIndex == 0) { if (widget.tabIndex == 0) {
getUnAnnotateList(); getUnAnnotateList();
@ -179,18 +202,17 @@ class _AnnotateListState extends State<AnnotateList>
if (!Utils.isPad() && if (!Utils.isPad() &&
value.startDate!.year == value.endDate!.year) { value.startDate!.year == value.endDate!.year) {
customTimeStr.value = 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 {
customTimeStr.value = customTimeStr.value =
'${customTimeStr.value}~${value.endDate?.toString() '${customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
.substring(0, 10)}';
} }
} }
} }
}); });
}), }),
Expanded(child: IndexedStack( Expanded(
child: IndexedStack(
index: widget.tabIndex, index: widget.tabIndex,
children: <Widget>[ children: <Widget>[
$EasyRefresh( $EasyRefresh(
@ -222,10 +244,10 @@ class _AnnotateListState extends State<AnnotateList>
@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,
@ -245,39 +267,39 @@ Widget $easyRefresh({
footer: TaurusFooter(), footer: TaurusFooter(),
child: completed && isPadFlag child: completed && isPadFlag
? GridView( ? GridView(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), 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,
crossAxisSpacing: 6.w, crossAxisSpacing: 6.w,
childAspectRatio: 1.81 //1widget childAspectRatio: 1.81 //1widget
), ),
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, return $reviewedItem(
type: type, jobTaskItem: item,
subjectName: subjectName, type: type,
collectFun: collectFun, subjectName: subjectName,
tabIndex: tab - 1); collectFun: collectFun,
}), tabIndex: tab - 1);
) }),
)
: ListView.builder( : ListView.builder(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 11.h, bottom: 10.h, left: 12.w, right: 12.w), 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, ),
),
onRefresh: () => onRefresh(controller, tab), onRefresh: () => onRefresh(controller, tab),
onLoad: () => onLoad(controller, tab), onLoad: () => onLoad(controller, tab),
); );
@ -296,15 +318,14 @@ Widget $reviewedItem({
return InkWell( return InkWell(
onTap: () { onTap: () {
Get.toNamed(Routes.annotateClassPage, Get.toNamed(Routes.annotateClassPage, arguments: {
arguments: { 'id': jobTaskItem.id,
'id': jobTaskItem.id, 'name': jobTaskItem.name,
'name': jobTaskItem.name, 'grade': jobTaskItem.grade,
'grade': jobTaskItem.grade, 'subject': jobTaskItem.subject,
'subject': jobTaskItem.subject, 'completed': true,
'completed': true, 'tabIndex': tabIndex
'tabIndex': tabIndex });
});
}, },
child: Container( child: Container(
padding: EdgeInsets.only(top: 10.h), padding: EdgeInsets.only(top: 10.h),
@ -328,7 +349,6 @@ Widget $reviewedItem({
padding: padEdg, padding: padEdg,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 32.w, width: 32.w,
@ -336,8 +356,9 @@ Widget $reviewedItem({
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(0xFF4CC793) : const Color color: type == 1
.fromRGBO(255, 175, 56, 1), ? const Color(0xFF4CC793)
: 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),
@ -346,11 +367,12 @@ Widget $reviewedItem({
), ),
), ),
margin: EdgeInsets.only(top: 3.h, right: 4.w), margin: EdgeInsets.only(top: 3.h, 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),
), ),
@ -373,13 +395,15 @@ Widget $reviewedItem({
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(
@ -392,7 +416,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(
@ -414,7 +439,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), borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(6.r),
bottomRight: Radius.circular(6.r)), bottomRight: Radius.circular(6.r)),
color: Colors.white, color: Colors.white,
boxShadow: const [ boxShadow: const [
@ -441,11 +467,12 @@ Widget $reviewedItem({
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border(right: BorderSide( border: Border(
width: 1.r, color: const Color(0xFFDCDCDC))), right: BorderSide(
width: 1.r, color: const Color(0xFFDCDCDC))),
), ),
child: quickText( child: quickText('收集订正',
'收集订正', color: const Color(0xFF4CC793), size: 11.sp), color: const Color(0xFF4CC793), size: 11.sp),
), ),
), ),
), ),
@ -454,17 +481,16 @@ Widget $reviewedItem({
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Get.toNamed(Routes.jobReportPage, Get.toNamed(Routes.jobReportPage, arguments: {
arguments: { 'title': jobTaskItem.name,
'title': jobTaskItem.name, 'homeworkId': jobTaskItem.id,
'homeworkId': jobTaskItem.id, 'grade': jobTaskItem.grade
'grade': jobTaskItem.grade });
});
}, },
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
child: quickText( child: quickText('查看报告',
'查看报告', color: const Color.fromRGBO(118, 118, 118, 1), color: const Color.fromRGBO(118, 118, 118, 1),
size: 11.sp), size: 11.sp),
), ),
), ),

View File

@ -5,7 +5,6 @@
import FlutterMacOS import FlutterMacOS
import Foundation import Foundation
import app_settings
import auto_updater_macos import auto_updater_macos
import connectivity_plus import connectivity_plus
import device_info_plus import device_info_plus
@ -15,7 +14,6 @@ import sqflite
import url_launcher_macos import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AppSettingsPlugin.register(with: registry.registrar(forPlugin: "AppSettingsPlugin"))
AutoUpdaterMacosPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterMacosPlugin")) AutoUpdaterMacosPlugin.register(with: registry.registrar(forPlugin: "AutoUpdaterMacosPlugin"))
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))