diff --git a/making_school_asignment_app/android/app/src/main/res/drawable/background.png b/making_school_asignment_app/android/app/src/main/res/drawable/background.png index b2901c9..3107d37 100644 Binary files a/making_school_asignment_app/android/app/src/main/res/drawable/background.png and b/making_school_asignment_app/android/app/src/main/res/drawable/background.png differ diff --git a/making_school_asignment_app/lib/common/request/rest_dio.dart b/making_school_asignment_app/lib/common/request/rest_dio.dart index 0e0eef1..8eb6b04 100644 --- a/making_school_asignment_app/lib/common/request/rest_dio.dart +++ b/making_school_asignment_app/lib/common/request/rest_dio.dart @@ -149,7 +149,7 @@ class TheError extends Interceptor { message = '请求发送超时'; break; case DioExceptionType.receiveTimeout: - message = '接收超时时发生'; + message = '接收超时'; break; case DioExceptionType.badResponse: if (error.response == null) { diff --git a/making_school_asignment_app/lib/page/home_page/children/job_report/job_report_view.dart b/making_school_asignment_app/lib/page/home_page/children/job_report/job_report_view.dart index 114b697..a2bc6ad 100644 --- a/making_school_asignment_app/lib/page/home_page/children/job_report/job_report_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/job_report/job_report_view.dart @@ -14,7 +14,7 @@ import 'package:making_school_asignment_app/page/home_page/children/quick_data_c import 'job_report_logic.dart'; class JobReportPage extends StatefulWidget { - const JobReportPage({Key? key}) : super(key: key); + const JobReportPage({super.key}); @override State createState() => _JobReportPageState(); @@ -26,102 +26,100 @@ class _JobReportPageState extends State { @override Widget build(BuildContext context) { - return OrientationBuilder( - builder: (BuildContext context, Orientation orientation){ - return Scaffold( - backgroundColor: Color.fromRGBO(245, 245, 245, 1), - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, - title: Center(child: Obx(() { - return quickText( - '${state.title.value}作业报告', - size: 14.sp, - color: const Color.fromRGBO(51, 51, 51, 1), - ); - })), - leading: IconButton( - icon: const Icon(Icons.arrow_back_ios, color: Colors.black), - onPressed: () => Get.back(), - ), - actions: const [ - ReturnToHomepage(), - ], - ), - body: Obx(() { - if (state.hasData.value) { - return SingleChildScrollView( - child: Column( - children: [ - // 下拉框 - Container( - padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w), - decoration: const BoxDecoration( - color: Colors.white, - ), - child: Row( - children: [ - Obx(() { - return DropdownSelection( - involveClasses: state.involveClasses.value, - classData: state.classData.value, - call: (AnnotatedClass item) { - state.classData.value = item; - if (item.grade == -1) state.classData.value = state.defaultClass; - logic.getWorkData(); - }); - }), - // Expanded(child: Text('')), - ], - ), - ), - //完成率、正确率 - TopCount( - state.dataCount, state.classData == null ? '' : state.classData.value.className, state.homeworkId.value,state.subject), - //客观题、主观题 - KgtZgtTable( - studentCount: state.dataCount.studentCount!, - homeworkId: state.homeworkId.value, - kgReport: state.kgReport, - zgReport: state.zgReport, - kgtOkRate: state.dataCount.kgtOkRate!.toStringAsFixed(0), - zgtOkRate: state.dataCount.zgtOkRate!.toStringAsFixed(0), - kgtCorrectRate: state.dataCount.kgtCorrectRate!.toStringAsFixed(0), - zgtCorrectRate: state.dataCount.zgtCorrectRate!.toStringAsFixed(0), - subject:state.subject), - // 掌握知识点的情况 - Container( - margin: EdgeInsets.symmetric(horizontal: 10.r), - child: KnowledgePoint( - knowsList: state.knowsList, - data: state.homeData, - className: state.classData.value.className, - homeworkId: state.homeworkId.value, - subject:state.subject,)), - // 掌握知识点的情况 - /* Container( + return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { + return Scaffold( + backgroundColor: Color.fromRGBO(245, 245, 245, 1), + appBar: AppBar( + backgroundColor: Colors.white, + centerTitle: true, + title: Center(child: Obx(() { + return quickText( + '${state.title.value}作业报告', + size: 14.sp, + color: const Color.fromRGBO(51, 51, 51, 1), + ); + })), + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios, color: Colors.black), + onPressed: () => Get.back(), + ), + actions: const [ + ReturnToHomepage(), + ], + ), + body: Obx(() { + if (state.hasData.value) { + return SingleChildScrollView( + child: Column( + children: [ + // 下拉框 + Container( + padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w), + decoration: const BoxDecoration( + color: Colors.white, + ), + child: Row( + children: [ + Obx(() { + return DropdownSelection( + involveClasses: state.involveClasses.value, + classData: state.classData.value, + call: (AnnotatedClass item) { + state.classData.value = item; + if (item.grade == -1) state.classData.value = state.defaultClass; + logic.getWorkData(); + }); + }), + // Expanded(child: Text('')), + ], + ), + ), + //完成率、正确率 + TopCount(state.dataCount, state.classData == null ? '' : state.classData.value.className, state.homeworkId.value, state.subject), + //客观题、主观题 + KgtZgtTable( + studentCount: state.dataCount.studentCount!, + homeworkId: state.homeworkId.value, + kgReport: state.kgReport, + zgReport: state.zgReport, + kgtOkRate: state.dataCount.kgtOkRate!.toStringAsFixed(0), + zgtOkRate: state.dataCount.zgtOkRate!.toStringAsFixed(0), + kgtCorrectRate: state.dataCount.kgtCorrectRate!.toStringAsFixed(0), + zgtCorrectRate: state.dataCount.zgtCorrectRate!.toStringAsFixed(0), + subject: state.subject), + // 掌握知识点的情况 + Container( + margin: EdgeInsets.symmetric(horizontal: 10.r), + child: KnowledgePoint( + knowsList: state.knowsList, + data: state.homeData, + className: state.classData.value.className, + homeworkId: state.homeworkId.value, + subject: state.subject, + )), + // 掌握知识点的情况 + /* Container( margin: EdgeInsets.symmetric(horizontal: 10.r), child: $OverallPerformance(data.studentCount, data.overallTitles)), // 单位时间答题情况 Container( margin: EdgeInsets.symmetric(horizontal: 10.r), child: $UnitTimeAnsweringSituation(widget.id, data.questionAnswerInfos)),*/ - // 人员数据概况 - Container(margin: EdgeInsets.symmetric(horizontal: 10.r), child: PersonnelDataOverview(studentList: state.studentList.value)), + // 人员数据概况 + Container(margin: EdgeInsets.symmetric(horizontal: 10.r), child: PersonnelDataOverview(studentList: state.studentList.value)), - SizedBox( - height: 30.r, - ), - ], + SizedBox( + height: 30.r, ), - ); - } else { - return Padding(padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 2 - 200.r), child: const MyEmptyWidget()); - } - }), - ); - } - ); + ], + ), + ); + } else { + return Padding(padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 2 - 200.r), child: const MyEmptyWidget()); + } + }), + ); + }); } @override diff --git a/making_school_asignment_app/lib/page/home_page/children/job_report/widget/knowledge_point.dart b/making_school_asignment_app/lib/page/home_page/children/job_report/widget/knowledge_point.dart index 16eaad1..f1c64fd 100644 --- a/making_school_asignment_app/lib/page/home_page/children/job_report/widget/knowledge_point.dart +++ b/making_school_asignment_app/lib/page/home_page/children/job_report/widget/knowledge_point.dart @@ -268,9 +268,15 @@ class _KnowledgePointState extends State { int ttlCount = stu.queDtls!.length; stu.okRate = Utils.calcRate(okCount, ttlCount); stu.queDtls!.sort((a, b) { - num num1 = num.parse(a.questionNo); - num num2 = num.parse(b.questionNo); - return num1.compareTo(num2); + try { + if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) { + return num.parse(a.questionNo).compareTo(num.parse(b.questionNo)); + } else { + throw Exception(); + } + } catch (e) { + return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase()); + } }); } diff --git a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_logic.dart b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_logic.dart index 29e08b7..8bf9dea 100644 --- a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_logic.dart +++ b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_logic.dart @@ -4,6 +4,8 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/knowledge_points_grasp.dart'; import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart'; +import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; +import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'knowledge_points_grasp_state.dart'; @@ -27,9 +29,15 @@ class KnowledgePointsGraspLogic extends GetxController with RequestToolMixin, Ge } void getList() async { - List data = await getClient().getKnowledgeReport(state.dateStart, state.dateEnd, textController.text,state.classId,state.subject); - state.dataList.value = data; - EasyLoading.dismiss(); + try { + ToastUtils.showLoading(); + List data = + await getClient().getKnowledgeReport(state.dateStart, state.dateEnd, textController.text, state.classId, state.subject); + state.dataList.value = data; + } catch (_) { + } finally { + ToastUtils.dismiss(); + } } @override diff --git a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_view.dart b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_view.dart index 6906d10..766bce8 100644 --- a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp/knowledge_points_grasp_view.dart @@ -1,9 +1,11 @@ +import 'package:easy_debounce/easy_throttle.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/job/knowledge_points_grasp.dart'; +import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart'; import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart'; import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart'; @@ -15,7 +17,7 @@ import 'package:syncfusion_flutter_datepicker/datepicker.dart'; import 'knowledge_points_grasp_logic.dart'; class KnowledgePointsGraspPage extends StatefulWidget { - const KnowledgePointsGraspPage({Key? key}) : super(key: key); + const KnowledgePointsGraspPage({super.key}); @override State createState() => _KnowledgePointsGraspPageState(); @@ -27,145 +29,141 @@ class _KnowledgePointsGraspPageState extends State { @override Widget build(BuildContext context) { - return OrientationBuilder( - builder: (BuildContext context, Orientation orientation){ - return Scaffold( - backgroundColor: Color.fromRGBO(245, 245, 245, 1), - appBar: AppBar( - backgroundColor: Colors.white, - title: Text('知识点掌握', style: TextStyle(fontSize: 14.sp, color: Color(0xFF333333))), - centerTitle: true, - leading: IconButton( - icon: Icon(Icons.arrow_back_ios, color: Colors.black), - onPressed: () => Get.back(), - ), - actions: const [ - ReturnToHomepage(), - ], - elevation: 0, - ), - body: Column( - children: [ - Container( - margin: EdgeInsets.all(15.r), - // height: 30.r, - child: Row( - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10.r, right: 10.r), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.r), - border: Border.all(width: 1.r, color: Color(0xFFDDDDDD)), - color: Colors.white, - ), - child: TextField( - controller: logic.textController, - textInputAction: TextInputAction.next, - style: TextStyle( - color: const Color.fromRGBO(80, 87, 103, 1), - fontSize: 10.sp, - ), - decoration: InputDecoration( - hintText: "请输入知识点名称", - hintStyle: TextStyle(fontSize: 10.sp, color: const Color.fromRGBO(153, 153, 153, 1)), - labelStyle: TextStyle(fontSize: 10.sp, color: const Color.fromRGBO(148, 163, 182, 1)), - border: InputBorder.none, - ), - ), + return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { + return Scaffold( + backgroundColor: const Color.fromRGBO(245, 245, 245, 1), + appBar: AppBar( + backgroundColor: Colors.white, + title: Text('知识点掌握', style: TextStyle(fontSize: 14.sp, color: const Color(0xFF333333))), + centerTitle: true, + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios, color: Colors.black), + onPressed: () => Get.back(), + ), + actions: const [ + ReturnToHomepage(), + ], + elevation: 0, + ), + body: Column( + children: [ + Container( + margin: EdgeInsets.all(15.r), + // height: 30.r, + child: Row( + children: [ + Expanded( + child: Container( + padding: EdgeInsets.only(left: 10.r, right: 10.r), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.r), + border: Border.all(width: 1.r, color: const Color(0xFFDDDDDD)), + color: Colors.white, + ), + child: TextField( + controller: logic.textController, + textInputAction: TextInputAction.next, + style: TextStyle( + color: const Color.fromRGBO(80, 87, 103, 1), + fontSize: 10.sp, + ), + decoration: InputDecoration( + hintText: "请输入知识点名称", + hintStyle: TextStyle(fontSize: 10.sp, color: const Color.fromRGBO(153, 153, 153, 1)), + labelStyle: TextStyle(fontSize: 10.sp, color: const Color.fromRGBO(148, 163, 182, 1)), + border: InputBorder.none, ), ), - SizedBox( - width: 10.r, - ), - InkWell( - onTap: () { - state.page = 1; - logic.getList(); - }, - child: Container( - width: 50.r, - height: 30.r, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.r), - color: Theme.of(context).primaryColor, - ), - child: Center( - child: Text( - '查询', - style: TextStyle(fontSize: 12.sp, color: Colors.white), - ), - ), - ), - ) - ], - ), - ), - Obx(() { - return JobConditionFilter( - jobType: 1, - controller: logic.tabController, - customTimeStr: state.customTimeStr.value, - customTime: logic.tabController.index != 2 || - ((state.dateEnd == null || state.dateEnd == '') && (state.dateStart == null || state.dateStart == '')) - ? null - : PickerDateRange( - state.dateStart == null || state.dateStart == '' ? null : DateTime.parse(state.dateStart!), - state.dateEnd == null || state.dateEnd == '' ? null : DateTime.parse(state.dateEnd!), ), - onTimeFilter: (String? startTime, String? endTime) { - EasyLoading.show(status: 'loading...'); - if (startTime == null && endTime == null) { - if (logic.tabController.index == 2) { - logic.tabController.animateTo(0); - } - state.dateStart = Utils.getWeekStartDate().toString().substring(0, 10); - state.dateEnd = Utils.getWeekEndDate().toString().substring(0, 10); - state.customTimeStr.value = '自定义'; + ), + SizedBox( + width: 10.r, + ), + InkWell( + onTap: () => easyThrottle('zshi_shi_dian_cx', () { + Utils.hideKeyboard(); + logic.refreshController.callRefresh(); + }), + child: Container( + width: 50.r, + height: 30.r, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(4.r), color: Theme.of(context).primaryColor), + child: Center( + child: Text( + '查询', + style: TextStyle(fontSize: 12.sp, color: Colors.white), + ), + ), + ), + ) + ], + ), + ), + Obx(() { + return JobConditionFilter( + jobType: 1, + controller: logic.tabController, + customTimeStr: state.customTimeStr.value, + customTime: logic.tabController.index != 2 || + ((state.dateEnd == null || state.dateEnd == '') && (state.dateStart == null || state.dateStart == '')) + ? null + : PickerDateRange( + state.dateStart == null || state.dateStart == '' ? null : DateTime.parse(state.dateStart!), + state.dateEnd == null || state.dateEnd == '' ? null : DateTime.parse(state.dateEnd!), + ), + onTimeFilter: (String? startTime, String? endTime) { + EasyLoading.show(status: 'loading...'); + if (startTime == null && endTime == null) { + if (logic.tabController.index == 2) { + logic.tabController.animateTo(0); + } + state.dateStart = Utils.getWeekStartDate().toString().substring(0, 10); + state.dateEnd = Utils.getWeekEndDate().toString().substring(0, 10); + state.customTimeStr.value = '自定义'; + } else { + state.dateStart = startTime ?? ''; + state.dateEnd = endTime ?? ''; + } + state.page = 1; + logic.getList(); + // _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.dateStart = startTime ?? ''; - state.dateEnd = endTime ?? ''; + state.customTimeStr.value = '${state.customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}'; } + } + } + }, + ); + }), + Expanded( + child: Padding( + padding: EdgeInsets.symmetric(vertical: 10.r), + child: Obx(() { + return EasyRefresh( + firstRefresh: false, + taskIndependence: true, + controller: logic.refreshController, + header: MaterialHeader(), + footer: TaurusFooter(), + onRefresh: () async { state.page = 1; logic.getList(); - // _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)}'; - } - } + onLoad: () async { + if (state.page < state.totalPages) { + state.page += 1; + logic.getList(); } }, - ); - }), - Expanded( - child: Padding( - padding: EdgeInsets.symmetric(vertical: 10.r), - child: Obx(() { - return EasyRefresh( - firstRefresh: false, - taskIndependence: true, - controller: logic.refreshController, - header: MaterialHeader(), - footer: TaurusFooter(), - onRefresh: () async { - state.page = 1; - logic.getList(); - }, - onLoad: () async { - if (state.page < state.totalPages) { - state.page += 1; - logic.getList(); - } - }, - child: state.dataList.isNotEmpty - ? ListView.builder( + child: state.dataList.isNotEmpty + ? ListView.builder( itemCount: state.dataList.value.length, itemBuilder: (context, index) { KnowledgePointsGrasp item = state.dataList[index]; @@ -176,7 +174,7 @@ class _KnowledgePointsGraspPageState extends State { 'dateEnd': state.dateEnd, 'knowledgeId': item.knowledgeId, 'knowledgeName': item.knowledgeName, - 'subject':state.subject + 'subject': state.subject }); }, child: Container( @@ -193,9 +191,9 @@ class _KnowledgePointsGraspPageState extends State { children: [ Expanded( child: Text( - item.knowledgeName, - style: TextStyle(fontSize: 14.sp, color: Color(0xFF505050)), - )), + item.knowledgeName, + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF505050)), + )), Container( width: 49.r, height: 22.r, @@ -211,11 +209,16 @@ class _KnowledgePointsGraspPageState extends State { '${item.count}次', style: TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor), ), - Image.asset( - 'assets/images/job_data_right_icon.png', - width: 10.r, - height: 10.r, + SizedBox(width: 1.w), + Padding( + padding: EdgeInsets.only(top: 2.h), + child: Icon(Icons.chevron_right, size: 12.r, color: Theme.of(context).primaryColor), ), + // Image.asset( + // 'assets/images/job_data_right_icon.png', + // width: 10.r, + // height: 10.r, + // ), ], ), ), @@ -226,7 +229,7 @@ class _KnowledgePointsGraspPageState extends State { ), ProgressBar( title: '正确率:', - color: Color(0xFFB2DA93), + color: const Color(0xFFB2DA93), percent: item.correctRate / 100, padingEdg: EdgeInsets.zero, marginEdg: EdgeInsets.only(top: 8.h)), @@ -235,15 +238,15 @@ class _KnowledgePointsGraspPageState extends State { ), ); }) - : const MyEmptyWidget(), - ); - }), - ), - ), - ], + : const MyEmptyWidget(), + ); + }), + ), ), - ); - }); + ], + ), + ); + }); } @override diff --git a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp_detail/knowledge_points_grasp_detail_view.dart b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp_detail/knowledge_points_grasp_detail_view.dart index df6e4ea..e5c2de0 100644 --- a/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp_detail/knowledge_points_grasp_detail_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/knowledge_points_grasp_detail/knowledge_points_grasp_detail_view.dart @@ -15,7 +15,7 @@ import 'package:making_school_asignment_app/page/global_widget/show_student_list import 'knowledge_points_grasp_detail_logic.dart'; class KnowledgePointsGraspDetailPage extends StatefulWidget { - const KnowledgePointsGraspDetailPage({Key? key}) : super(key: key); + const KnowledgePointsGraspDetailPage({super.key}); @override State createState() => _KnowledgePointsGraspDetailPageState(); @@ -70,42 +70,41 @@ class _KnowledgePointsGraspDetailPageState extends State Get.back(), - ), - actions: const [ - ReturnToHomepage(), - ], - elevation: 0, - ), - body: Padding( - padding: EdgeInsets.symmetric(vertical: 10.r), - child: Obx(() { - return EasyRefresh( - firstRefresh: false, - taskIndependence: true, - controller: logic.refreshController, - header: MaterialHeader(), - footer: TaurusFooter(), - onRefresh: () async { - logic.getList(); - }, - onLoad: () async { - // getList(); - }, - child: state.dataList.isNotEmpty - ? ListView.builder( + return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { + return Scaffold( + backgroundColor: const Color.fromRGBO(245, 245, 245, 1), + appBar: AppBar( + backgroundColor: Colors.white, + title: Obx(() { + return Text(state.knowledgeName.value, style: TextStyle(fontSize: 14.sp, color: const Color(0xFF333333))); + }), + centerTitle: true, + leading: IconButton( + icon: const Icon(Icons.arrow_back_ios, color: Colors.black), + onPressed: () => Get.back(), + ), + actions: const [ + ReturnToHomepage(), + ], + elevation: 0, + ), + body: Padding( + padding: EdgeInsets.symmetric(vertical: 10.r), + child: Obx(() { + return EasyRefresh( + firstRefresh: false, + taskIndependence: true, + controller: logic.refreshController, + header: MaterialHeader(), + footer: TaurusFooter(), + onRefresh: () async { + logic.getList(); + }, + onLoad: () async { + // getList(); + }, + child: state.dataList.isNotEmpty + ? ListView.builder( itemCount: state.dataList.length, itemBuilder: (context, index) { KnowledgeReportDetail item = state.dataList[index]; @@ -132,32 +131,32 @@ class _KnowledgePointsGraspDetailPageState extends State { children: [ Text( '客观题', - style: TextStyle(fontSize: 14.sp, color: Color(0xFF5C5C5C), fontWeight: FontWeight.w600), - ), - SizedBox( - height: 20.r, + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF5C5C5C), fontWeight: FontWeight.w600), ), + SizedBox(height: 20.r), ProgressBar( color: const Color.fromRGBO(76, 199, 147, 1), percent: double.parse(widget.kgtCorrectRate) / 100, @@ -80,19 +78,17 @@ class _KgtZgtTableState extends State { lineHeight: 10.h, marginEdg: EdgeInsets.only(top: 5.h), ), - SizedBox( - height: 10.r, - ), + SizedBox(height: 10.r), SizedBox( height: widget.kgReport.length > 10 ? 300.r : widget.kgReport.length * 40.r + (Utils.isPad() == true ? 40.r : 65.r), child: ReportTable( - headList: const ['题', '作答率', '作答人数', '作答正确率', '全班正确率','标准答案', '优先批阅概况'], + headList: const ['题', '作答率', '作答人数', '作答正确率', '全班正确率', '标准答案', '优先批阅概况'], bodyList: widget.kgReport, fixedCols: 1, fixedRows: 1, jobId: widget.homeworkId, studentCount: widget.studentCount, - subject:widget.subject, + subject: widget.subject, ), ), if (widget.kgReport.isEmpty) MyEmptyWidget(imgWidth: 100.r, imgHeight: 100.r, font: 8.sp), @@ -135,12 +131,12 @@ class _KgtZgtTableState extends State { marginEdg: EdgeInsets.only(top: 5.h), ), SizedBox( - height:10.r, + height: 10.r, ), SizedBox( height: widget.zgReport.length > 10 ? 300.r : widget.zgReport.length * 40.r + (Utils.isPad() == true ? 40.r : 65.r), child: ReportTable( - headList: const ['题', '作答率', '作答人数', '作答正确率', '全班正确率', '查看原题', '优先批阅概况','作答效率'], + headList: const ['题', '作答率', '作答人数', '作答正确率', '全班正确率', '查看原题', '优先批阅概况', '作答效率'], bodyList: widget.zgReport, fixedCols: 1, fixedRows: 1, diff --git a/making_school_asignment_app/lib/page/home_page/children/quick_data_check/widget/report_table.dart b/making_school_asignment_app/lib/page/home_page/children/quick_data_check/widget/report_table.dart index ee5ad10..0c74896 100644 --- a/making_school_asignment_app/lib/page/home_page/children/quick_data_check/widget/report_table.dart +++ b/making_school_asignment_app/lib/page/home_page/children/quick_data_check/widget/report_table.dart @@ -56,8 +56,7 @@ class _ReportTableState extends State { builder: (BuildContext context) { return AlertDialog( contentPadding: EdgeInsets.all(20.r), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(15.r))), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.r))), content: SizedBox( width: MediaQuery.of(context).size.width * 0.5, height: MediaQuery.of(context).size.height * 0.4, @@ -65,49 +64,52 @@ class _ReportTableState extends State { children: [ Text( '作答效率', - style: TextStyle( - fontSize: 15.sp, - color: const Color(0xFF3C3C3C), - fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 15.sp, color: const Color(0xFF3C3C3C), fontWeight: FontWeight.w500), ), Padding( - padding: EdgeInsets.symmetric(vertical:20.r,horizontal: 10.r), + padding: EdgeInsets.symmetric(vertical: 20.r, horizontal: 10.r), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - mapIcon(const Color(0xFFB8A1FF)), - SizedBox(width: 5.r,), + mapIcon(const Color(0xFFB8A1FF)), + SizedBox( + width: 5.r, + ), mapTxt('优'), const Spacer(), mapIcon(const Color(0xFF4CC793)), - SizedBox(width: 5.r,), + SizedBox( + width: 5.r, + ), mapTxt('良'), const Spacer(), mapIcon(const Color(0xFF90E0BE)), - SizedBox(width: 5.r,), + SizedBox( + width: 5.r, + ), mapTxt('中'), const Spacer(), mapIcon(const Color(0xFFFF6B6B)), - SizedBox(width: 5.r,), + SizedBox( + width: 5.r, + ), mapTxt('差'), ], ), ), Expanded( - child: - - PieChart( + child: PieChart( PieChartData( borderData: FlBorderData(show: true), sectionsSpace: 0, centerSpaceRadius: 0, - sections: List.generate(overallTitles.length,(index) { + sections: List.generate(overallTitles.length, (index) { var e = overallTitles[index]; return PieChartSectionData( color: colorMap[index], value: e.count / widget.studentCount * 100, radius: 110, - // borderSide:BorderSide(color: const Color(0xFF273366),width: 0.5.r), + // borderSide:BorderSide(color: const Color(0xFF273366),width: 0.5.r), // title: e.title + (Utils.doubleToStringAsFixed(e.count / widget.studentCount * 100) + '%'), title: e.title + e.count.toString(), titleStyle: TextStyle(fontSize: 12.sp, color: Color(0xFFFFFFFF)), @@ -151,20 +153,14 @@ class _ReportTableState extends State { }); } - void showPeopleListDialog( - {required BuildContext context, - required String title, - required String questionNo, - required List arr, - List? dcList}) { + void showPeopleListDialog({required BuildContext context, required String title, required String questionNo, required List arr, List? dcList}) { showDialog( context: context, builder: (BuildContext context) { return AlertDialog( // insetPadding: EdgeInsets.symmetric(vertical: 20.r,horizontal: 20.r), contentPadding: EdgeInsets.all(20.r), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(15.r))), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.r))), content: SizedBox( width: MediaQuery.of(context).size.width * 0.7, height: MediaQuery.of(context).size.height * 0.7, @@ -174,10 +170,7 @@ class _ReportTableState extends State { Center( child: Text( title, - style: TextStyle( - fontSize: 15.sp, - color: const Color(0xFF3C3C3C), - fontWeight: FontWeight.w500), + style: TextStyle(fontSize: 15.sp, color: const Color(0xFF3C3C3C), fontWeight: FontWeight.w500), ), ), SizedBox( @@ -187,18 +180,15 @@ class _ReportTableState extends State { children: [ Text( widget.isZG == true ? '主观题' : '客观题', - style: TextStyle( - fontSize: 14.sp, color: Theme.of(context).primaryColor), + style: TextStyle(fontSize: 14.sp, color: Theme.of(context).primaryColor), ), Text( '―', - style: TextStyle( - fontSize: 14.sp, color: Theme.of(context).primaryColor), + style: TextStyle(fontSize: 14.sp, color: Theme.of(context).primaryColor), ), Text( '第$questionNo题', - style: TextStyle( - fontSize: 14.sp, color: Theme.of(context).primaryColor), + style: TextStyle(fontSize: 14.sp, color: Theme.of(context).primaryColor), ), ], ), @@ -213,27 +203,21 @@ class _ReportTableState extends State { child: Center( child: Text( '未作答人', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF6A6A6A)), + style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)), ))), Expanded( flex: 1, child: Center( child: Text( '答对人数', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF6A6A6A)), + style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)), ))), Expanded( flex: 1, child: Center( child: Text( '答错人', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF6A6A6A)), + style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)), ))), ], ) @@ -241,8 +225,7 @@ class _ReportTableState extends State { padding: EdgeInsets.only(left: 15.r), child: Text( title, - style: TextStyle( - fontSize: 12.sp, color: Color(0xFF6A6A6A)), + style: TextStyle(fontSize: 12.sp, color: Color(0xFF6A6A6A)), ), ), SizedBox( @@ -256,60 +239,41 @@ class _ReportTableState extends State { var item = arr[index]; return Container( padding: EdgeInsets.symmetric(vertical: 5.r), - color: - index.isOdd ? Colors.white : Color(0xFFF0F0F0), + color: index.isOdd ? Colors.white : Color(0xFFF0F0F0), child: Row( children: [ Expanded( flex: 1, child: InkWell( onTap: () { - goQuickCheckPersonalPath( - item['noAnswerStudents'] - .studentId); + goQuickCheckPersonalPath(item['noAnswerStudents'].studentId); }, child: Center( child: Text( - item['noAnswerStudents'] - ?.studentName ?? - '--', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF323232)), + item['noAnswerStudents']?.studentName ?? '--', + style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)), )))), Expanded( flex: 1, child: InkWell( onTap: () { - goQuickCheckPersonalPath( - item['answerOkStudents'] - .studentId); + goQuickCheckPersonalPath(item['answerOkStudents'].studentId); }, child: Center( child: Text( - item['answerOkStudents'] - ?.studentName ?? - '--', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF323232)), + item['answerOkStudents']?.studentName ?? '--', + style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)), )))), Expanded( flex: 1, child: InkWell( onTap: () { - goQuickCheckPersonalPath( - item['answerNgStudents'] - .studentId); + goQuickCheckPersonalPath(item['answerNgStudents'].studentId); }, child: Center( child: Text( - item['answerNgStudents'] - ?.studentName ?? - '--', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF323232)), + item['answerNgStudents']?.studentName ?? '--', + style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)), )))), ], ), @@ -330,16 +294,11 @@ class _ReportTableState extends State { goQuickCheckPersonalPath(item.studentId); }, child: Container( - padding: EdgeInsets.symmetric( - vertical: 5.r, horizontal: 15.r), - color: index.isOdd - ? Colors.white - : Color(0xFFF0F0F0), + padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 15.r), + color: index.isOdd ? Colors.white : Color(0xFFF0F0F0), child: Text( item.studentName! ?? '--', - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF323232)), + style: TextStyle(fontSize: 12.sp, color: Color(0xFF323232)), ), ), ); @@ -357,65 +316,56 @@ class _ReportTableState extends State { void goQuickCheckPersonalPath(id) { if (id != null) { - Get.toNamed(Routes.studentPersonalPage, - arguments: {'studentId': id, 'homeworkId': widget.jobId,'subject':widget.subject}); + Get.toNamed(Routes.studentPersonalPage, arguments: {'studentId': id, 'homeworkId': widget.jobId, 'subject': widget.subject}); } } - void zdHandle(BuildContext context, String title, String questionNo, - List noAnswerStudents, List answerNgStudents, List answerOkStudents) { + void zdHandle(BuildContext context, String title, String questionNo, List noAnswerStudents, List answerNgStudents, List answerOkStudents) { List list = []; // Questions student = Questions('','',-1,-1,'',-1,'','',[],-1,-1,[] as double?); - if (noAnswerStudents.length > answerNgStudents.length && - noAnswerStudents.length > answerOkStudents.length) { + if (noAnswerStudents.length > answerNgStudents.length && noAnswerStudents.length > answerOkStudents.length) { for (int i = 0; i < noAnswerStudents.length; i++) { var obj = { 'noAnswerStudents': noAnswerStudents[i], - 'answerNgStudents': - answerNgStudents.length > i ? answerNgStudents[i] : null, - 'answerOkStudents': - answerOkStudents.length > i ? answerOkStudents[i] : null + 'answerNgStudents': answerNgStudents.length > i ? answerNgStudents[i] : null, + 'answerOkStudents': answerOkStudents.length > i ? answerOkStudents[i] : null }; list.add(obj); } - } else if (answerNgStudents.length > noAnswerStudents.length && - answerNgStudents.length > answerOkStudents.length) { + } else if (answerNgStudents.length > noAnswerStudents.length && answerNgStudents.length > answerOkStudents.length) { for (int i = 0; i < answerNgStudents.length; i++) { var obj = { - 'noAnswerStudents': - noAnswerStudents.length > i ? noAnswerStudents[i] : null, + 'noAnswerStudents': noAnswerStudents.length > i ? noAnswerStudents[i] : null, 'answerNgStudents': answerNgStudents[i], - 'answerOkStudents': - answerOkStudents.length > i ? answerOkStudents[i] : null + 'answerOkStudents': answerOkStudents.length > i ? answerOkStudents[i] : null }; list.add(obj); } - } else if (answerOkStudents.length > noAnswerStudents.length && - answerOkStudents.length > answerNgStudents.length) { + } else if (answerOkStudents.length > noAnswerStudents.length && answerOkStudents.length > answerNgStudents.length) { for (int i = 0; i < answerOkStudents.length; i++) { var obj = { - 'noAnswerStudents': - noAnswerStudents.length > i ? noAnswerStudents[i] : null, - 'answerNgStudents': - answerNgStudents.length > i ? answerNgStudents[i] : null, + 'noAnswerStudents': noAnswerStudents.length > i ? noAnswerStudents[i] : null, + 'answerNgStudents': answerNgStudents.length > i ? answerNgStudents[i] : null, + 'answerOkStudents': answerOkStudents[i] + }; + list.add(obj); + } + } else { + for (int i = 0; i < answerOkStudents.length; i++) { + var obj = { + 'noAnswerStudents': noAnswerStudents.length > i ? noAnswerStudents[i] : null, + 'answerNgStudents': answerNgStudents.length > i ? answerNgStudents[i] : null, 'answerOkStudents': answerOkStudents[i] }; list.add(obj); } } - showPeopleListDialog( - context: context, - title: title, - questionNo: questionNo, - arr: list, - dcList: []); + showPeopleListDialog(context: context, title: title, questionNo: questionNo, arr: list, dcList: []); } - void dcHandle( - BuildContext context, String title, String questionNo, List arr) { - showPeopleListDialog( - context: context, title: title, questionNo: questionNo, arr: arr); + void dcHandle(BuildContext context, String title, String questionNo, List arr) { + showPeopleListDialog(context: context, title: title, questionNo: questionNo, arr: arr); } DataRow _getRow(int index, [Color? color]) { @@ -428,28 +378,18 @@ class _ReportTableState extends State { DataCell(Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.r), - child: Text(item.questionNo.toString(), - style: - TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))), + child: Text(item.questionNo.toString(), style: TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))), ), )), DataCell(Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.r), - child: Text('${item.answerRate.toStringAsFixed(0)}%', - style: - TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))), + child: Text('${item.answerRate.toStringAsFixed(0)}%', style: TextStyle(fontSize: 10.sp, color: const Color(0xFF525252))), ), )), DataCell(InkWell( onTap: () { - zdHandle( - context, - '作答人数', - item.questionNo.toString(), - item.noAnswerStudents, - item.answerNgStudents, - item.answerOkStudents); + zdHandle(context, '作答人数', item.questionNo.toString(), item.noAnswerStudents, item.answerNgStudents, item.answerOkStudents); }, child: Center( child: Padding( @@ -457,9 +397,7 @@ class _ReportTableState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('${item.answerCount}/${widget.studentCount}', - style: TextStyle( - fontSize: 10.sp, color: Theme.of(context).primaryColor)), + Text('${item.answerCount}/${widget.studentCount}', style: TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor)), Image.asset( 'assets/images/green_right_icon.png', width: 12.r, @@ -470,19 +408,16 @@ class _ReportTableState extends State { ), ), )), - DataCell(Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.r), - child: Text('${item.correctRate.toStringAsFixed(0)}%', - style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))), + child: Text('${item.correctRate.toStringAsFixed(0)}%', style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))), ), )), DataCell(Center( child: Padding( padding: EdgeInsets.symmetric(horizontal: 5.r), - child: Text('${item.okRate.toStringAsFixed(0)}%', - style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))), + child: Text('${item.okRate.toStringAsFixed(0)}%', style: TextStyle(fontSize: 10.sp, color: Color(0xFF525252))), ), )), DataCell(Center( @@ -494,30 +429,20 @@ class _ReportTableState extends State { if (item.questionPicture == null) { ToastUtils.showInfo('当前试题没有原题'); } else { - ImageDialog.showImgDialog( - context, item.questionPicture); + ImageDialog.showImgDialog(context, item.questionPicture); } }, child: Text('原题', - style: TextStyle( - fontSize: 10.sp, - color: widget.isZG == true - ? const Color(0xFFFF8A00) - : Theme.of(context).primaryColor)), + style: TextStyle(fontSize: 10.sp, color: widget.isZG == true ? const Color(0xFFFF8A00) : Theme.of(context).primaryColor)), ) : Text(item.answer, - style: TextStyle( - fontSize: 10.sp, - color: widget.isZG == true - ? const Color(0xFFFF8A00) - : Theme.of(context).primaryColor)), + style: TextStyle(fontSize: 10.sp, color: widget.isZG == true ? const Color(0xFFFF8A00) : Theme.of(context).primaryColor)), ), )), DataCell(InkWell( onTap: () { // List parts = item.priorityGeneral.split('人'); - dcHandle(context, '优先批阅答错人', item.questionNo.toString(), - item.priorityInfo); + dcHandle(context, '优先批阅答错人', item.questionNo.toString(), item.priorityInfo); }, child: Center( child: Padding( @@ -525,9 +450,7 @@ class _ReportTableState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text('${item.priorityInfo.length}人答错', - style: TextStyle( - fontSize: 10.sp, color: Theme.of(context).primaryColor)), + Text('${item.priorityInfo.length}人答错', style: TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor)), Image.asset( 'assets/images/green_right_icon.png', width: 12.r, @@ -548,18 +471,10 @@ class _ReportTableState extends State { showAnswerEfficiency(item.overallTitles); }, child: Text('查看', - style: TextStyle( - fontSize: 10.sp, - color: widget.isZG == true - ? const Color(0xFFFF8A00) - : Theme.of(context).primaryColor)), + style: TextStyle(fontSize: 10.sp, color: widget.isZG == true ? const Color(0xFFFF8A00) : Theme.of(context).primaryColor)), ) : Text(item.answer, - style: TextStyle( - fontSize: 10.sp, - color: widget.isZG == true - ? const Color(0xFFFF8A00) - : Theme.of(context).primaryColor)), + style: TextStyle(fontSize: 10.sp, color: widget.isZG == true ? const Color(0xFFFF8A00) : Theme.of(context).primaryColor)), ), )), ], @@ -577,16 +492,12 @@ class _ReportTableState extends State { dataRowHeight: 40.r, bottomMargin: 0, border: const TableBorder( - horizontalInside: BorderSide( - width: 1, color: Colors.white, style: BorderStyle.solid), - bottom: BorderSide( - width: 1, color: Colors.white, style: BorderStyle.solid), - verticalInside: BorderSide( - width: 1, color: Colors.white, style: BorderStyle.solid)), - headingRowColor: MaterialStateProperty.resolveWith((states) => - widget.fixedCols! > 0 ? Colors.white : Colors.transparent), - headingRowDecoration: BoxDecoration(color: Color(0xFFE6E6E6)), - fixedColumnsColor: Color(0xFFE6E6E6), + horizontalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid), + bottom: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid), + verticalInside: BorderSide(width: 1, color: Colors.white, style: BorderStyle.solid)), + headingRowColor: MaterialStateProperty.resolveWith((states) => widget.fixedCols! > 0 ? Colors.white : Colors.transparent), + headingRowDecoration: const BoxDecoration(color: Color(0xFFE6E6E6)), + fixedColumnsColor: const Color(0xFFE6E6E6), fixedCornerColor: Colors.grey[400], minWidth: widget.headList.length > 6 ? 80.r * widget.headList.length @@ -601,65 +512,75 @@ class _ReportTableState extends State { columns: List.generate(widget.headList.length, (index) { var item = widget.headList[index]; return DataColumn2( - label: index == 3 ? - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text(item, - style: TextStyle(fontSize: 10.sp, color: Color(0xFF505767))), - SizedBox(width: 2.r,), - const Tooltip( - message: '答对人数/作答人数', - triggerMode: TooltipTriggerMode.tap, - preferBelow:false, - child: Icon(Icons.info_outline_rounded,color: Colors.grey,)), - ], - ): - index == 4 ?Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text(item, - style: TextStyle(fontSize: 10.sp, color: Color(0xFF505767))), - SizedBox(width: 2.r,), - const Tooltip( - message: '答对人数/总人数', - triggerMode: TooltipTriggerMode.tap, - preferBelow:false, - child: Icon(Icons.info_outline_rounded,color: Colors.grey,)), - ], - ): - Center( - child: Text(item, - style: TextStyle(fontSize: 10.sp, color: Color(0xFF505767))), - ), + label: index == 3 + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text(item, style: TextStyle(fontSize: 10.sp, color: const Color(0xFF505767))), + SizedBox( + width: 2.r, + ), + const Tooltip( + message: '答对人数/作答人数', + triggerMode: TooltipTriggerMode.tap, + preferBelow: false, + child: Icon( + Icons.info_outline_rounded, + color: Colors.grey, + )), + ], + ) + : index == 4 + ? Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text(item, style: TextStyle(fontSize: 10.sp, color: const Color(0xFF505767))), + SizedBox( + width: 2.r, + ), + const Tooltip( + message: '答对人数/总人数', + triggerMode: TooltipTriggerMode.tap, + preferBelow: false, + child: Icon( + Icons.info_outline_rounded, + color: Colors.grey, + )), + ], + ) + : Center( + child: Text(item, style: TextStyle(fontSize: 10.sp, color: const Color(0xFF505767))), + ), // size: ColumnSize.S, fixedWidth: index == 0 ? 40.r : widget.headList.length > 6 ? 80.r : isPadFlag - ? (MediaQuery.of(context).size.width - 8.r) / - widget.headList.length + ? (MediaQuery.of(context).size.width - 8.r) / widget.headList.length : 85.r, ); }), - rows: List.generate(widget.bodyList.length, - (index) => _getRow(index, Color(0xFFF5F5F5)))); + rows: List.generate(widget.bodyList.length, (index) => _getRow(index, const Color(0xFFF5F5F5)))); } } -Widget mapIcon(Color bgColor){ -return Container( - width: 12.r, - height: 12.r, - decoration: BoxDecoration( - color: bgColor, - borderRadius: BorderRadius.all(Radius.circular(6.r)), - ), -); +Widget mapIcon(Color bgColor) { + return Container( + width: 12.r, + height: 12.r, + decoration: BoxDecoration( + color: bgColor, + borderRadius: BorderRadius.all(Radius.circular(6.r)), + ), + ); +} + +Widget mapTxt(String title) { + return Text( + title, + style: TextStyle(fontSize: 12.sp, color: const Color(0xFF525252), fontWeight: FontWeight.w400), + ); } -Widget mapTxt(String title){ - return Text(title,style: TextStyle(fontSize: 12.sp,color: Color(0xFF525252),fontWeight: FontWeight.w400),); -} \ No newline at end of file diff --git a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_logic.dart b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_logic.dart index 370098c..4120d9d 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_logic.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_logic.dart @@ -11,13 +11,35 @@ class StudentPersonalLogic extends GetxController with RequestToolMixin { void onInit() { super.onInit(); state.studentId = Get.arguments['studentId']; - state.subject = Get.arguments['subject']??-1; + state.subject = Get.arguments['subject'] ?? -1; state.homeworkId = Get.arguments['homeworkId']; getInfo(); } void getInfo() async { StudentPersonalInfo data = await getClient().getStudentHomework(state.homeworkId, state.studentId); + data.kgtList.sort((a, b) { + try { + if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) { + return num.parse(a.questionNo).compareTo(num.parse(b.questionNo)); + } else { + throw Exception(); + } + } catch (e) { + return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase()); + } + }); + data.zgtList.sort((a, b) { + try { + if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) { + return num.parse(a.questionNo).compareTo(num.parse(b.questionNo)); + } else { + throw Exception(); + } + } catch (e) { + return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase()); + } + }); state.studentInfo.value = data; } } diff --git a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart index ac1d347..faa4a47 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart @@ -11,7 +11,7 @@ import 'package:making_school_asignment_app/routes/app_pages.dart'; import 'student_personal_logic.dart'; class StudentPersonalPage extends StatefulWidget { - const StudentPersonalPage({Key? key}) : super(key: key); + const StudentPersonalPage({super.key}); @override State createState() => _StudentPersonalPageState(); @@ -54,8 +54,11 @@ class _StudentPersonalPageState extends State { onTap: () { // RouterManager.router.navigateTo(context, // '${RouterManager.jobPersonalDetailPath}?studentId=${widget.studentId}&studentName=${Uri.encodeComponent(state.studentInfo.studentName!)}'); - Get.toNamed(Routes.studentWorkDetailPage, - arguments: {'studentId': state.studentInfo.value.studentId, 'studentName': state.studentInfo.value.studentName,'subject':state.subject}); + Get.toNamed(Routes.studentWorkDetailPage, arguments: { + 'studentId': state.studentInfo.value.studentId, + 'studentName': state.studentInfo.value.studentName, + 'subject': state.subject + }); }, child: Container( width: 93.r, diff --git a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/student_work_detail_logic.dart b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/student_work_detail_logic.dart index 797bc81..ee13754 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_work_detail/student_work_detail_logic.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_work_detail/student_work_detail_logic.dart @@ -31,19 +31,43 @@ class StudentWorkDetailLogic extends GetxController with RequestToolMixin, GetSi studentId: state.studentId, dateStart: state.dateStart, dateEnd: state.dateEnd, - subject:state.subject, + subject: state.subject, pageNumber: state.page, pageSize: 10, ); StudentHistory data = await getClient().getStudentHistory(params); + data.items.items.forEach((e) { + e.kgtList.sort((a, b) { + try { + if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) { + return num.parse(a.questionNo).compareTo(num.parse(b.questionNo)); + } else { + throw Exception(); + } + } catch (e) { + return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase()); + } + }); + e.zgtList.sort((a, b) { + try { + if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) && RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) { + return num.parse(a.questionNo).compareTo(num.parse(b.questionNo)); + } else { + throw Exception(); + } + } catch (e) { + return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase()); + } + }); + }); state.studentData.value = data; - /* state.kgtLine.value = [{'id':0,'rate':0}]; + /* state.kgtLine.value = [{'id':0,'rate':0}]; state.zgtLine.value = [{'id':0,'rate':0}]; state.allLine.value = [{'id':0,'rate':0}];*/ state.kgtLine.value = []; state.zgtLine.value = []; state.allLine.value = []; - for (var i = 0;i=3.4.1 <4.0.0' diff --git a/making_school_asignment_app/web/index.html b/making_school_asignment_app/web/index.html index be6f12e..d2e2c0e 100644 --- a/making_school_asignment_app/web/index.html +++ b/making_school_asignment_app/web/index.html @@ -197,6 +197,8 @@ + +