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