待批阅分页

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

View File

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