修复全部BUG

This commit is contained in:
DESKTOP-I3JPKHK\wy 2025-09-11 14:25:23 +08:00
parent b6af1f57a4
commit b7478fd785
19 changed files with 545 additions and 628 deletions

View File

@ -1,14 +1,6 @@
import 'package:dio/dio.dart' hide Headers;
import 'package:making_school_asignment_app/common/job/app_version.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/original_manuscript_handwriting_params.dart';
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
import 'package:making_school_asignment_app/common/job/user_register_params.dart';
import 'package:making_school_asignment_app/page/home_page/children/homework_review/components/job_handwriting.dart';
import 'package:retrofit/retrofit.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
import 'package:making_school_asignment_app/common/job/app_version.dart';
import 'package:making_school_asignment_app/common/job/class_item.dart';
import 'package:making_school_asignment_app/common/job/common/app_version_model.dart';
import 'package:making_school_asignment_app/common/job/common/base_app_version.dart';
@ -17,13 +9,21 @@ import 'package:making_school_asignment_app/common/job/enum_subject.dart';
import 'package:making_school_asignment_app/common/job/homework_details.dart';
import 'package:making_school_asignment_app/common/job/knowledge_points_grasp.dart';
import 'package:making_school_asignment_app/common/job/knowledge_report_detail.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/original_manuscript_handwriting_params.dart';
import 'package:making_school_asignment_app/common/job/marking_models/review_submission_params.dart';
import 'package:making_school_asignment_app/common/job/student_history.dart';
import 'package:making_school_asignment_app/common/job/student_history_params.dart';
import 'package:making_school_asignment_app/common/job/student_item.dart';
import 'package:making_school_asignment_app/common/job/student_personal_info.dart';
import 'package:making_school_asignment_app/common/job/user_info_detail.dart';
import 'package:making_school_asignment_app/common/job/user_register_params.dart';
import 'package:making_school_asignment_app/common/job/work_student.dart';
import 'package:making_school_asignment_app/common/job/work_student_params.dart';
import 'package:making_school_asignment_app/page/home_page/children/homework_review/components/job_handwriting.dart';
import 'package:retrofit/retrofit.dart';
part 'retrofit_client.g.dart';
@ -64,7 +64,7 @@ abstract class RetrofitClient {
//
@GET("/api/rbac/Student/GetPriorityAnnotateStudents")
Future<List<StudentItem>> getStudentList(@Query('ClassId') String classId, @Query('Subject') int subject);
Future<List<StudentItem>> getStudentList(@Query('ClassId') String classId, @Query('Subject') int? subject);
//
@GET("/api/hms/Annotate/GetUnAnnotateList")
@ -88,16 +88,22 @@ abstract class RetrofitClient {
//
@POST("/api/rbac/Student/PriorityAnnotateStudent")
Future getAnnotateStudent(@Field() String classId, @Field() int studentId, @Field() bool priorityAnnotate, @Field() int subject);
Future getAnnotateStudent(
@Field() String classId, @Field() int studentId, @Field() bool priorityAnnotate, @Field() int? subject);
//
@GET("/api/hms/HmsReport/GetStudentHomework")
Future<StudentPersonalInfo> getStudentHomework(@Query('HomeworkId') String homeworkId, @Query('StudentId') int studentId);
Future<StudentPersonalInfo> getStudentHomework(
@Query('HomeworkId') String homeworkId, @Query('StudentId') int studentId);
//
@GET("/api/hms/HmsReport/GetKnowledgeReport")
Future<List<KnowledgePointsGrasp>> getKnowledgeReport(
@Query('DateStart') String dateStart, @Query('DateEnd') String dateEnd, @Query('KnowledgeName') String knowledgeName,@Query('ClassId') String classId,@Query('Subject') int subject);
@Query('DateStart') String dateStart,
@Query('DateEnd') String dateEnd,
@Query('KnowledgeName') String knowledgeName,
@Query('ClassId') String classId,
@Query('Subject') int? subject);
//
@GET("/api/hms/HmsReport/GetKnowledgeReportDetail")
@ -106,8 +112,8 @@ abstract class RetrofitClient {
//
@GET("/api/hms/HmsReport/GetQuestionStudentState")
Future<List<Students>> getQuestionStudentState(
@Query('HomeworkId') String homeworkId, @Query('TemplateId') int templateId, @Query('QuestionNo') String questionNo);
Future<List<Students>> getQuestionStudentState(@Query('HomeworkId') String homeworkId,
@Query('TemplateId') int templateId, @Query('QuestionNo') String questionNo);
//
@POST("/api/hms/Homework/Collect")
@ -124,7 +130,8 @@ abstract class RetrofitClient {
//
@GET("/api/hms/FavStudent/GetList")
Future<BasePageData<HomeworkFavs>> getFavList(@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
Future<BasePageData<HomeworkFavs>> getFavList(
@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
// ()
@POST("/api/hms/Annotate/AllCorrect")
@ -148,5 +155,6 @@ abstract class RetrofitClient {
// APP
@GET("/api/infra/AppVersion/Get")
Future<AppVersion?> getLastAppVersion(@Query('appName') String appName, @Query('ftuType') int ftuType); // ftuType 1 2IOS 3windows
Future<AppVersion?> getLastAppVersion(
@Query('appName') String appName, @Query('ftuType') int ftuType); // ftuType 1 2IOS 3windows
}

View File

@ -1,52 +1,61 @@
import 'package:get/get.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:making_school_asignment_app/common/config/request_config.dart';
part 'do_paper_details_result.g.dart';
///
@JsonSerializable(checked: true, includeIfNull: false)
class DoPaperDetailsResult extends Object {
class DoPaperDetailsResult {
@JsonKey(name: 'templateIds')
Map<String, bool> templateIds;
final Map<String, bool> templateIds;
//
/// ID键列表
@JsonKey(name: 'templateIdKeys')
List<int>? templateIdKeys;
//
/// ID键映射表
@JsonKey(name: 'templateIdKeyMap')
Map<int, int>? templateIdKeyMap;
@JsonKey(name: 'submitStudents', toJson: _paperStudentsToJson) //
List<PaperStudents> students;
///
@JsonKey(name: 'submitStudents', toJson: _paperStudentsToJson)
final List<PaperStudents> students;
/// ID
@JsonKey(name: 'templateId')
int templateId;
final int templateId;
/// ID
@JsonKey(name: 'studentId')
int studentId;
final int studentId;
//
///
@JsonKey(name: 'priority', defaultValue: false)
bool priority;
@JsonKey(name: 'annotatedCount') //
int annotatedCount;
///
@JsonKey(name: 'annotatedCount')
final int annotatedCount;
@JsonKey(name: 'submitCount') //
int submitCount;
///
@JsonKey(name: 'submitCount')
final int submitCount;
@JsonKey(name: 'zgtAnswer') //
///
@JsonKey(name: 'zgtAnswer')
String zgtAnswer;
@JsonKey(name: 'showZgtAnnotate') //
///
@JsonKey(name: 'showZgtAnnotate')
String? showZgtAnnotate;
@JsonKey(name: 'zgtAnnotate') //
///
@JsonKey(name: 'zgtAnnotate')
String? zgtAnnotate;
@JsonKey(name: 'lastAnswerTime') //
String lastAnswerTime;
///
@JsonKey(name: 'lastAnswerTime')
final String lastAnswerTime;
//
@JsonKey(name: 'annotateTime')
@ -67,7 +76,6 @@ class DoPaperDetailsResult extends Object {
@JsonKey(name: 'continuePage', toJson: _continuePageToJson)
ContinuePage? continuePage;
@JsonKey(name: 'nextPage', toJson: _nextPageToJson)
NextPage? nextPage;
@ -102,35 +110,42 @@ class DoPaperDetailsResult extends Object {
this.annotateTime,
this.showZgtAnnotate,
{this.needAnnotate = false}) {
if (templateIds.keys.isNotEmpty) {
templateIdKeys = templateIds.keys.map((e) => int.parse(e)).toList();
// ID键列表和映射表
if (templateIds.isNotEmpty) {
templateIdKeys = templateIds.keys.map(int.parse).toList();
templateIdKeyMap = <int, int>{};
for (var i = 1; i <= templateIdKeys!.length; i++) {
var theVal = templateIdKeys![i - 1];
templateIdKeyMap![i] = theVal;
templateIdKeyMap![theVal] = i;
for (int i = 0; i < templateIdKeys!.length; i++) {
final templateId = templateIdKeys![i];
templateIdKeyMap![i + 1] = templateId;
templateIdKeyMap![templateId] = i + 1;
}
}
//
//
if (students.isNotEmpty) {
var currentStudent = students.firstWhereOrNull((e) => e.id == studentId);
if (currentStudent != null) priority = currentStudent.isPriority;
try {
final currentStudent = students.firstWhere((e) => e.id == studentId);
priority = currentStudent.isPriority;
} catch (e) {
//
}
}
// URL
if (!zgtAnswer.contains(RequestConfig.imgUrl)) {
zgtAnswer = '${RequestConfig.imgUrl}$zgtAnswer?$lastAnswerTime';
}
if (zgtAnnotate?.isNotEmpty ?? false) {
showZgtAnnotate = RequestConfig.imgUrl + zgtAnnotate!; //
if (annotateTime != null) showZgtAnnotate = '${showZgtAnnotate!}?$annotateTime';
// URL
if (zgtAnnotate?.isNotEmpty == true) {
showZgtAnnotate = RequestConfig.imgUrl + zgtAnnotate!;
if (annotateTime != null) {
showZgtAnnotate = '${showZgtAnnotate!}?$annotateTime';
}
}
//
if (annotateTime == null || studentQuestions.indexWhere((e) => e.studentScore == null) != -1) {
needAnnotate = true;
}
needAnnotate = annotateTime == null || studentQuestions.any((e) => e.studentScore == null);
// print('学生作答图片:${annotatedCount}');
// print('老师批注图片提交数量:${submitCount}');
}
@ -139,14 +154,15 @@ class DoPaperDetailsResult extends Object {
Map<String, dynamic> toJson() => _$DoPaperDetailsResultToJson(this);
static List<Map<String, dynamic>> _paperStudentsToJson(List<PaperStudents> examples) => examples.map((e) => e.toJson()).toList();
static List<Map<String, dynamic>> _paperStudentsToJson(List<PaperStudents> examples) =>
examples.map((e) => e.toJson()).toList();
static List<Map<String, dynamic>> _studentQuestionsToJson(List<StudentQuestions> examples) => examples.map((e) => e.toJson()).toList();
static List<Map<String, dynamic>> _studentQuestionsToJson(List<StudentQuestions> examples) =>
examples.map((e) => e.toJson()).toList();
static Map<String, dynamic>? _nextPageToJson(NextPage? example) => example?.toJson();
static Map<String, dynamic>? _lastPageToJson(LastPage? example) => example?.toJson();
static Map<String, dynamic>? _continuePageToJson(ContinuePage? example) => example?.toJson();
}
@JsonSerializable()
@ -260,22 +276,20 @@ class NextPage extends Object {
Map<String, dynamic> toJson() => _$NextPageToJson(this);
}
@JsonSerializable()
class ContinuePage extends Object {
class ContinuePage extends Object {
@JsonKey(name: 'templateId')
int templateId;
@JsonKey(name: 'studentId')
int studentId;
ContinuePage(this.templateId,this.studentId,);
ContinuePage(
this.templateId,
this.studentId,
);
factory ContinuePage.fromJson(Map<String, dynamic> srcJson) => _$ContinuePageFromJson(srcJson);
Map<String, dynamic> toJson() => _$ContinuePageToJson(this);
}

View File

@ -3,18 +3,26 @@ import 'package:making_school_asignment_app/common/store/user_store.dart';
class EnumUtils {
static String formatSubject(int id) {
if (UserStore.to.subjectList.isEmpty || id == null) {
if (UserStore.to.subjectList.isEmpty) {
return '';
}
try {
EnumSubject item = UserStore.to.subjectList.firstWhere((element) => element.id == id);
return item.name;
} catch (e) {
return '';
}
EnumSubject item = UserStore.to.subjectList.firstWhere((element) => element.id == id);
return item.name ?? '';
}
static String formatGrade(int id) {
if (UserStore.to.gradeList.isEmpty || id == null) {
if (UserStore.to.gradeList.isEmpty) {
return '';
}
try {
EnumSubject item = UserStore.to.gradeList.firstWhere((element) => element.id == id);
return item.name;
} catch (e) {
return '';
}
EnumSubject item = UserStore.to.gradeList.firstWhere((element) => element.id == id);
return item.name ?? '';
}
}

View File

@ -291,6 +291,8 @@ class ShapeRecognizer {
/// 线线
/// 线 RDP
bool _getSlashDetails(List<Offset> points) {
if (points.isEmpty) return false;
final simplified = RamerDouglasPeucker.simplify(points, rdpEpsilon);
// 1. 2线线

View File

@ -1,12 +1,10 @@
import 'dart:convert';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/homework_details.dart';
import 'package:making_school_asignment_app/page/home_page/children/quick_data_check/quick_data_check_state.dart';
import 'dart:math';
import '../config/request_config.dart';
@ -23,17 +21,13 @@ class Utils {
///
static void hideKeyboard() {
FocusScopeNode? currentFocus = Get.focusScope?.nearestScope;
if (currentFocus == null) {
return;
}
if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
final currentFocus = Get.focusScope?.nearestScope;
if (currentFocus != null && !currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
FocusManager.instance.primaryFocus?.unfocus();
}
}
void setTimeOut(int seconds, call) =>
Future.delayed(Duration(seconds: seconds), call);
void setTimeOut(int seconds, VoidCallback call) => Future.delayed(Duration(seconds: seconds), call);
//
static bool isPad([double mobilePhoneScale = 1.2]) {
@ -43,9 +37,9 @@ class Utils {
static String getDoubleRemoveZero(double? val, [String? defaultVal]) {
try {
if (val == null) throw Exception('数据为空');
List<String> _valArr = val.toString().split('.');
if (_valArr.length >= 2) {
if (int.parse(_valArr[1]) == 0) {
List<String> valArr = val.toString().split('.');
if (valArr.length >= 2) {
if (int.parse(valArr[1]) == 0) {
return val.toInt().toString();
}
return val.toString();
@ -97,43 +91,30 @@ class Utils {
dataCount.kgtAnswerCount = kgt.where((w) => w.state != 0).length;
dataCount.kgtOkCount = kgt.where((w) => w.state == 3).length;
dataCount.kgtDtlCount = kgt.length;
dataCount.kgtAnswerRate =
Utils.calcRate(dataCount.kgtAnswerCount!, dataCount.kgtDtlCount!);
dataCount.kgtOkRate =
Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtDtlCount!);
dataCount.kgtAnswerRate = Utils.calcRate(dataCount.kgtAnswerCount!, dataCount.kgtDtlCount!);
dataCount.kgtOkRate = Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtDtlCount!);
dataCount.kgtCorrectRate =
Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtAnswerCount!);
dataCount.kgtCount =
data.questions.where((w) => w.questionType == 1).length;
dataCount.kgtCorrectRate = Utils.calcRate(dataCount.kgtOkCount!, dataCount.kgtAnswerCount!);
dataCount.kgtCount = data.questions.where((w) => w.questionType == 1).length;
List<Dtls> zgt = data.dtls.where((w) => w.questionType == 2).toList();
dataCount.zgtAnswerCount = zgt.where((w) => w.state != 0).length;
dataCount.zgtOkCount = zgt.where((w) => w.state == 3).length;
dataCount.zgtDtlCount = zgt.length;
dataCount.zgtAnswerRate =
Utils.calcRate(dataCount.zgtAnswerCount!, dataCount.zgtDtlCount!);
dataCount.zgtOkRate =
Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtDtlCount!);
dataCount.zgtAnswerRate = Utils.calcRate(dataCount.zgtAnswerCount!, dataCount.zgtDtlCount!);
dataCount.zgtOkRate = Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtDtlCount!);
dataCount.zgtCorrectRate =
Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtAnswerCount!);
dataCount.zgtCount =
data.questions.where((w) => w.questionType == 2).length;
dataCount.zgtCorrectRate = Utils.calcRate(dataCount.zgtOkCount!, dataCount.zgtAnswerCount!);
dataCount.zgtCount = data.questions.where((w) => w.questionType == 2).length;
dataCount.studentCount = data.students.length;
dataCount.priorityStudents =
data.students.where((w) => w.priorityAnnotate!).toList();
dataCount.priorityStudents = data.students.where((w) => w.priorityAnnotate!).toList();
//
dataCount.studentSubmitCount =
data.students.where((s) => s.state != 0).length;
dataCount.studentSubmitStudents =
data.students.where((s) => s.state != 0).toList();
dataCount.studentSubmitCount = data.students.where((s) => s.state != 0).length;
dataCount.studentSubmitStudents = data.students.where((s) => s.state != 0).toList();
//
dataCount.noAnswerCount =
data.students.length - dataCount.studentSubmitCount!;
dataCount.noAnswerStudents =
data.students.where((s) => s.state == 0).toList();
dataCount.noAnswerCount = data.students.length - dataCount.studentSubmitCount!;
dataCount.noAnswerStudents = data.students.where((s) => s.state == 0).toList();
for (var stu in data.students) {
stu.kgtStu = kgt.where((w) => w.studentId == stu.studentId).toList();
@ -141,16 +122,13 @@ class Utils {
// stu.kgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
stu.kgtStu!.sort((a, b) {
try {
if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) &&
RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) {
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());
return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase());
}
});
stu.kgtOkCount = stu.kgtStu!.where((w) => w.state == 3).length;
@ -161,16 +139,13 @@ class Utils {
// stu.zgtStu!.sort((a, b) => num.parse(a.questionNo).compareTo(num.parse(b.questionNo)));
stu.zgtStu!.sort((a, b) {
try {
if (RegExp(r'^\d*\.?\d+$').hasMatch(a.questionNo) &&
RegExp(r'^\d*\.?\d+$').hasMatch(b.questionNo)) {
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());
return a.questionNo.toLowerCase().compareTo(b.questionNo.toLowerCase());
}
});
//
@ -181,43 +156,32 @@ class Utils {
stu.zgtUnrated = stu.zgtStu!.where((w) => w.state == 1).length;
//
stu.zgtAnswerCount = stu.zgtStu!.where((w) => w.state != 0).length;
stu.isAllCorrect =
stu.kgtOkCount! + stu.zgtOkCount! == kgt.length + zgt.length
? true
: false;
stu.isAllCorrect = stu.kgtOkCount! + stu.zgtOkCount! == kgt.length + zgt.length ? true : false;
stu.allOk = data.dtls.where((w) {
if (stu.studentId == w.studentId) {
stu.useTime = w.useTime;
}
for (var que in data.questions) {
if (w.templateId == que.templateId &&
w.questionNo == que.questionNo) {
w.answer = que.answer;
w.questionPicture = que.questionPicture;
}
}
return w.studentId == stu.studentId && w.state != 3;
}).length ??
0;
if ((stu.kgtStu!.length - stu.kgtAnswerCount!) +
(stu.zgtStu!.length - stu.zgtAnswerCount!) ==
if (stu.studentId == w.studentId) {
stu.useTime = w.useTime;
}
for (var que in data.questions) {
if (w.templateId == que.templateId && w.questionNo == que.questionNo) {
w.answer = que.answer;
w.questionPicture = que.questionPicture;
}
}
return w.studentId == stu.studentId && w.state != 3;
}).length;
if ((stu.kgtStu!.length - stu.kgtAnswerCount!) + (stu.zgtStu!.length - stu.zgtAnswerCount!) ==
(stu.kgtStu!.length + stu.zgtStu!.length)) {
stu.allNotDone = true;
} else {
stu.allNotDone = false;
}
stu.noAnswerCount = data.dtls
.where((w) => w.state == 0 && stu.studentId == w.studentId)
.length;
stu.noAnswerCount = data.dtls.where((w) => w.state == 0 && stu.studentId == w.studentId).length;
List<Questions> ques = data.questions;
stu.queDtls = data.dtls
.where((w) =>
w.studentId == stu.studentId &&
ques.indexWhere((q) =>
w.templateId == q.templateId &&
w.questionNo == q.questionNo) >
-1)
ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
.toList();
int okCount = stu.queDtls!.where((w) => w.state == 3).length;
int ttlCount = stu.queDtls!.length;
@ -241,15 +205,7 @@ class Utils {
secList.sort();
/* var maxSec = secList.isNotEmpty ? secList.last : 0;
var minSec = secList.isNotEmpty ? secList.first : 0;*/
var maxSec = secList.isNotEmpty
? secList
.reduce((value, element) => value > element ? value : element)
: 0;
var minSec = secList.isNotEmpty
? secList
.reduce((value, element) => value < element ? value : element)
: 0;
var secTime = secList.isNotEmpty ? maxSec - minSec : 0;
final secTime = secList.isNotEmpty ? secList.last - secList.first : 0;
stu.allTime = secTime;
stu.ttlSec = second2HMS(secTime);
}
@ -259,43 +215,32 @@ class Utils {
int num2 = b.state;
return num2.compareTo(num1);
});
//
dataCount.allCorrect =
data.students.where((w) => w.isAllCorrect == true).length;
dataCount.allCorrectStudents =
data.students.where((w) => w.isAllCorrect == true).toList();
//
dataCount.levelOneCount =
data.students.where((s) => s.okRate! >= 85).length;
dataCount.levelOneStudents =
data.students.where((s) => s.okRate! >= 85).toList();
//
final allCorrectStudents = data.students.where((w) => w.isAllCorrect == true).toList();
dataCount.allCorrect = allCorrectStudents.length;
dataCount.allCorrectStudents = allCorrectStudents;
//
dataCount.levelTwoCount =
data.students.where((s) => s.okRate! < 85 && s.okRate! >= 55).length;
dataCount.levelTwoStudents =
data.students.where((s) => s.okRate! < 85 && s.okRate! >= 55).toList();
final levelOneStudents = data.students.where((s) => s.okRate! >= 85).toList();
dataCount.levelOneCount = levelOneStudents.length;
dataCount.levelOneStudents = levelOneStudents;
//
dataCount.levelThreeCount =
data.students.where((s) => s.okRate! < 55 && s.okRate! >= 25).length;
dataCount.levelThreeStudents =
data.students.where((s) => s.okRate! < 55 && s.okRate! >= 25).toList();
final levelTwoStudents = data.students.where((s) => s.okRate! < 85 && s.okRate! >= 55).toList();
dataCount.levelTwoCount = levelTwoStudents.length;
dataCount.levelTwoStudents = levelTwoStudents;
//
dataCount.levelFourCount =
data.students.where((s) => s.okRate! < 25).length;
dataCount.levelFourStudents =
data.students.where((s) => s.okRate! < 25).toList();
final levelThreeStudents = data.students.where((s) => s.okRate! < 55 && s.okRate! >= 25).toList();
dataCount.levelThreeCount = levelThreeStudents.length;
dataCount.levelThreeStudents = levelThreeStudents;
final levelFourStudents = data.students.where((s) => s.okRate! < 25).toList();
dataCount.levelFourCount = levelFourStudents.length;
dataCount.levelFourStudents = levelFourStudents;
for (var que in data.questions) {
List<Dtls> ques = data.dtls
.where((w) =>
w.templateId == que.templateId && w.questionNo == que.questionNo)
.toList();
List<Dtls> ques =
data.dtls.where((w) => w.templateId == que.templateId && w.questionNo == que.questionNo).toList();
que.answerCount = ques.where((w) => w.state != 0).length;
que.answerRate =
Utils.calcRate(que.answerCount!, dataCount.studentCount!);
que.answerRate = Utils.calcRate(que.answerCount!, dataCount.studentCount!);
int okCount = ques.where((w) => w.state == 3).length;
que.okRate = Utils.calcRate(okCount, dataCount.studentCount!);
que.priorityInfo = ques.where((w) {
@ -308,9 +253,12 @@ class Utils {
}).toList();
que.correctRate = Utils.calcRate(okCount, que.answerCount!);
que.answerNgStudents = ques.where((w) {
w.studentName = data.students
.firstWhere((s) => s.studentId == w.studentId)
.studentName;
try {
var student = data.students.firstWhere((s) => s.studentId == w.studentId);
w.studentName = student.studentName;
} catch (e) {
w.studentName = '';
}
return w.state == 2;
}).toList();
@ -325,21 +273,16 @@ class Utils {
int middleTime = 0;
if (ques.length % 2 == 0) {
int index = (ques.length / 2).ceil();
middleTime =
((ques[index].useTime + ques[index - 1].useTime) / 2).ceil();
middleTime = ((ques[index].useTime + ques[index - 1].useTime) / 2).ceil();
} else {
int index = ((ques.length + 1) / 2).ceil();
middleTime = ques[index - 1].useTime;
}
var excellent =
ques.where((w) => w.state == 3 && w.useTime <= middleTime).length;
var good =
ques.where((w) => w.state == 3 && w.useTime > middleTime).length;
var middle =
ques.where((w) => w.state != 3 && w.useTime <= middleTime).length;
var differ =
ques.where((w) => w.state != 3 && w.useTime > middleTime).length;
var excellent = ques.where((w) => w.state == 3 && w.useTime <= middleTime).length;
var good = ques.where((w) => w.state == 3 && w.useTime > middleTime).length;
var middle = ques.where((w) => w.state != 3 && w.useTime <= middleTime).length;
var differ = ques.where((w) => w.state != 3 && w.useTime > middleTime).length;
que.overallTitles = [
OverallTitles('优秀', excellent),
@ -349,8 +292,7 @@ class Utils {
];
Map<String, int> optInfos = {};
for (var d in ques
.where((w) => w.questionType == 1 && w.studentAnswer != null)) {
for (var d in ques.where((w) => w.questionType == 1 && w.studentAnswer != null)) {
final key = d.studentAnswer!;
if (optInfos[key] != null) {
optInfos[key] = optInfos[key]! + 1;
@ -362,21 +304,14 @@ class Utils {
optInfos.forEach((key, value) {
// optInfos[key] = Utils.calcRate(value, ques.length).round();
List<Students> currentOptionStudents = data.students
.where((s) => ques
.where(
(w) => w.studentAnswer == key && w.studentId == s.studentId)
.isNotEmpty)
.where((s) => ques.where((w) => w.studentAnswer == key && w.studentId == s.studentId).isNotEmpty)
.toList();
//
String upStr = key.toUpperCase();
List<String> chars = upStr.split('')..sort();
String sortedStr = chars.join();
student.add(SelectionRate(
sortedStr,
Utils.calcRate(value, ques.length).round(),
false,
currentOptionStudents));
student.add(SelectionRate(sortedStr, Utils.calcRate(value, ques.length).round(), false, currentOptionStudents));
});
/* print('optitems=$optInfos');
var ARate = Utils.calcRate(
@ -385,16 +320,10 @@ class Utils {
}
for (var know in data.knows) {
List<Questions> ques = data.questions
.where((w) =>
w.knows.indexWhere((k) => k.knowledgeId == know.knowledgeId) > -1)
.toList();
List<Questions> ques =
data.questions.where((w) => w.knows.indexWhere((k) => k.knowledgeId == know.knowledgeId) > -1).toList();
List<Dtls> queDtls = data.dtls
.where((w) =>
ques.indexWhere((q) =>
w.templateId == q.templateId &&
w.questionNo == q.questionNo) >
-1)
.where((w) => ques.indexWhere((q) => w.templateId == q.templateId && w.questionNo == q.questionNo) > -1)
.toList();
know.okCount = queDtls.where((w) => w.state == 3).length;
know.ttlCount = queDtls.length;
@ -433,8 +362,7 @@ bool isPad([double mobilePhoneScale = 1.2]) {
return ScreenUtil().scaleWidth > mobilePhoneScale;
}
void toUpState(
Function(void Function()) setState, VoidCallback fn, bool mounted) {
void toUpState(Function(void Function()) setState, VoidCallback fn, bool mounted) {
if (mounted) setState(fn);
}

View File

@ -1,7 +1,6 @@
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';
import 'package:making_school_asignment_app/common/job/student_item.dart';
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dart';
@ -16,7 +15,8 @@ class ClassStudentLogic extends GetxController with RequestToolMixin {
super.onInit();
state.title.value = Get.arguments['title'] ?? '';
state.classId = Get.arguments['classId'] ?? '';
state.subject = Get.arguments['subject'] ?? -1;
final subject = Get.arguments['subject'];
state.subject = subject == 0 ? null : subject;
state.page = Get.arguments['page'] ?? '';
EasyLoading.show(status: 'loading...');
refreshController = EasyRefreshController();

View File

@ -8,7 +8,7 @@ class ClassStudentState {
late RxString title = ''.obs;
late final String classId;
late final int subject;
late final int? subject;
late RxList<StudentItem> studentList = RxList();
late String page = '';
late bool isClicking = true;

View File

@ -12,7 +12,7 @@ import 'package:making_school_asignment_app/page/home_page/children/job_report/w
import 'fav_student_logic.dart';
class FavStudentPage extends StatefulWidget {
const FavStudentPage({Key? key}) : super(key: key);
const FavStudentPage({super.key});
@override
State<FavStudentPage> createState() => _FavStudentPageState();
@ -20,9 +20,7 @@ class FavStudentPage extends StatefulWidget {
class _FavStudentPageState extends State<FavStudentPage> {
final logic = Get.find<FavStudentLogic>();
final state = Get
.find<FavStudentLogic>()
.state;
final state = Get.find<FavStudentLogic>().state;
void showStudentDialog(BuildContext context, HomeworkFavs item, List groups) {
showDialog(
@ -31,16 +29,13 @@ class _FavStudentPageState extends State<FavStudentPage> {
return AlertDialog(
insetPadding: EdgeInsets.all(25.r),
content: FavoriteStudentDialog(
item: item,
group: groups,
deleteFav: logic.getDelete,
confirmDialog: confirmDialog),
item: item, group: groups, deleteFav: logic.getDelete, confirmDialog: confirmDialog),
contentPadding: const EdgeInsets.all(0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15.r))));
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(15.r))));
},
);
}
Future<bool> confirmDialog() async {
return await showDialog(
context: context,
@ -62,9 +57,9 @@ class _FavStudentPageState extends State<FavStudentPage> {
),
child: const Center(
child: Text(
'确定',
style: TextStyle(color: Colors.white),
))),
'确定',
style: TextStyle(color: Colors.white),
))),
onTap: () {
//
// Navigator.of(context).pop(true);
@ -85,300 +80,245 @@ class _FavStudentPageState extends State<FavStudentPage> {
),
child: const Center(
child: Text(
'取消',
style: TextStyle(color: Color(0xFF666666)),
))),
'取消',
style: TextStyle(color: Color(0xFF666666)),
))),
),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
appBar: AppBar(
// titleSpacing: 0,
elevation: 0.0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios),
onPressed: () {
Get.back();
}),
iconTheme: const IconThemeData(color: Colors.black),
title: quickText('收藏夹'),
centerTitle: true,
backgroundColor: Colors.white,
actions: const [
ReturnToHomepage(),
],
),
body:OrientationBuilder(
builder: (BuildContext context, Orientation orientation){
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 0.r, horizontal: 14.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Obx(() {
return Text(
state.homeworkName.value,
style:
TextStyle(fontSize: 14.sp, color: const Color(0xFF3C3C3C),),
overflow: TextOverflow.ellipsis,
);
}),
),
//
Container(
padding: EdgeInsets.symmetric(
vertical: 10.h, horizontal: 10.w),
child: Row(
children: [
Obx(() {
return DropdownSelection(
bgColor: Colors.white,
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.getList();
});
backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
appBar: AppBar(
// titleSpacing: 0,
elevation: 0.0,
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios),
onPressed: () {
Get.back();
}),
iconTheme: const IconThemeData(color: Colors.black),
title: quickText('收藏夹'),
centerTitle: true,
backgroundColor: Colors.white,
actions: const [
ReturnToHomepage(),
],
),
body: OrientationBuilder(builder: (BuildContext context, Orientation orientation) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 0.r, horizontal: 14.r),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Obx(() {
return Text(
state.homeworkName.value,
style: TextStyle(
fontSize: 14.sp,
color: const Color(0xFF3C3C3C),
),
overflow: TextOverflow.ellipsis,
);
}),
],
),
),
//
Container(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Row(
children: [
Obx(() {
return DropdownSelection(
bgColor: Colors.white,
involveClasses: state.involveClasses.value,
classData: state.classData.value,
onClassSelected: (AnnotatedClass item) {
state.classData.value = item;
if (item.grade == -1) state.classData.value = state.defaultClass;
logic.getList();
});
}),
],
),
),
],
),
],
),
),
Container(
width: MediaQuery
.of(context)
.size
.width,
height: 1.r,
decoration: const BoxDecoration(
color: Color(0xFFEEEEEE),
),
),
Obx((){
return state.favList.isNotEmpty
? Expanded(
child: Utils.isPad()
? Padding(
padding: EdgeInsets.only(
top: 10.r,
bottom: 8.r,
left: 14.r,
right: 14.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
List.generate(state.favList.length, (index) {
var item = state.favList[index];
return Padding(
padding: EdgeInsets.only(bottom: 8.r),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding:
EdgeInsets.only(bottom: 5.r),
child: Text(
'${item['questionPage']}',
style: TextStyle(
fontSize: 12.sp,
color:Theme.of(context).primaryColor),
),
),
GridView(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 8.r,
crossAxisSpacing: 10.r,
childAspectRatio: 556 / 112,
),
),
Container(
width: MediaQuery.of(context).size.width,
height: 1.r,
decoration: const BoxDecoration(
color: Color(0xFFEEEEEE),
),
),
Obx(() {
return state.favList.isNotEmpty
? Expanded(
child: Utils.isPad()
? Padding(
padding: EdgeInsets.only(top: 10.r, bottom: 8.r, left: 14.r, right: 14.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(state.favList.length, (index) {
var item = state.favList[index];
return Padding(
padding: EdgeInsets.only(bottom: 8.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 5.r),
child: Text(
'${item['questionPage']}',
style:
TextStyle(fontSize: 12.sp, color: Theme.of(context).primaryColor),
),
),
GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 8.r,
crossAxisSpacing: 10.r,
childAspectRatio: 556 / 112,
),
shrinkWrap: true,
children: List.generate(item['list'].length, (i) {
HomeworkFavs student = item['list'][i];
return Container(
padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 10.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6.r)),
),
child: InkWell(
onTap: () {
showStudentDialog(context, student, state.favList);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
quickText(student.studentName,
color: const Color(0xFF333333), size: 12.sp),
Expanded(child: Container()),
Padding(
padding: EdgeInsets.only(right: 8.r),
child: Text(
student.className!,
style: TextStyle(
fontSize: 12.sp, color: const Color(0xFF666666)),
),
),
InkWell(
onTap: () async {
var confim = await confirmDialog();
if (confim) {
logic.getDelete(student);
}
},
child: Image.asset(
'assets/images/favorite_delete_icon.png',
width: 24.r,
height: 24.r,
),
),
],
),
),
);
})),
],
),
);
})),
)
: ListView.builder(
shrinkWrap: true,
children: List.generate(
item['list'].length, (i) {
HomeworkFavs student = item['list'][i];
return Container(
padding: EdgeInsets.symmetric(
vertical: 5.r,
horizontal: 10.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.all(
Radius.circular(
6.r)),
),
child: InkWell(
onTap: () {
showStudentDialog(context,
student, state.favList);
},
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
quickText(
student.studentName,
color: const Color(
0xFF333333),
size: 12.sp),
Expanded(
child: Container()),
Padding(
padding:
EdgeInsets.only(
right: 8.r),
child: Text(
student.className!,
style: TextStyle(
fontSize: 12.sp,
color: const Color(
0xFF666666)),
),
itemBuilder: (context, index) {
var item = state.favList[index];
return Padding(
padding: EdgeInsets.only(top: 10.r, bottom: 8.r, left: 14.r, right: 14.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 5.r),
child: Text(
'${item['questionPage']}',
style: TextStyle(fontSize: 14.sp, color: Theme.of(context).primaryColor),
),
InkWell(
onTap: () async {
var confim =
await confirmDialog();
if (confim) {
logic.getDelete(
student);
}
},
child: Image.asset(
'assets/images/favorite_delete_icon.png',
width: 24.r,
height: 24.r,
),
),
],
),
),
ListView.builder(
itemBuilder: (context, i) {
HomeworkFavs student = item['list'][i];
return InkWell(
onTap: () {
showStudentDialog(context, student, state.favList);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 5.r, horizontal: 10.r),
margin: EdgeInsets.only(top: 5.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6.r)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
quickText(student.studentName,
color: const Color(0xFF333333), size: 14.sp),
Expanded(child: Container()),
Padding(
padding: EdgeInsets.only(right: 8.r),
child: Text(
student.className!,
style:
TextStyle(fontSize: 14.sp, color: const Color(0xFF666666)),
),
),
InkWell(
onTap: () async {
var confim = await confirmDialog();
if (confim) {
logic.getDelete(student);
}
},
child: Image.asset(
'assets/images/favorite_delete_icon.png',
width: 32.r,
height: 32.r,
),
),
],
),
),
);
},
itemCount: item['list'].length,
shrinkWrap: true,
),
],
),
);
})),
],
),
);
})),
)
: ListView.builder(
shrinkWrap: true,
itemBuilder: (context, index) {
var item = state.favList[index];
return Padding(
padding: EdgeInsets.only(
top: 10.r,
bottom: 8.r,
left: 14.r,
right: 14.r),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 5.r),
child: Text(
'${item['questionPage']}',
style: TextStyle(
fontSize: 14.sp,
color:Theme.of(context).primaryColor),
),
),
ListView.builder(
itemBuilder: (context, i) {
HomeworkFavs student = item['list'][i];
return InkWell(
onTap: () {
showStudentDialog(
context, student, state.favList);
},
child: Container(
padding: EdgeInsets.symmetric(
vertical: 5.r,
horizontal: 10.r),
margin: EdgeInsets.only(top: 5.r),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(6.r)),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
quickText(student.studentName,
color: const Color(0xFF333333),
size: 14.sp),
Expanded(child: Container()),
Padding(
padding: EdgeInsets.only(
right: 8.r),
child: Text(
student.className!,
style: TextStyle(
fontSize: 14.sp,
color: const Color(
0xFF666666)),
),
),
InkWell(
onTap: () async {
var confim =
await confirmDialog();
if (confim) {
logic.getDelete(student);
}
},
child: Image.asset(
'assets/images/favorite_delete_icon.png',
width: 32.r,
height: 32.r,
),
),
],
),
},
itemCount: state.favList.length,
),
);
},
itemCount: item['list'].length,
shrinkWrap: true,
),
],
),
);
},
itemCount: state.favList.length,
),
)
: Padding(
padding: EdgeInsets.only(
top: MediaQuery
.of(context)
.size
.height / 2 - 200.r),
child: const MyEmptyWidget(),
);
}),
],
);
}
)
);
)
: Padding(
padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 2 - 200.r),
child: const MyEmptyWidget(),
);
}),
],
);
}));
}
@override
@ -387,4 +327,4 @@ class _FavStudentPageState extends State<FavStudentPage> {
super.dispose();
logic.controller.getList();
}
}
}

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:functional_widget_annotation/functional_widget_annotation.dart';
import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_param.dart';
import 'package:making_school_asignment_app/common/job/marking_models/do_paper_details_result.dart';
import 'package:making_school_asignment_app/common/utils/anti_shake_throttling.dart';
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
@ -77,9 +78,14 @@ class DropdownSwitchStudentsType extends StatelessWidget {
final students = sateData.value?.students ?? [];
//
final currentStudent = currentStudentId != null
? students.firstWhereOrNull((e) => e.id == currentStudentId)
: null;
PaperStudents? currentStudent;
if (currentStudentId != null) {
try {
currentStudent = students.firstWhere((e) => e.id == currentStudentId);
} catch (e) {
currentStudent = null;
}
}
final studentName = currentStudent?.name ?? '当前学生';
final questionNumber = templateIdKeyMap?[value] ?? '当前选择页';
@ -301,8 +307,12 @@ Widget $historyHomework(BuildContext context) {
int? studentId = sateData.value?.studentId;
if (kDebugMode) print(studentId);
if (studentId == null || (sateData.value?.students.isEmpty ?? true)) return;
var currentStudent = sateData.value!.students.firstWhereOrNull((e) => e.id == studentId);
if (currentStudent == null) return;
PaperStudents? currentStudent;
try {
currentStudent = sateData.value!.students.firstWhere((e) => e.id == studentId);
} catch (e) {
return;
}
var theState = Get.find<HomeworkReviewLogic>().state;
Get.toNamed(Routes.studentWorkDetailPage, arguments: {
'studentId': studentId,

View File

@ -184,8 +184,12 @@ Widget $scoringQuestionsView(
studentScoreListener() {
print(item.toJson());
item.studentScore = studentScore.value;
var theVal = sateData.studentQuestions.value?.firstWhereOrNull((e) => e.questionNo == item.questionNo);
if (theVal != null) theVal.studentScore = studentScore.value;
try {
var theVal = sateData.studentQuestions.value?.firstWhere((e) => e.questionNo == item.questionNo);
theVal?.studentScore = studentScore.value;
} catch (e) {
//
}
var studentQuestions = sateData.studentQuestions.value;
if (item.studentScore == null) return;
@ -193,17 +197,25 @@ Widget $scoringQuestionsView(
//
var annotateTime = logic.state.data.value?.annotateTime;
if (annotateTime == null) {
var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.useTime != 0 && e.studentScore == null);
if (noRatingGiven == null) logic.submit(context);
try {
studentQuestions!.firstWhere((e) => e.useTime != 0 && e.studentScore == null);
} catch (e) {
//
logic.submit(context);
}
}
}
studentScore.addListener(studentScoreListener);
var studentQuestionsStream = sateData.studentQuestions.listen((e) {
var itemVal = (e ?? []).firstWhereOrNull((e1) => e1.questionNo == item.questionNo);
if (itemVal != null && studentScore.value != itemVal.studentScore) {
studentScore.value = itemVal.studentScore;
try {
var itemVal = (e ?? []).firstWhere((e1) => e1.questionNo == item.questionNo);
if (studentScore.value != itemVal.studentScore) {
studentScore.value = itemVal.studentScore;
}
} catch (e) {
//
}
});

View File

@ -311,7 +311,7 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
timer = Timer(const Duration(milliseconds: timeoutDuration), () {
if (_activePointers > 2) {
_activePointers = 0;
if (vnHandWritings.value.last != null) {
if (vnHandWritings.value.isNotEmpty && vnHandWritings.value.last != null) {
vnHandWritings.value.add(null); // 线
sateData.handwritings = vnHandWritings.value; //
}
@ -415,10 +415,12 @@ class QuestionImageView extends HookWidget with EventBusMixin<BottomOperationBar
sateData.data.update((_) {
var theStudentQuestions = sateData.studentQuestions.value;
if (theStudentQuestions?.isNotEmpty ?? false) {
var noMarking = theStudentQuestions?.firstWhereOrNull((e) => e.studentScore == null);
if (noMarking != null) {
ToastUtils.showInfo("未提交!请为第${noMarking.questionNo}题打分,再手动提交");
try {
var noMarking = theStudentQuestions?.firstWhere((e) => e.studentScore == null);
ToastUtils.showInfo("未提交!请为第${noMarking?.questionNo}题打分,再手动提交");
return;
} catch (e) {
//
}
}
logic.submit(Get.context ?? context);

View File

@ -288,10 +288,12 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin, EventBus
var studentQuestions = state.studentQuestions.value!.where((e) => e.useTime != null && e.useTime! > 0).toList();
//
var noRatingElement = studentQuestions.firstWhereOrNull((e) => e.studentScore == null);
if (noRatingElement != null) {
try {
var noRatingElement = studentQuestions.firstWhere((e) => e.studentScore == null);
ToastUtils.showInfo('${noRatingElement.questionNo}题请评分');
return;
} catch (e) {
//
}
//

View File

@ -4,8 +4,8 @@ import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.dart';
import 'package:making_school_asignment_app/page/global_widget/MyEmptyWidget.dart';
import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/dropdown_selection.dart';
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/dropdown_selection.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/knowledge_point.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/personnel_data_overview.dart';
import 'package:making_school_asignment_app/page/home_page/children/job_report/widget/top_count.dart';
@ -64,7 +64,7 @@ class _JobReportPageState extends State<JobReportPage> {
return DropdownSelection(
involveClasses: state.involveClasses.value,
classData: state.classData.value,
call: (AnnotatedClass item) {
onClassSelected: (AnnotatedClass item) {
state.classData.value = item;
if (item.grade == -1) state.classData.value = state.defaultClass;
logic.getWorkData();
@ -75,18 +75,19 @@ class _JobReportPageState extends State<JobReportPage> {
),
),
//
TopCount(state.dataCount, state.classData == null ? '' : state.classData.value.className, state.homeworkId.value, state.subject),
TopCount(
state.dataCount, 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,
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(
@ -94,7 +95,7 @@ class _JobReportPageState extends State<JobReportPage> {
child: KnowledgePoint(
knowsList: state.knowsList,
data: state.homeData,
className: state.classData.value.className,
className: state.classData.value.className ?? '',
homeworkId: state.homeworkId.value,
subject: state.subject,
)),
@ -107,7 +108,9 @@ class _JobReportPageState extends State<JobReportPage> {
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,
@ -116,7 +119,9 @@ class _JobReportPageState extends State<JobReportPage> {
),
);
} else {
return Padding(padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 2 - 200.r), child: const MyEmptyWidget());
return Padding(
padding: EdgeInsets.only(top: MediaQuery.of(context).size.height / 2 - 200.r),
child: const MyEmptyWidget());
}
}),
);

View File

@ -7,9 +7,11 @@ import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
class DropdownSelection extends StatefulWidget {
final List<AnnotatedClass>? involveClasses;
final AnnotatedClass? classData;
final Function(AnnotatedClass) call;
final void Function(AnnotatedClass) onClassSelected;
final Color? bgColor;
const DropdownSelection({Key? key, required this.involveClasses, required this.classData, required this.call,this.bgColor}) : super(key: key);
const DropdownSelection(
{super.key, required this.involveClasses, required this.classData, required this.onClassSelected, this.bgColor});
@override
State<DropdownSelection> createState() => _DropdownSelectionState();
@ -29,18 +31,27 @@ class _DropdownSelectionState extends State<DropdownSelection> {
)),
child: DropdownButton(
value: widget.classData?.classId ?? '-1',
style: TextStyle(color: Color.fromRGBO(89, 89, 89, 1), fontSize: 12.sp),
style: TextStyle(color: const Color.fromRGBO(89, 89, 89, 1), fontSize: 12.sp),
underline: Container(),
// isExpanded:true,
items: widget.involveClasses?.map((e) {
return DropdownMenuItem(
value: e.classId!,
child: quickText(e.classId == '-1' ? '全部' : ' ${EnumUtils.formatGrade(e.grade)}${e.className}', size: 12.sp, color: Colors.black),
items: widget.involveClasses?.map((classItem) {
return DropdownMenuItem<String>(
value: classItem.classId,
child: quickText(
classItem.classId == '-1' ? '全部' : ' ${EnumUtils.formatGrade(classItem.grade)}${classItem.className}',
size: 12.sp,
color: Colors.black),
);
}).toList(),
onChanged: (value) {
if (value == null) return;
widget.call(widget.involveClasses!.firstWhere((element) => element.classId == value));
onChanged: (String? value) {
if (value == null || widget.involveClasses == null) return;
try {
final selectedClass = widget.involveClasses!.firstWhere((element) => element.classId == value);
widget.onClassSelected(selectedClass);
} catch (e) {
//
}
},
),
);

View File

@ -5,7 +5,6 @@ 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';
@ -19,7 +18,9 @@ class KnowledgePointsGraspLogic extends GetxController with RequestToolMixin, Ge
@override
void onInit() {
super.onInit();
state.subject = Get.arguments['subject'] ?? -1;
final subject = Get.arguments['subject'];
state.subject = subject == 0 ? null : subject;
state.classId = Get.arguments['classId'] ?? '';
textController = TextEditingController();
refreshController = EasyRefreshController();
@ -31,8 +32,9 @@ class KnowledgePointsGraspLogic extends GetxController with RequestToolMixin, Ge
void getList() async {
try {
ToastUtils.showLoading();
List<KnowledgePointsGrasp> data =
await getClient().getKnowledgeReport(state.dateStart, state.dateEnd, textController.text, state.classId, state.subject);
List<KnowledgePointsGrasp> data = await getClient()
.getKnowledgeReport(state.dateStart, state.dateEnd, textController.text, state.classId, state.subject);
print('data: ${data.length}');
state.dataList.value = data;
} catch (_) {
} finally {

View File

@ -13,7 +13,6 @@ class KnowledgePointsGraspState {
late String dateStart = Utils.getWeekStartDate().toString().substring(0, 10);
late String dateEnd = Utils.getWeekEndDate().toString().substring(0, 10);
late RxString customTimeStr = '自定义'.obs;
late final int subject;
late final int? subject;
late final String classId;
}

View File

@ -1,4 +1,3 @@
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';
@ -87,7 +86,8 @@ class _KnowledgePointsGraspPageState extends State<KnowledgePointsGraspPage> {
child: Container(
width: 50.r,
height: 30.r,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4.r), color: Theme.of(context).primaryColor),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r), color: Theme.of(context).primaryColor),
child: Center(
child: Text(
'查询',
@ -104,12 +104,11 @@ class _KnowledgePointsGraspPageState extends State<KnowledgePointsGraspPage> {
jobType: 1,
controller: logic.tabController,
customTimeStr: state.customTimeStr.value,
customTime: logic.tabController.index != 2 ||
((state.dateEnd == null || state.dateEnd == '') && (state.dateStart == null || state.dateStart == ''))
customTime: logic.tabController.index != 2 || ((state.dateEnd == '') && (state.dateStart == ''))
? null
: PickerDateRange(
state.dateStart == null || state.dateStart == '' ? null : DateTime.parse(state.dateStart!),
state.dateEnd == null || state.dateEnd == '' ? null : DateTime.parse(state.dateEnd!),
state.dateStart == '' ? null : DateTime.parse(state.dateStart),
state.dateEnd == '' ? null : DateTime.parse(state.dateEnd),
),
onTimeFilter: (String? startTime, String? endTime) {
EasyLoading.show(status: 'loading...');
@ -133,9 +132,11 @@ class _KnowledgePointsGraspPageState extends State<KnowledgePointsGraspPage> {
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)}';
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)}';
state.customTimeStr.value =
'${state.customTimeStr.value}~${value.endDate?.toString().substring(0, 10)}';
}
}
}
@ -180,7 +181,8 @@ class _KnowledgePointsGraspPageState extends State<KnowledgePointsGraspPage> {
child: Container(
margin: EdgeInsets.symmetric(vertical: 5.r, horizontal: 14.r),
padding: EdgeInsets.symmetric(vertical: 14.r, horizontal: 10.r),
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10.r)), color: Colors.white),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.r)), color: Colors.white),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -207,12 +209,14 @@ class _KnowledgePointsGraspPageState extends State<KnowledgePointsGraspPage> {
children: [
Text(
'${item.count}',
style: TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor),
style:
TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor),
),
SizedBox(width: 1.w),
Padding(
padding: EdgeInsets.only(top: 2.h),
child: Icon(Icons.chevron_right, size: 12.r, color: Theme.of(context).primaryColor),
child: Icon(Icons.chevron_right,
size: 12.r, color: Theme.of(context).primaryColor),
),
// Image.asset(
// 'assets/images/job_data_right_icon.png',

View File

@ -88,48 +88,18 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
),
const Spacer(),
//
Obx(() => IconButton(
onPressed: state.totalCount.value > 0 ? () => controller.getList() : null,
icon: Icon(
Icons.refresh,
size: 20.sp,
color: const Color(0xFF4F4F4F),
),
tooltip: '刷新数据',
)),
IconButton(
onPressed: () => controller.refreshController.callRefresh(),
icon: Icon(
Icons.refresh,
size: 20.sp,
color: const Color(0xFF4F4F4F),
),
tooltip: '刷新数据',
)
],
),
SizedBox(height: 20.r),
//
Container(
padding: EdgeInsets.all(16.r),
decoration: BoxDecoration(
color: const Color(0xFFF8F9FA),
borderRadius: BorderRadius.circular(12.r),
border: Border.all(color: const Color(0xFFE9ECEF), width: 1),
),
child: Row(
children: [
Expanded(
child: _buildStatCard(
'待批阅',
state.totalCount.value.toString(),
const Color(0xFFFF6969),
Icons.assignment_turned_in,
),
),
SizedBox(width: 16.r),
Expanded(
child: _buildStatCard(
'已批阅',
'0', //
const Color(0xFF28A745),
Icons.check_circle_outline,
),
),
],
),
),
SizedBox(height: 24.r),
//
_buildMenuGrid(context, state),
@ -191,7 +161,7 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
Row(
children: [
Expanded(
child: Obx(() => $menuItem(
child: Obx(() => $MenuItem(
bgImg: 'assets/images/home_bg_01.png',
name: '作业批阅',
value: state.totalCount.value > 0 ? state.totalCount.value.toString() : null,
@ -200,8 +170,8 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
)),
),
SizedBox(width: 16.r),
Expanded(
child: $menuItem(
const Expanded(
child: $MenuItem(
bgImg: 'assets/images/home_bg_02.png',
name: '知识点掌握',
url: Routes.studentHistoryWorkPage,
@ -214,8 +184,8 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
//
Row(
children: [
Expanded(
child: $menuItem(
const Expanded(
child: $MenuItem(
bgImg: 'assets/images/home_bg_03.png',
name: '学生历史作业',
url: Routes.studentHistoryWorkPage,
@ -223,8 +193,8 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
),
),
SizedBox(width: 16.r),
Expanded(
child: $menuItem(bgImg: 'assets/images/home_bg_04.png', name: '答题轨迹', url: Routes.answerTrajectoryPage),
const Expanded(
child: $MenuItem(bgImg: 'assets/images/home_bg_04.png', name: '答题轨迹', url: Routes.answerTrajectoryPage),
),
],
),
@ -232,8 +202,8 @@ class HomePage extends GetxKeepAliveWidget<HomeLogic> {
//
Row(
children: [
Expanded(
child: $menuItem(
const Expanded(
child: $MenuItem(
bgImg: 'assets/images/home_bg_05.png',
name: '优先批阅设定',
url: Routes.studentHistoryWorkPage,
@ -299,7 +269,7 @@ Widget $menuItem({
image: AssetImage(bgImg),
fit: BoxFit.cover,
colorFilter: ColorFilter.mode(
Colors.white.withOpacity(0.9),
Colors.white.withOpacity(0.8),
BlendMode.srcATop,
),
)

View File

@ -11,12 +11,12 @@ class StudentGroupList extends StatelessWidget {
final Function goNextPage;
final Widget? rightBtn;
const StudentGroupList(this.studentGroups, this.goNextPage, {Key? key, this.rightBtn}) : super(key: key);
const StudentGroupList(this.studentGroups, this.goNextPage, {super.key, this.rightBtn});
@override
Widget build(BuildContext context) {
return Obx(() {
return studentGroups != null && studentGroups.isNotEmpty
return studentGroups.isNotEmpty
? Utils.isPad()
? GridView(
shrinkWrap: true,
@ -45,12 +45,12 @@ class StudentGroupList extends StatelessWidget {
padding: EdgeInsets.only(right: 8.r),
child: Text(
'${EnumUtils.formatGrade(item.grade)}${item.className}',
style: TextStyle(fontSize: 10.sp, color:Theme.of(context).primaryColor),
style: TextStyle(fontSize: 10.sp, color: Theme.of(context).primaryColor),
),
),
Text(
EnumUtils.formatSubject(item.subject!),
style: TextStyle(fontSize: 10.sp, color: Color(0xFF8B8B8B)),
style: TextStyle(fontSize: 10.sp, color: const Color(0xFF8B8B8B)),
),
const Spacer(),
/*Expanded(
@ -114,7 +114,7 @@ class StudentGroupList extends StatelessWidget {
),
Text(
EnumUtils.formatSubject(item.subject!),
style: TextStyle(fontSize: 10.sp, color: Color(0xFF8B8B8B)),
style: TextStyle(fontSize: 10.sp, color: const Color(0xFF8B8B8B)),
),
const Spacer(),
/* Expanded(