no message

This commit is contained in:
1147192855@qq.com 2024-04-28 13:47:29 +08:00
parent 3944a72ab6
commit afeb05272e
2 changed files with 80 additions and 169 deletions

3
.gitignore vendored
View File

@ -227,3 +227,6 @@ marking_app/lib/common/model/marking/marking_history_zoom_info.g.dart
marking_app/lib/common/model/job/job_handwriting.g.dart marking_app/lib/common/model/job/job_handwriting.g.dart
marking_app/lib/utils/my_time_util.g.dart marking_app/lib/utils/my_time_util.g.dart
marking_app/lib/pages/homework_correction/widget/answer_handwriting.g.dart marking_app/lib/pages/homework_correction/widget/answer_handwriting.g.dart
marking_app/lib/pages/report_detail/report_history.g.dart
marking_app/lib/common/model/report/report_student_history_record.g.dart
marking_app/lib/common/model/report/report_student_info.g.dart

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_hooks/flutter_hooks.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:marking_app/common/mixin/common.dart'; import 'package:marking_app/common/mixin/common.dart';
@ -13,24 +14,22 @@ import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart';
import 'package:marking_app/utils/index.dart'; import 'package:marking_app/utils/index.dart';
import 'package:marking_app/utils/request/rest_client_report.dart'; import 'package:marking_app/utils/request/rest_client_report.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'package:syncfusion_flutter_datepicker/datepicker.dart';
part 'report_history.g.dart';
class ReportHistory extends StatefulWidget { class ReportHistory extends StatefulWidget {
final int userId; final int userId;
final int classId; final int classId;
final String studentName; final String studentName;
const ReportHistory({Key? key, required this.classId, required this.userId,required this.studentName}) const ReportHistory({Key? key, required this.classId, required this.userId, required this.studentName}) : super(key: key);
: super(key: key);
@override @override
State<ReportHistory> createState() => _ReportHistoryState(); State<ReportHistory> createState() => _ReportHistoryState();
} }
class _ReportHistoryState extends State<ReportHistory> class _ReportHistoryState extends State<ReportHistory> with CommonMixin, TickerProviderStateMixin {
with CommonMixin, TickerProviderStateMixin {
bool isWork = true; bool isWork = true;
String startDataTime = String startDataTime = CommonUtils.getWeekStartDate().toString().substring(0, 10);
CommonUtils.getWeekStartDate().toString().substring(0, 10);
String endDataTime = CommonUtils.getWeekEndDate().toString().substring(0, 10); String endDataTime = CommonUtils.getWeekEndDate().toString().substring(0, 10);
String customTimeStr = '自定义'; String customTimeStr = '自定义';
late TabController tabController; late TabController tabController;
@ -48,8 +47,7 @@ class _ReportHistoryState extends State<ReportHistory>
} }
void getList() async { void getList() async {
if (startDataTime == DateTime.now().toString().substring(0, 10) || if (startDataTime == DateTime.now().toString().substring(0, 10) || DateTime.parse(startDataTime).isAfter(DateTime.now())) {
DateTime.parse(startDataTime).isAfter(DateTime.now())) {
DateTime now = DateTime.parse(startDataTime); DateTime now = DateTime.parse(startDataTime);
endDataTime = now.add(Duration(days: 1)).toString().substring(0, 10); endDataTime = now.add(Duration(days: 1)).toString().substring(0, 10);
print(now.add(Duration(days: 1))); print(now.add(Duration(days: 1)));
@ -59,8 +57,7 @@ class _ReportHistoryState extends State<ReportHistory>
RestClientReport clientReport = await getClientReport(); RestClientReport clientReport = await getClientReport();
BaseStructureResultReport<List<ReportStudentHistoryRecord>> res = BaseStructureResultReport<List<ReportStudentHistoryRecord>> res =
// 488491659239519, 488491659190341, '2023-03-08', '2024-04-19' // 488491659239519, 488491659190341, '2023-03-08', '2024-04-19'
await clientReport.getStudentHistroyRecords( await clientReport.getStudentHistroyRecords(widget.userId, widget.classId, startDataTime, endDataTime);
widget.userId, widget.classId, startDataTime, endDataTime);
if (res.success) { if (res.success) {
setState(() { setState(() {
dataList = res.data!; dataList = res.data!;
@ -162,55 +159,48 @@ class _ReportHistoryState extends State<ReportHistory>
SizedBox( SizedBox(
height: 10.r, height: 10.r,
), ),
jobConditionFilter(context, JobConditionFilter(
controller: tabController, controller: tabController,
customTimeStr: customTimeStr, customTimeStr: customTimeStr,
customTime: tabController.index != 3 || customTime: tabController.index != 3 || ((endDataTime == null || endDataTime == '') && (startDataTime == null || startDataTime == ''))
((endDataTime == null || endDataTime == '') &&
(startDataTime == null || startDataTime == ''))
? null ? null
: PickerDateRange( : PickerDateRange(
startDataTime == null || startDataTime == '' startDataTime == null || startDataTime == '' ? null : DateTime.parse(startDataTime!),
? null endDataTime == null || endDataTime == '' ? null : DateTime.parse(endDataTime!),
: DateTime.parse(startDataTime!), ),
endDataTime == null || endDataTime == '' onTimeFilter: (String? startTime, String? endTime) {
? null if (startTime == null && endTime == null) {
: DateTime.parse(endDataTime!), if (tabController.index == 3) {
), onTimeFilter: (String? startTime, String? endTime) { tabController.animateTo(0);
if (startTime == null && endTime == null) { }
if (tabController.index == 3) { startDataTime = '';
tabController.animateTo(0); endDataTime = '';
} customTimeStr = '自定义';
startDataTime = '';
endDataTime = '';
customTimeStr = '自定义';
} else {
EasyLoading.show(status: 'loading...');
startDataTime = startTime != null ? startTime : '';
endDataTime = endTime != null ? endTime : '';
setState(() {});
getList();
}
// _refreshController2.callRefresh();
}, refreshTime: (value) {
if (value != null && value.startDate != null) {
customTimeStr =
value.startDate?.toString().substring(0, 10) ?? '';
setState(() {});
if (value.endDate != null) {
if (value.startDate!.year == value.endDate!.year) {
customTimeStr = value.startDate.toString().substring(5, 10) +
'~${value.endDate.toString().substring(5, 10)}';
setState(() {});
} else { } else {
customTimeStr = EasyLoading.show(status: 'loading...');
'$customTimeStr~${value.endDate?.toString().substring(0, 10)}'; startDataTime = startTime != null ? startTime : '';
endDataTime = endTime != null ? endTime : '';
setState(() {}); setState(() {});
getList();
} }
}
} // _refreshController2.callRefresh();
}), },
refreshTime: (value) {
if (value != null && value.startDate != null) {
customTimeStr = value.startDate?.toString().substring(0, 10) ?? '';
setState(() {});
if (value.endDate != null) {
if (value.startDate!.year == value.endDate!.year) {
customTimeStr = value.startDate.toString().substring(5, 10) + '~${value.endDate.toString().substring(5, 10)}';
setState(() {});
} else {
customTimeStr = '$customTimeStr~${value.endDate?.toString().substring(0, 10)}';
setState(() {});
}
}
}
}),
Expanded( Expanded(
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(vertical: 14.r, horizontal: 14.r), padding: EdgeInsets.symmetric(vertical: 14.r, horizontal: 14.r),
@ -229,8 +219,9 @@ class _ReportHistoryState extends State<ReportHistory>
itemBuilder: (context, index) { itemBuilder: (context, index) {
ReportStudentHistoryRecord item = dataList[index]; ReportStudentHistoryRecord item = dataList[index];
return InkWell( return InkWell(
onTap: (){ onTap: () {
RouterManager.router.navigateTo(context, '${RouterManager.completedReportPath}?examId=${item.examId}&studentNo=${item.studentExamNum}'); RouterManager.router
.navigateTo(context, '${RouterManager.completedReportPath}?examId=${item.examId}&studentNo=${item.studentExamNum}');
}, },
child: Container( child: Container(
// padding: EdgeInsets.all(6.r), // padding: EdgeInsets.all(6.r),
@ -238,13 +229,10 @@ class _ReportHistoryState extends State<ReportHistory>
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: AssetImage('assets/images/report_student_history_bg.png'),
'assets/images/report_student_history_bg.png'),
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
border: Border.all( border: Border.all(width: 1.r, color: Color.fromRGBO(46, 91, 255, 0.2)),
width: 1.r,
color: Color.fromRGBO(46, 91, 255, 0.2)),
borderRadius: BorderRadius.circular(5.r), borderRadius: BorderRadius.circular(5.r),
), ),
child: Column( child: Column(
@ -257,21 +245,16 @@ class _ReportHistoryState extends State<ReportHistory>
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Text( Text(
item.examName, item.examName,
style: TextStyle( style: TextStyle(fontSize: 12.sp, color: Color(0xFF000000)),
fontSize: 12.sp,
color: Color(0xFF000000)),
), ),
Spacer(), Spacer(),
Text( Text(
item.examStartTime, item.examStartTime,
style: TextStyle( style: TextStyle(fontSize: 12.sp, color: Color(0xFF4A4A4A)),
fontSize: 12.sp,
color: Color(0xFF4A4A4A)),
) )
], ],
), ),
@ -280,8 +263,7 @@ class _ReportHistoryState extends State<ReportHistory>
height: 2.r, height: 2.r,
), ),
Container( Container(
padding: padding: EdgeInsets.symmetric(horizontal: 10.r),
EdgeInsets.symmetric(horizontal: 10.r),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.r), borderRadius: BorderRadius.circular(5.r),
), ),
@ -291,118 +273,54 @@ class _ReportHistoryState extends State<ReportHistory>
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Row( child: Row(
children: List.generate( children: List.generate(item.scoreInfo.length, (i) {
item.scoreInfo.length, (i) { ScoreInfo score = item.scoreInfo[i];
ScoreInfo score =
item.scoreInfo[i];
return Row( return Row(
children: [ children: [
Column( Column(
children: [ children: [
Container( Container(
height: 22.r, height: 22.r,
width: item.scoreInfo width: item.scoreInfo.length > 4
.length >
4
? 90.r ? 90.r
: (MediaQuery.of( : (MediaQuery.of(context).size.width - 48.r - (item.scoreInfo.length - 1) * 1.5.r) /
context) item.scoreInfo.length,
.size decoration: BoxDecoration(
.width -
48.r -
(item.scoreInfo
.length - 1) *
1.5
.r) /
item.scoreInfo
.length,
decoration:
BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: i == 0 topLeft: i == 0 ? Radius.circular(4.r) : Radius.zero,
? Radius topRight: i == item.scoreInfo.length - 1 ? Radius.circular(4.r) : Radius.zero),
.circular( color: Color(0xFFECECEC),
4.r)
: Radius
.zero,
topRight: i ==
item.scoreInfo.length -
1
? Radius
.circular(
4.r)
: Radius
.zero),
color: Color(
0xFFECECEC),
), ),
child: Center( child: Center(
child: Text( child: Text(
score.text, score.text,
style: TextStyle( style: TextStyle(fontSize: 12.sp, color: Color(0xFF8A8A8A)),
fontSize:
12.sp,
color: Color(
0xFF8A8A8A)),
), ),
), ),
), ),
Container( Container(
height: 30.r, height: 30.r,
width: item.scoreInfo width: item.scoreInfo.length > 4
.length >
4
? 90.r ? 90.r
: (MediaQuery.of( : (MediaQuery.of(context).size.width - 48.r - (item.scoreInfo.length - 1) * 1.5.r) /
context) item.scoreInfo.length,
.size decoration: BoxDecoration(
.width -
48.r -
(item.scoreInfo
.length - 1) *
1.5.r) /
item.scoreInfo
.length,
decoration:
BoxDecoration(
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
bottomLeft: i == bottomLeft: i == 0 ? Radius.circular(4.r) : Radius.zero,
0 bottomRight: i == item.scoreInfo.length - 1 ? Radius.circular(4.r) : Radius.zero),
? Radius
.circular(
4.r)
: Radius
.zero,
bottomRight: i ==
item.scoreInfo.length -
1
? Radius
.circular(
4.r)
: Radius
.zero),
color: Colors.white, color: Colors.white,
), ),
child: Center( child: Center(
child: Text( child: Text(
score.value score.value.toString(),
.toString(), style: TextStyle(fontSize: 12.sp, color: Color(0xFF4A4A4A)),
style: TextStyle(
fontSize:
12.sp,
color: Color(
0xFF4A4A4A)),
), ),
), ),
), ),
], ],
), ),
SizedBox( SizedBox(
width: i < width: i < item.scoreInfo.length - 1 ? 1.5.r : 0.r,
item.scoreInfo
.length - 1
? 1.5.r
: 0.r,
), ),
], ],
); );
@ -413,9 +331,7 @@ class _ReportHistoryState extends State<ReportHistory>
: Center( : Center(
child: Text( child: Text(
'-暂无数据-', '-暂无数据-',
style: TextStyle( style: TextStyle(fontSize: 12.sp, color: Color(0xFF8A8A8A)),
fontSize: 12.sp,
color: Color(0xFF8A8A8A)),
)), )),
), ),
SizedBox( SizedBox(
@ -445,9 +361,8 @@ Widget jobConditionFilter(BuildContext context,
required Function(String? startTime, String? endTime) onTimeFilter}) { required Function(String? startTime, String? endTime) onTimeFilter}) {
var customTimeState = PickerDateRange(null, null); var customTimeState = PickerDateRange(null, null);
if (customTime != null) { if (customTime != null) {
customTimeState = PickerDateRange( customTimeState =
customTime!.startDate != null ? customTime!.startDate : null, PickerDateRange(customTime!.startDate != null ? customTime!.startDate : null, customTime!.endDate != null ? customTime!.endDate : null);
customTime!.endDate != null ? customTime!.endDate : null);
} }
DateTime getMonthStartDate() { DateTime getMonthStartDate() {
@ -462,9 +377,7 @@ Widget jobConditionFilter(BuildContext context,
nextMonth = 1; nextMonth = 1;
now = now.add(Duration(days: 31 - now.day)); // now = now.add(Duration(days: 31 - now.day)); //
} else { } else {
now = now.add(Duration( now = now.add(Duration(days: DateTime(now.year, nextMonth, 0).day - now.day)); //
days: DateTime(now.year, nextMonth, 0).day -
now.day)); //
} }
return now; return now;
} }
@ -476,13 +389,10 @@ Widget jobConditionFilter(BuildContext context,
), ),
child: Container( child: Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
decoration: BoxDecoration( decoration: BoxDecoration(border: Border(bottom: BorderSide(width: 1.r, color: Color(0xFFCCCCCC)))),
border:
Border(bottom: BorderSide(width: 1.r, color: Color(0xFFCCCCCC)))),
child: TabBar( child: TabBar(
controller: controller, controller: controller,
unselectedLabelStyle: TextStyle( unselectedLabelStyle: TextStyle(fontSize: 12.sp, color: const Color.fromRGBO(102, 102, 102, 1)),
fontSize: 12.sp, color: const Color.fromRGBO(102, 102, 102, 1)),
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -514,9 +424,7 @@ Widget jobConditionFilter(BuildContext context,
return Center( return Center(
child: Container( child: Container(
color: Colors.white, color: Colors.white,
width: isPad() width: isPad() ? ScreenUtil().screenWidth / 2 : ScreenUtil().screenWidth / 1.3,
? ScreenUtil().screenWidth / 2
: ScreenUtil().screenWidth / 1.3,
height: ScreenUtil().screenHeight / 2, height: ScreenUtil().screenHeight / 2,
child: SfDateRangePicker( child: SfDateRangePicker(
showActionButtons: true, showActionButtons: true,