From 0b60055e886e5188898b7e1ee8fa381eb1cc9287 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Wed, 28 Feb 2024 14:06:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + .../model/job/job_report_knowledge_model.dart | 67 +++ .../common/model/job/job_report_model.dart | 9 + .../job/job_report_question_deatil_model.dart | 124 +++++ .../homework_tasks_view_item.dart | 9 +- .../pages/homework_correction/job_report.dart | 432 +++++++++++------- .../lib/utils/request/rest_client.dart | 12 + marking_app/lib/utils/request/rest_dio.dart | 2 +- 8 files changed, 496 insertions(+), 161 deletions(-) create mode 100644 marking_app/lib/common/model/job/job_report_knowledge_model.dart create mode 100644 marking_app/lib/common/model/job/job_report_question_deatil_model.dart diff --git a/.gitignore b/.gitignore index 8ac2b6e..fccfa47 100644 --- a/.gitignore +++ b/.gitignore @@ -196,3 +196,5 @@ marking_app/lib/common/model/report/report_card_params.g.dart marking_app/lib/common/model/report/report_card.g.dart marking_app/lib/common/model/report/report_marking_detail_params.g.dart marking_app/lib/common/model/report/report_marking_detail.g.dart +marking_app/lib/common/model/job/job_report_knowledge_model.g.dart +marking_app/lib/common/model/job/job_report_question_deatil_model.g.dart diff --git a/marking_app/lib/common/model/job/job_report_knowledge_model.dart b/marking_app/lib/common/model/job/job_report_knowledge_model.dart new file mode 100644 index 0000000..b56d8ac --- /dev/null +++ b/marking_app/lib/common/model/job/job_report_knowledge_model.dart @@ -0,0 +1,67 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'job_report_knowledge_model.g.dart'; + +@JsonSerializable() +class JobReportKnowledgeModel extends Object { + @JsonKey(name: 'schoolId') + int schoolId; + + @JsonKey(name: 'schoolName') + String schoolName; + + @JsonKey(name: 'gradeId') + int gradeId; + + @JsonKey(name: 'gradeName') + String gradeName; + + @JsonKey(name: 'className') + String className; + + @JsonKey(name: 'rate') + double rate; + + @JsonKey(name: 'ratio') + String ratio; + + @JsonKey(name: 'noAnswerCount') + int noAnswerCount; + + @JsonKey(name: 'studentReports') + List studentReports; + + JobReportKnowledgeModel( + this.schoolId, + this.schoolName, + this.gradeId, + this.gradeName, + this.className, + this.rate, + this.ratio, + this.noAnswerCount, + this.studentReports, + ); + + factory JobReportKnowledgeModel.fromJson(Map srcJson) => _$JobReportKnowledgeModelFromJson(srcJson); + + Map toJson() => _$JobReportKnowledgeModelToJson(this); +} + +@JsonSerializable() +class StudentReports extends Object { + @JsonKey(name: 'studentName') + String studentName; + + @JsonKey(name: 'pass') + bool pass; + + StudentReports( + this.studentName, + this.pass, + ); + + factory StudentReports.fromJson(Map srcJson) => _$StudentReportsFromJson(srcJson); + + Map toJson() => _$StudentReportsToJson(this); +} diff --git a/marking_app/lib/common/model/job/job_report_model.dart b/marking_app/lib/common/model/job/job_report_model.dart index 4f90709..2eb5a81 100644 --- a/marking_app/lib/common/model/job/job_report_model.dart +++ b/marking_app/lib/common/model/job/job_report_model.dart @@ -1,5 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; +import 'job_report_knowledge_model.dart'; + part 'job_report_model.g.dart'; @JsonSerializable() @@ -127,6 +129,9 @@ class KnowledgeInfos extends Object { @JsonKey(name: 'rate') double rate; + @JsonKey(name: 'details') + List? details; + KnowledgeInfos( this.knowledgeId, this.knowledgeName, @@ -161,6 +166,9 @@ class QuestionAnswerInfos extends Object { @JsonKey(name: 'errorRate') double errorRate; + @JsonKey(name: 'questionPicture') + String? questionPicture; + @JsonKey(name: 'noAnswerRate') double noAnswerRate; @@ -173,6 +181,7 @@ class QuestionAnswerInfos extends Object { this.correctRate, this.errorRate, this.noAnswerRate, + this.questionPicture, ); factory QuestionAnswerInfos.fromJson(Map srcJson) => _$QuestionAnswerInfosFromJson(srcJson); diff --git a/marking_app/lib/common/model/job/job_report_question_deatil_model.dart b/marking_app/lib/common/model/job/job_report_question_deatil_model.dart new file mode 100644 index 0000000..436297d --- /dev/null +++ b/marking_app/lib/common/model/job/job_report_question_deatil_model.dart @@ -0,0 +1,124 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'job_report_question_deatil_model.g.dart'; + +@JsonSerializable() +class JobReportQuestionDeatilModel extends Object { + @JsonKey(name: 'jobName') + String? jobName; + + @JsonKey(name: 'schoolId') + int schoolId; + + @JsonKey(name: 'schoolName') + String schoolName; + + @JsonKey(name: 'gradeId') + int gradeId; + + @JsonKey(name: 'gradeName') + String gradeName; + + @JsonKey(name: 'className') + String className; + + @JsonKey(name: 'rate') + double rate; + + @JsonKey(name: 'ratio') + String ratio; + + @JsonKey(name: 'noAnswerCount') + int noAnswerCount; + + @JsonKey(name: 'finishInfos') + List finishInfos; + + @JsonKey(name: 'studentReports') + List studentReports; + + JobReportQuestionDeatilModel( + this.jobName, + this.schoolId, + this.schoolName, + this.gradeId, + this.gradeName, + this.className, + this.rate, + this.ratio, + this.noAnswerCount, + this.finishInfos, + this.studentReports, + ); + + factory JobReportQuestionDeatilModel.fromJson(Map srcJson) => + _$JobReportQuestionDeatilModelFromJson(srcJson); + + Map toJson() => _$JobReportQuestionDeatilModelToJson(this); +} + +@JsonSerializable() +class FinishInfos extends Object { + @JsonKey(name: 'title') + String title; + + @JsonKey(name: 'finishCount') + int finishCount; + + @JsonKey(name: 'correctRate') + int correctRate; + + FinishInfos( + this.title, + this.finishCount, + this.correctRate, + ); + + factory FinishInfos.fromJson(Map srcJson) => _$FinishInfosFromJson(srcJson); + + Map toJson() => _$FinishInfosToJson(this); +} + +@JsonSerializable() +class StudentReports extends Object { + @JsonKey(name: 'studentName') + String studentName; + + @JsonKey(name: 'pass') + bool pass; + + @JsonKey(name: 'finishInfos') + List finishInfos; + + StudentReports( + this.studentName, + this.pass, + this.finishInfos, + ); + + factory StudentReports.fromJson(Map srcJson) => _$StudentReportsFromJson(srcJson); + + Map toJson() => _$StudentReportsToJson(this); +} + +@JsonSerializable() +class FinishInfo extends Object { + @JsonKey(name: 'title') + String title; + + @JsonKey(name: 'finishCount') + int finishCount; + + @JsonKey(name: 'correctRate') + double correctRate; + + FinishInfo( + this.title, + this.finishCount, + this.correctRate, + ); + + factory FinishInfo.fromJson(Map srcJson) => _$FinishInfoFromJson(srcJson); + + Map toJson() => _$FinishInfoToJson(this); +} diff --git a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart index 7887882..0505607 100644 --- a/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart +++ b/marking_app/lib/pages/homework_correction/components/new_version_of_homework/homework_tasks_view_item.dart @@ -358,9 +358,9 @@ Widget $completedHomeworkChildView( ), SizedBox(height: 10.h), $CompletedHomeworkInfoBox( - precision: jobTaskItem.precision / 100, - objectivePrecision: jobTaskItem.objectivePrecision / 100, - subjectivePrecision: jobTaskItem.subjectivePrecision / 100, + precision: taskItem.precision / 100, + objectivePrecision: taskItem.objectivePrecision / 100, + subjectivePrecision: taskItem.subjectivePrecision / 100, submittedQuantity: taskItem.commitStudentCount, unsubmittedQuantity: taskItem.studentCount - taskItem.commitStudentCount, showStudentsCall: showStudentsCall, @@ -440,7 +440,8 @@ Widget $completedHomeworkProgressBar( required Color color, required double percent, }) { - var percentStr = '${getDoubleRemoveZero(percent * 100)}%'; + var percentStr = '${doubleToStringAsFixed(percent * 100)}%'; + return Container( margin: EdgeInsets.symmetric(vertical: 10.h), child: Row( diff --git a/marking_app/lib/pages/homework_correction/job_report.dart b/marking_app/lib/pages/homework_correction/job_report.dart index b1b038a..661c5b4 100644 --- a/marking_app/lib/pages/homework_correction/job_report.dart +++ b/marking_app/lib/pages/homework_correction/job_report.dart @@ -5,11 +5,13 @@ import 'package:functional_widget_annotation/functional_widget_annotation.dart'; import 'package:marking_app/common/mixin/common.dart'; import 'package:marking_app/common/model/common/base_structure_result.dart'; import 'package:marking_app/common/model/job/job_report_join_class.dart'; +import 'package:marking_app/common/model/job/job_report_knowledge_model.dart'; import 'package:marking_app/common/model/job/job_report_model.dart'; import 'package:marking_app/utils/index.dart'; import 'package:marking_app/utils/my_text.dart'; import 'package:marking_app/utils/request/rest_client.dart'; import 'package:percent_indicator/linear_percent_indicator.dart'; +import 'package:photo_view/photo_view.dart'; import '../../utils/flutter_wave_loading.dart'; @@ -30,6 +32,7 @@ class _JobReportState extends State with CommonMixin { List? involveClasses = []; JobReportJoinClass? classData; + JobReportModel? jobReportModel; @override void initState() { @@ -68,6 +71,153 @@ class _JobReportState extends State with CommonMixin { return null; } + Future detailKnowledgeCall(KnowledgeInfos knowledge) async { + ToastUtils.showLoading(); + try { + if (knowledge.details == null) { + RestClient _client = await getClient(); + BaseStructureResult> datas = + await _client.getDetailKnowledge(widget.id, knowledge.knowledgeId); + if (!datas.success) return ToastUtils.showInfo(datas.message ?? '获取知识点失败'); + knowledge.details = datas.data; + } + + showDialog( + context: context, + builder: (BuildContext context1) { + return Container( + margin: EdgeInsets.symmetric(vertical: 150.h, horizontal: 24.w), + padding: EdgeInsets.symmetric(vertical: 15.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(18.sp), + ), + child: Column( + children: [ + Container( + alignment: Alignment.center, + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + quickText(knowledge.knowledgeName, color: Theme.of(context1).primaryColor, size: 16.sp), + quickText( + '的掌握情况', + color: Color.fromRGBO(60, 60, 60, 1), + size: 15.sp, + maxLines: 2, + ), + ], + )), + Expanded( + child: ListView(padding: EdgeInsets.symmetric(horizontal: 12.w), children: [ + DataTable( + sortAscending: false, + columns: [ + DataColumn( + label: quickText('班级', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('掌握度', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('人数', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('操作', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + ], + rows: [ + ...knowledge.details?.map((e) { + return DataRow(cells: [ + DataCell(quickText(e.className, color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText(e.rate > 0 ? doubleToStringAsFixed(e.rate) + '%' : 0, + color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText(e.ratio, color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText('详情', color: Color.fromRGBO(239, 135, 20, 1)), onTap: () { + showDialog( + context: context1, + builder: (BuildContext context2) { + return Container( + margin: EdgeInsets.symmetric(vertical: 150.h, horizontal: 24.w), + padding: EdgeInsets.symmetric(vertical: 15.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(18.sp), + ), + child: Column( + children: [ + Container( + child: quickText( + '${e.className}的掌握情况', + color: Color.fromRGBO(239, 135, 20, 1), + size: 16.sp, + maxLines: 2, + fontWeight: FontWeight.bold, + )), + SizedBox(height: 20.h), + Expanded( + child: + ListView(padding: EdgeInsets.symmetric(horizontal: 12.w), children: [ + DataTable( + sortAscending: false, + columns: [ + DataColumn( + label: quickText('学生名字', + color: Color.fromRGBO(114, 114, 114, 1), + size: 14.sp, + fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('掌握度', + color: Color.fromRGBO(114, 114, 114, 1), + size: 14.sp, + fontWeight: FontWeight.bold), + ), + ], + rows: [ + ...e.studentReports.map((e) { + return DataRow( + cells: [ + DataCell(quickText(e.studentName)), + DataCell(e.pass + ? Icon(Icons.check_outlined, color: Colors.green) + : Icon(Icons.close_outlined, color: Colors.red)), + ], + ); + }).toList() + ], + ), + ]), + ) + ], + ), + ); + }, + ); + }), + ]); + }).toList() ?? + [], + ], + ), + ]), + ) + ], + ), + ); + }, + ); + } catch (e) { + } finally { + ToastUtils.dismiss(); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -107,11 +257,11 @@ class _JobReportState extends State with CommonMixin { // 顶部图形数据 $TopGraphic(data), // 掌握知识点的情况 - $MasterKnowledgePoint(data.knowledgeInfos), + $MasterKnowledgePoint(data.knowledgeInfos, detailKnowledgeCall), // 掌握知识点的情况 $OverallPerformance(data.studentCount, data.overallTitles), // 单位时间答题情况 - $UnitTimeAnsweringSituation(data.questionAnswerInfos), + $UnitTimeAnsweringSituation(widget.id, data.questionAnswerInfos), // 人员数据概况 $PersonnelDataOverview(data.studentAnswerInfos), ], @@ -148,6 +298,7 @@ Widget $topGraphic(BuildContext context, JobReportModel data) { void showDetail(String showType) async { // 全对 及格 不及格 未做 List students = []; + List dataColumns = []; String title = ''; switch (showType) { case '全对': @@ -183,31 +334,42 @@ Widget $topGraphic(BuildContext context, JobReportModel data) { child: Column( children: [ Container(child: quickText('$title学生', color: Color.fromRGBO(60, 60, 60, 1), size: 15.sp)), - // Expanded( - // child: ListView(padding: EdgeInsets.symmetric(horizontal: 12.w), children: [ - // DataTable( - // columns: [ - // DataColumn( - // label: quickText('姓名', - // color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), - // numeric: true), - // DataColumn( - // label: quickText('正确率', - // color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), - // numeric: true), - // DataColumn( - // label: quickText('未答题数', - // color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), - // numeric: true), - // ], - // rows: [ - // DataRow(cells: [ - // DataCell(quickText('', color: Color.fromRGBO(61, 61, 61, 1))), - // ]), - // ], - // ), - // ]), - // ) + Expanded( + child: ListView(padding: EdgeInsets.symmetric(horizontal: 12.w), children: [ + DataTable( + sortAscending: false, + columns: [ + DataColumn( + label: quickText('姓名', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('正确率', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('未答题数', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + DataColumn( + label: quickText('用时(秒)', + color: Color.fromRGBO(114, 114, 114, 1), size: 14.sp, fontWeight: FontWeight.bold), + ), + ], + rows: [ + ...students.map((e) { + return DataRow(cells: [ + DataCell(quickText(e.studentName, color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText(doubleToStringAsFixed(e.correctRate) + '%', + color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText(e.noAnswerCount, color: Color.fromRGBO(61, 61, 61, 1))), + DataCell(quickText(e.useTime, color: Color.fromRGBO(61, 61, 61, 1))), + ]); + }).toList(), + ], + ), + ]), + ) ], ), ); @@ -768,7 +930,8 @@ Widget $topGraphic(BuildContext context, JobReportModel data) { /// 掌握知识点的情况 @swidget -Widget $masterKnowledgePoint(BuildContext context, List knowledgeInfos) { +Widget $masterKnowledgePoint(BuildContext context, List knowledgeInfos, + Future Function(KnowledgeInfos knowledge) detailCall) { Widget childItem(int serialNumber, KnowledgeInfos knowItem) => Container( margin: EdgeInsets.only(bottom: 20.h), child: Column( @@ -815,13 +978,16 @@ Widget $masterKnowledgePoint(BuildContext context, List knowledg barRadius: Radius.circular(10.r), )), SizedBox(width: 10.w), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - quickText('查看', size: 14.sp, color: Color.fromRGBO(239, 135, 20, 1)), - Icon(Icons.arrow_forward_ios, size: 11.sp, color: Color.fromRGBO(239, 135, 20, 1)), - ], - ) + InkWell( + onTap: () => detailCall(knowItem), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + quickText('查看', size: 14.sp, color: Color.fromRGBO(239, 135, 20, 1)), + Icon(Icons.arrow_forward_ios, size: 11.sp, color: Color.fromRGBO(239, 135, 20, 1)), + ], + ), + ), ], ) ], @@ -897,7 +1063,7 @@ Widget $overallPerformance(int totalNumber, List overallTitles) { /// 单位时间答题情况 @swidget -Widget $unitTimeAnsweringSituation(BuildContext context, List questionAnswerInfos) { +Widget $unitTimeAnsweringSituation(BuildContext context, int jobid, List questionAnswerInfos) { List questionNos = []; // 题号 List questionTypes = []; // 题型 List completionStatusWithinThirtySeconds = []; // 30s内完成情况 @@ -906,8 +1072,8 @@ Widget $unitTimeAnsweringSituation(BuildContext context, List accuracys = []; // 正确率 List errorRate = []; // 错误率 List notDone = []; // 未做 - List viewOriginalQuestion = []; // 查看原题 - List operate = []; + List viewOriginalQuestion = []; // 查看原题 + List operate = []; Map> mapData = { '题号': questionNos, '题型': questionTypes, @@ -918,18 +1084,24 @@ Widget $unitTimeAnsweringSituation(BuildContext context, List 获取作业报告 @the_retrofit.GET("/api/jobs/student-job-for-class") Future>> getJobReportJoinClasses(@the_retrofit.Query("jobId") int jobId); + + // 作业 => 报告 ==> 获取知识点详情 + @the_retrofit.GET("/api/jobs/job-report-knowledge-detail") + Future>> getDetailKnowledge( + @the_retrofit.Query("jobid") int jobId, @the_retrofit.Query("knowid") int knowid); + + // 作业 => 报告 ==> 获取知识点详情 + @the_retrofit.GET("/api/jobs/job-report-question-detail") + Future>> getJobReportQuestionDetail( + @the_retrofit.Query("jobid") int jobId, @the_retrofit.Query("questionid") int questionid); } diff --git a/marking_app/lib/utils/request/rest_dio.dart b/marking_app/lib/utils/request/rest_dio.dart index ef15e14..ebbe168 100644 --- a/marking_app/lib/utils/request/rest_dio.dart +++ b/marking_app/lib/utils/request/rest_dio.dart @@ -160,7 +160,7 @@ class ResponseHandle extends Interceptor { void onResponse(Response response, ResponseInterceptorHandler handler) { const isProd = bool.fromEnvironment('dart.vm.product'); if (!isProd && RequestConfig.requestDataPrinting) { - printJson(response.data); + // printJson(response.data); } super.onResponse(response, handler); }