Compare commits

..

No commits in common. "76b15038c69079efd2c94d4846fc858a07602e7c" and "25e95b44e087258a5f55b20b9217ebdb0011de15" have entirely different histories.

5 changed files with 88 additions and 134 deletions

View File

@ -10,8 +10,6 @@ class JobDoPapersStudentBus extends Object {
@JsonKey(name: 'studentName')
String studentName;
bool isFinish;
int pageIndex;
bool isFirst;
@ -21,7 +19,6 @@ class JobDoPapersStudentBus extends Object {
this.studentName,
this.pageIndex,
this.isFirst,
this.isFinish,
);
factory JobDoPapersStudentBus.fromJson(Map<String, dynamic> srcJson) => _$JobDoPapersStudentBusFromJson(srcJson);

View File

@ -90,9 +90,7 @@ class Questions extends Object {
@JsonKey(name: 'score')
double? score;
double accuracy; //
Questions(this.questionNo, this.answer, this.accuracy, [this.score]);
Questions(this.questionNo, this.answer, [this.score]);
factory Questions.fromJson(Map<String, dynamic> srcJson) => _$QuestionsFromJson(srcJson);

View File

@ -1,23 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:marking_app/routes/RouterManager.dart';
import 'package:marking_app/utils/anti_shake_throttling.dart';
//
class ReturnToHomepage extends StatelessWidget {
const ReturnToHomepage({super.key});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => easyThrottle('RETURN_TO_HOMEPAGE', () {
Navigator.of(context).popUntil(ModalRoute.withName(RouterManager.root));
}),
child: Container(
padding: EdgeInsets.only(right: 4.5.w),
alignment: Alignment.center,
child: Icon(Icons.home_rounded, size: 22.sp, color: Color.fromRGBO(135, 135, 135, 1)),
),
);
}
}

View File

@ -17,7 +17,6 @@ import 'package:marking_app/common/model/job/job_page_tab.dart';
import 'package:marking_app/common/model/job/job_review_submission.dart';
import 'package:marking_app/common/model/job/marking_text_question_job.dart';
import 'package:marking_app/common/model/job/marking_text_question_job_tab_params.dart';
import 'package:marking_app/components/ReturnToHomepage.dart';
import 'package:marking_app/pages/common/event_bus_mixin.dart';
import 'package:marking_app/pages/homework_correction/components/new_version_of_homework/bottom_annotation_switch_job.dart';
import 'package:marking_app/pages/homework_correction/eventBus/marking_text_question_job_tab_params_bus.dart';
@ -75,8 +74,14 @@ class DoPapersJob extends HookWidget with EventBusMixin<DoPapersJobRefreshBus> {
elevation: 0,
actions: [
FavoriteWidget(() => refresh = true),
SizedBox(width: 5.w),
ReturnToHomepage(),
// Container(
// padding: EdgeInsets.only(right: 4.w),
// alignment: Alignment.center,
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [Icon(Icons.lightbulb_outline, size: 12.sp), SizedBox(width: 1.w), quickText('查看原卷')],
// ),
// ),
],
),
body: SafeArea(
@ -127,7 +132,8 @@ class ReviewStatusInfo extends HookWidget with CommonMixin {
try {
ToastUtils.showLoading();
var _client = await getClient();
var _result = await _client.getJobWithStudents(JobConcernedWithStudentParams([taskId], isCommit: false, pageIndex: pageIndex));
var _result = await _client
.getJobWithStudents(JobConcernedWithStudentParams([taskId], isCommit: false, pageIndex: pageIndex));
if (_result.success) return _result.data;
} catch (e) {
ToastUtils.showError('获取数据失败,请重试');
@ -212,7 +218,8 @@ class ReviewStatusInfo extends HookWidget with CommonMixin {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText('已阅', color: Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
quickText(doMarkingInfo.value!.finishCount, color: Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.bold),
quickText(doMarkingInfo.value!.finishCount,
color: Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.bold),
quickText('/', color: Color.fromRGBO(117, 117, 117, 1), size: 12.sp),
quickText(doMarkingInfo.value!.surplusNo, color: Color.fromRGBO(117, 117, 117, 1), size: 10.sp),
],
@ -224,7 +231,8 @@ class ReviewStatusInfo extends HookWidget with CommonMixin {
//
@hwidget
Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Function() exitCallback, required int taskId, required int jobId}) {
Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context,
{required Function() exitCallback, required int taskId, required int jobId}) {
UseSwitchStudentAndType _useSwitchStudentAndType = UseSwitchStudentAndType.use(); //
// tab改变时
@ -267,18 +275,23 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
case JobDoPapersStudentBus:
var studentInfo = val as JobDoPapersStudentBus;
_useSwitchStudentAndType.studentBusInfo.value = studentInfo; //
var selectedStudent =
_useSwitchStudentAndType.studentData.value.firstWhereOrNull((element) => element.studentId == studentInfo.studentId);
var selectedStudent = _useSwitchStudentAndType.studentData.value
.firstWhereOrNull((element) => element.studentId == studentInfo.studentId);
if (selectedStudent == null) {
//
selectedStudent = JobConcernedWithStudent.fromJson(studentInfo.toJson());
_useSwitchStudentAndType.studentData.value = [..._useSwitchStudentAndType.studentData.value, selectedStudent];
_useSwitchStudentAndType.studentData.value = [
..._useSwitchStudentAndType.studentData.value,
selectedStudent
];
_useSwitchStudentAndType.getDataForStudents(taskId: taskId);
}
_useSwitchStudentAndType.currentStudent.value = selectedStudent;
_useSwitchStudentAndType.isFinish.value = studentInfo.isFinish;
print('是否是优先批阅:${studentInfo.isFirst}');
_useSwitchStudentAndType.isFirst.value = studentInfo.isFirst;
_useSwitchStudentAndType.currentTab.value = _useSwitchStudentAndType.tabs.value.firstWhere((e) => e.pageIndex == studentInfo.pageIndex);
_useSwitchStudentAndType.currentTab.value =
_useSwitchStudentAndType.tabs.value.firstWhere((e) => e.pageIndex == studentInfo.pageIndex);
print('是否是优先批阅1111${_useSwitchStudentAndType.isFirst}');
break;
case JobCheckSwitchingQuestionTabBus:
//
@ -298,8 +311,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
};
}, []);
var _currentTab = _useSwitchStudentAndType.currentTab.value;
print('加载的是否优先批阅:${_useSwitchStudentAndType.isFirst}');
return Container(
padding: EdgeInsets.only(bottom: 2.r, left: 12.r, right: 12.r),
decoration: BoxDecoration(
@ -316,7 +328,7 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
child: Row(
children: [
Expanded(
flex: 3,
flex: 7,
child: Container(
padding: EdgeInsets.only(left: 10.w),
decoration: BoxDecoration(
@ -341,14 +353,15 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
);
}).toList(),
onChanged: (value) {
_useSwitchStudentAndType.currentTab.value = _useSwitchStudentAndType.tabs.value.firstWhere((element) => element.pageIndex == value);
_useSwitchStudentAndType.currentTab.value =
_useSwitchStudentAndType.tabs.value.firstWhere((element) => element.pageIndex == value);
},
),
),
),
Expanded(flex: 1, child: SizedBox()),
Expanded(
flex: 5,
flex: 7,
child: Container(
padding: EdgeInsets.only(left: 10.w),
decoration: BoxDecoration(
@ -376,55 +389,28 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
JobConcernedWithStudent? currentStudent = _useSwitchStudentAndType.currentStudent.value;
if (currentStudent?.studentId == value) return;
_useSwitchStudentAndType.studentBusInfo.value = null; // BUS通知记录
_useSwitchStudentAndType.currentStudent.value =
_useSwitchStudentAndType.studentData.value.firstWhereOrNull((element) => element.studentId == value);
_useSwitchStudentAndType.currentStudent.value = _useSwitchStudentAndType.studentData.value
.firstWhereOrNull((element) => element.studentId == value);
},
),
),
),
Expanded(flex: 1, child: SizedBox()),
Expanded(
flex: 4,
flex: 3,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
children: [
if (_useSwitchStudentAndType.isFinish.value && _currentTab?.finishCount != _currentTab?.total)
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(Icons.flip_camera_android_outlined, size: 10.sp, color: Theme.of(context).primaryColor.withOpacity(0.8)),
SizedBox(width: 1.w),
InkWell(
onTap: () => easyThrottle(
'DO_PAPERS_JOB_CONTINUE_TO_REVIEW',
() {
var _pageIndex = _useSwitchStudentAndType.currentTab.value?.pageIndex;
if (_pageIndex == null) return;
_useSwitchStudentAndType.eventFire(model: MarkingTextQuestionJobTabParamsBus(taskId, _pageIndex));
},
),
child: quickText(
'继续批阅',
size: 10.sp,
decoration: TextDecoration.underline,
color: Theme.of(context).primaryColor.withOpacity(0.9),
),
),
SizedBox(width: 2.w),
],
),
),
Stack(
alignment: const FractionalOffset(0.52, 0.24),
children: [
Icon(
const IconData(0xe63d, fontFamily: "AlibabaIcon"),
size: 12.sp,
color: _useSwitchStudentAndType.isFirst.value ? Color.fromRGBO(76, 199, 147, 1) : Color.fromRGBO(164, 164, 164, 1),
color: _useSwitchStudentAndType.isFirst.value
? Color.fromRGBO(76, 199, 147, 1)
: Color.fromRGBO(164, 164, 164, 1),
),
quickText('优先', size: 4.sp, color: Colors.white),
],
@ -433,7 +419,9 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context, {required Func
quickText(
'优先批阅',
size: 10.sp,
color: _useSwitchStudentAndType.isFirst.value ? Color.fromRGBO(76, 199, 147, 1) : Color.fromRGBO(164, 164, 164, 1),
color: _useSwitchStudentAndType.isFirst.value
? Color.fromRGBO(76, 199, 147, 1)
: Color.fromRGBO(164, 164, 164, 1),
),
],
),
@ -547,14 +535,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
eventFire(model: JobQuestionsSwitch(jobDetails.taskId, jobDetails.studentId, jobDetails.paperId));
eventFire(
model: JobDoPapersStudentBus(
jobDetails.studentId,
jobDetails.studentName,
jobDetails.pageIndex,
jobDetails.isFirst,
jobDetails.isFinish,
),
);
model: JobDoPapersStudentBus(
jobDetails.studentId, jobDetails.studentName, jobDetails.pageIndex, jobDetails.isFirst));
}
return jobDetails;
}
@ -609,7 +591,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
return MyFutureBuilder.buildFutureBuilderOfSingleInstance<MarkingTextQuestionJob>(context, _future!, (jobData) {
List<Questions> questions = jobData?.questions ?? [];
bool canNormalPrevious = jobData != null && (jobData.prevId != 0 || jobData.previousPageIndex != null); //
bool canNormalPrevious =
jobData != null && (jobData.prevId != 0 || jobData.previousPageIndex != null); //
bool canNormalNext = jobData != null && (jobData.nextId != 0 || jobData.nextPageIndex != null); //
return Stack(
@ -647,8 +630,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
focusColor: Theme.of(context).primaryColor,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
elevation: 6.r,
onPressed: () =>
easyThrottle('TestQuestionSwitch', () => switchTestQuestions(jobData: jobData, toNextQuestion: false)),
onPressed: () => easyThrottle('TestQuestionSwitch',
() => switchTestQuestions(jobData: jobData, toNextQuestion: false)),
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
),
),
@ -662,7 +645,8 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
tooltip: '点击前往下一题',
elevation: 6.r,
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.1),
onPressed: () => easyThrottle('TestQuestionSwitch', () => switchTestQuestions(jobData: jobData)),
onPressed: () =>
easyThrottle('TestQuestionSwitch', () => switchTestQuestions(jobData: jobData)),
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
),
),
@ -707,8 +691,10 @@ class _EexamPaperAndScoringViewState extends ConsumerState<ExamPaperAndScoringVi
eventFire(model: JobCheckSwitchingQuestionTabBus(jobData.pageIndex));
},
viewHomeworkNotes: (JobReviewQuestions subJobQuestion) {
var _theBusModel =
JobNotesViewBus(taskId: jobData.taskId, paperId: jobData.paperId, questionNo: subJobQuestion.questionNo);
var _theBusModel = JobNotesViewBus(
taskId: jobData.taskId,
paperId: jobData.paperId,
questionNo: subJobQuestion.questionNo);
eventFire(model: _theBusModel);
},
scaffoldKeyPictureOverview: scaffoldKeyPictureOverview,
@ -801,34 +787,22 @@ Widget $examPaperAndScoringKeyboardView(
onTap: () => easyThrottle('view_homework_notes', () => viewHomeworkNotes(subJobQuestion)),
bgc: Color.fromRGBO(88, 87, 87, 1),
child: Container(
width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 4.w),
decoration: BoxDecoration(border: Border(bottom: BorderSide(width: 0.2.r, color: Colors.white))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(question.questionNo, size: 16.sp, color: textColor, fontWeight: FontWeight.bold),
Padding(
padding: EdgeInsets.only(bottom: 1.h),
child: quickText('', size: 11.sp, color: textColor),
),
],
),
),
if (question.accuracy > 0)
width: double.infinity,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 8.h),
decoration:
BoxDecoration(border: Border(bottom: BorderSide(width: 0.2.r, color: Colors.white))),
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
quickText(question.questionNo, size: 16.sp, color: textColor, fontWeight: FontWeight.bold),
Padding(
padding: EdgeInsets.only(bottom: 1.5.h),
child: quickText('正确率:${question.accuracy}%', size: 8.sp, color: Colors.white, align: TextAlign.end),
)
],
),
),
padding: EdgeInsets.only(bottom: 1.h),
child: quickText('', size: 11.sp, color: textColor),
),
],
)),
),
Container(
child: Row(
@ -841,7 +815,8 @@ Widget $examPaperAndScoringKeyboardView(
scoring: ScoringMethodEnum.CORRECT,
questionNo: question.questionNo,
);
var noAnswerQuestion = _useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
var noAnswerQuestion =
_useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
if (noAnswerQuestion == null) toSubmit();
},
child: Container(
@ -849,7 +824,9 @@ Widget $examPaperAndScoringKeyboardView(
alignment: Alignment.center,
child: quickText(
'',
color: subJobQuestion.score == 2 ? Color.fromRGBO(255, 152, 0, 1) : Color.fromRGBO(114, 114, 114, 1),
color: subJobQuestion.score == 2
? Color.fromRGBO(255, 152, 0, 1)
: Color.fromRGBO(114, 114, 114, 1),
fontWeight: FontWeight.bold,
size: 12.sp,
),
@ -864,7 +841,8 @@ Widget $examPaperAndScoringKeyboardView(
scoring: ScoringMethodEnum.CORRECT_HALF,
questionNo: question.questionNo,
);
var noAnswerQuestion = _useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
var noAnswerQuestion =
_useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
if (noAnswerQuestion == null) toSubmit();
},
bgc: Color.fromRGBO(237, 237, 237, 1),
@ -873,7 +851,9 @@ Widget $examPaperAndScoringKeyboardView(
alignment: Alignment.center,
child: quickText(
'',
color: subJobQuestion.score == 1 ? Color.fromRGBO(255, 152, 0, 1) : Color.fromRGBO(114, 114, 114, 1),
color: subJobQuestion.score == 1
? Color.fromRGBO(255, 152, 0, 1)
: Color.fromRGBO(114, 114, 114, 1),
fontWeight: FontWeight.bold,
size: 12.sp,
),
@ -888,7 +868,8 @@ Widget $examPaperAndScoringKeyboardView(
scoring: ScoringMethodEnum.WRONG,
questionNo: question.questionNo,
);
var noAnswerQuestion = _useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
var noAnswerQuestion =
_useDoScoring.submittedData.value.questions.firstWhereOrNull((e) => e.score == null);
if (noAnswerQuestion == null) toSubmit();
},
bgc: Color.fromRGBO(237, 237, 237, 1),
@ -897,7 +878,9 @@ Widget $examPaperAndScoringKeyboardView(
alignment: Alignment.center,
child: quickText(
'',
color: subJobQuestion.score == 0 ? Color.fromRGBO(255, 152, 0, 1) : Color.fromRGBO(114, 114, 114, 1),
color: subJobQuestion.score == 0
? Color.fromRGBO(255, 152, 0, 1)
: Color.fromRGBO(114, 114, 114, 1),
fontWeight: FontWeight.bold,
size: 12.sp,
),
@ -1004,7 +987,8 @@ Widget $examPaperAndScoringKeyboardView(
bgc: Colors.white,
splashColor: Theme.of(context).primaryColor.withOpacity(0.8),
borderRadius: BorderRadius.circular(2.r),
onTap: () => easyThrottle('homework_review_submission_main_callback', () => toSubmit(), duration: Duration(seconds: 1)),
onTap: () => easyThrottle('homework_review_submission_main_callback', () => toSubmit(),
duration: Duration(seconds: 1)),
child: Container(
width: double.infinity,
alignment: Alignment.center,
@ -1027,7 +1011,8 @@ Widget $examPaperAndScoringKeyboardView(
}
@swidget
Widget $materialBtn({required Widget child, Color? bgc, Color? splashColor, GestureTapCallback? onTap, BorderRadius? borderRadius}) {
Widget $materialBtn(
{required Widget child, Color? bgc, Color? splashColor, GestureTapCallback? onTap, BorderRadius? borderRadius}) {
return Material(
color: bgc,
borderRadius: borderRadius,

View File

@ -15,8 +15,6 @@ import 'package:marking_app/utils/request/rest_client.dart';
class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
ValueNotifier<bool> exitPromptFlag; // 退
ValueNotifier<bool> isFirst;
ValueNotifier<bool> isFinish;
ValueNotifier<List<JobConcernedWithStudent>> studentData; //
ValueNotifier<List<JobPageTab>> tabs; //
@ -38,7 +36,6 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
required this.studentBusInfo,
required this.exitPromptFlag,
required this.isFirst,
required this.isFinish,
});
//
@ -63,7 +60,6 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
studentBusInfo: theStudentBus,
exitPromptFlag: useState<bool>(false),
isFirst: useState<bool>(false),
isFinish: useState<bool>(false),
);
}
@ -99,7 +95,8 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
}
/// tab类型数据
Future<JobPageTab?> refreshQuestionTypeData(BuildContext context, {required int taskId, required Function() exitCallback}) async {
Future<JobPageTab?> refreshQuestionTypeData(BuildContext context,
{required int taskId, required Function() exitCallback}) async {
List<JobPageTab>? tabDatas = await getDataForTestpaper(taskId: taskId, synchronization: false);
if (tabDatas?.isNotEmpty ?? false) {
JobPageTab? tabJob = tabDatas!.firstWhereOrNull((e) => e.finishCount < e.total);