处理问题

This commit is contained in:
1147192855@qq.com 2024-03-05 13:52:54 +08:00
parent ef069121f1
commit ea250d0c62
9 changed files with 204 additions and 45 deletions

1
.gitignore vendored
View File

@ -199,3 +199,4 @@ 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
marking_app/lib/common/model/job/job_do_marking_status_info.g.dart
marking_app/lib/common/model/report/small_question.g.dart

View File

@ -327,8 +327,7 @@ class TestPaperItem extends ConsumerWidget with CommonMixin {
),
),
onPressed: () {
goToReviewHomework(markingItem: markingItem, ref: ref, context: context, call: () => call!());
// goToReviewHomework(markingItem: markingItem, ref: ref, context: context);
// goToReviewHomework(markingItem: markingItem, ref: ref, context: context, call: () => call!());
},
child: Text(
'已完成',
@ -460,8 +459,9 @@ class TestPaperItem extends ConsumerWidget with CommonMixin {
).show(context);
}
isHomeworkCorrection
? goToReviewHomework(
markingItem: markingItem, ref: ref, context: context, call: () => call!())
// ? goToReviewHomework(
// markingItem: markingItem, ref: ref, context: context, call: () => call!())
? () => {}
: goToReviewTestPaper(
markingtype: markingtype!,
markingItem: markingItem,
@ -512,22 +512,22 @@ class TestPaperItem extends ConsumerWidget with CommonMixin {
}
//
Future<void> goToReviewHomework({
required MarkingItem markingItem,
required WidgetRef ref,
required BuildContext context,
required VoidCallback call,
}) async {
int taskId = markingItem.markingUserId;
toPrint(val: '批阅作业.........');
// ref.read(currentTaskIdProvider.notifier).setDoTaskEntity(CurrentReviewTask(taskId: taskId));
// DetailId DetailIdPageOper(012) 2 IsReview 0 1
RouterManager.router
.navigateTo(context, '${RouterManager.markingHomeworkDoPath}?taskId=$taskId', transition: getTransition())
.then((value) {
call();
});
}
// Future<void> goToReviewHomework({
// required MarkingItem markingItem,
// required WidgetRef ref,
// required BuildContext context,
// required VoidCallback call,
// }) async {
// int taskId = markingItem.markingUserId;
// toPrint(val: '批阅作业.........');
// // ref.read(currentTaskIdProvider.notifier).setDoTaskEntity(CurrentReviewTask(taskId: taskId));
// // DetailId DetailIdPageOper(012) 2 IsReview 0 1
// RouterManager.router
// .navigateTo(context, '${RouterManager.markingHomeworkDoPath}?taskId=$taskId', transition: getTransition())
// .then((value) {
// call();
// });
// }
//
Future<void> goToReviewTestPaper({

View File

@ -451,6 +451,18 @@ class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing> with EventB
int activePointers = 0;
///
int _findTargetIndex<T>(List<T> list, T target, [int reciprocal = 2]) {
List<int> indexs = [];
for (int i = list.length - 1; i >= 0; i--) {
if (list[i] == target) {
indexs.add(i);
if (indexs.length == reciprocal) return i;
}
}
return -1;
}
@override
void initState() {
points = widget.points ?? [];
@ -464,22 +476,29 @@ class _ExamPaperDrawingState extends ConsumerState<ExamPaperDrawing> with EventB
if (points.isEmpty) {
return ToastUtils.getFluttertoast(context: context, msg: '已经没有批注了', gravity: ToastGravity.BOTTOM);
}
var index = pointsPureData.toList().lastIndexOf(null);
// var index = pointsPureData.toList().lastIndexOf(null);
var index = _findTargetIndex(pointsPureData, null);
if (index != -1) {
if (index + 1 == pointsPureData.length) {
pointsPureData = pointsPureData.sublist(0, index);
points.sublist(0, index);
index = pointsPureData.toList().lastIndexOf(null);
index == -1 ? -1 : index + 1;
}
if (index != -1) {
pointsPureData = pointsPureData.sublist(0, index);
points = points.sublist(0, index);
ref.read(jobHomeWorkProvider.notifier).setVal(points);
// toUpState(setState, () {}, mounted);
} else {
item.cleanAll = true;
}
pointsPureData = pointsPureData.sublist(0, index + 1);
points = points.sublist(0, index + 1);
ref.read(jobHomeWorkProvider.notifier).setVal(points);
toUpState(setState, () {}, mounted);
// var _nullVal = points[index]; //
// if (index + 1 == pointsPureData.length) {
// pointsPureData = pointsPureData.sublist(0, index);
// points.sublist(0, index);
// index = pointsPureData.toList().lastIndexOf(null);
// index == -1 ? -1 : index + 1;
// }
// if (index != -1) {
// pointsPureData = pointsPureData.sublist(0, index);
// points = points.sublist(0, index);
// ref.read(jobHomeWorkProvider.notifier).setVal(points..add(_nullVal));
// // toUpState(setState, () {}, mounted);
// } else {
// item.cleanAll = true;
// }
} else {
item.cleanAll = true;
}

View File

@ -792,7 +792,7 @@ Widget $unfinishedBtn(
return;
}
String url =
'${RouterManager.markingHomeworkDoPath}?taskId=${markingTask.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + markingTask.className)}';
'${RouterManager.markingHomeworkDoPath}?taskId=${markingTask.id}&jobId=${jobTaskItem.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + markingTask.className)}';
RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value != null && value == true) refreshcall();
});
@ -977,7 +977,7 @@ Widget $unfinishedBtn(
}
String url =
'${RouterManager.markingHomeworkDoPath}?taskId=${jobTaskClassItem.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + jobTaskClassItem.className)}';
'${RouterManager.markingHomeworkDoPath}?taskId=${jobTaskClassItem.id}&jobId=${jobTaskItem.id}&taskName=${Uri.encodeComponent(jobTaskItem.title)}&className=${Uri.encodeComponent(jobTaskItem.genderName + jobTaskClassItem.className)}';
RouterManager.router.navigateTo(context, url, transition: getTransition()).then((value) {
if (value == true) refreshcall();
});

View File

@ -44,9 +44,10 @@ part 'do_papers_job.g.dart';
//
class DoPapersJob extends HookWidget with EventBusMixin<DoPapersJobRefreshBus> {
final int taskId; // ID
final int jobId;
final String taskName;
final String className; // ID
DoPapersJob({required this.taskId, required this.taskName, required this.className, super.key});
DoPapersJob({required this.taskId, required this.jobId, required this.taskName, required this.className, super.key});
bool refresh = false;
@override
@ -88,6 +89,7 @@ class DoPapersJob extends HookWidget with EventBusMixin<DoPapersJobRefreshBus> {
//
$DropdownBoxSwitchStudentsOrTypeView(
taskId: taskId,
jobId: jobId,
exitCallback: () => Navigator.of(context).pop(refresh),
),
SizedBox(height: 1.h),
@ -142,7 +144,7 @@ class ReviewStatusInfo extends HookWidget with CommonMixin {
//
@hwidget
Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context,
{required Function() exitCallback, required int taskId}) {
{required Function() exitCallback, required int taskId, required int jobId}) {
UseSwitchStudentAndType _useSwitchStudentAndType = UseSwitchStudentAndType.use(); //
// tab改变时
@ -335,6 +337,41 @@ Widget $dropdownBoxSwitchStudentsOrTypeView(BuildContext context,
),
],
),
// InkWell(
// onTap: () => easyThrottle(
// 'prioritize_homework_review',
// () => !_useSwitchStudentAndType.isFirst.value
// ? _useSwitchStudentAndType.jobPriorityReviewJoin(jobId)
// : _useSwitchStudentAndType.jobPriorityReviewCancel(jobId)),
// child:
// Row(
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// 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),
// ),
// quickText('优先', size: 4.sp, color: Colors.white),
// ],
// ),
// SizedBox(width: 1.2.w),
// quickText(
// '优先批阅',
// size: 10.sp,
// color: _useSwitchStudentAndType.isFirst.value
// ? Color.fromRGBO(76, 199, 147, 1)
// : Color.fromRGBO(164, 164, 164, 1),
// ),
// ],
// ),
// ),
),
],
),
@ -658,9 +695,8 @@ Widget $examPaperAndScoringKeyboardView(
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)),
),
decoration:
BoxDecoration(border: Border(bottom: BorderSide(width: 0.2.r, color: Colors.white))),
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
@ -762,7 +798,7 @@ Widget $examPaperAndScoringKeyboardView(
borderRadius: BorderRadius.circular(2.r),
onTap: () => easyThrottle('homework_review_submission_callback', () {
_useDoScoring.goToScoringShortcut(enumMode: ToScoringShortcut.ALL_PAIRS);
// toSubmit();
toSubmit();
}, duration: Duration(milliseconds: 500)),
child: Container(
width: double.infinity,
@ -786,7 +822,7 @@ Widget $examPaperAndScoringKeyboardView(
borderRadius: BorderRadius.circular(2.r),
onTap: () => easyThrottle('homework_review_submission_callback', () {
_useDoScoring.goToScoringShortcut(enumMode: ToScoringShortcut.ALL_WRONG);
// toSubmit();
toSubmit();
}, duration: Duration(milliseconds: 500)),
child: Container(
width: double.infinity,

View File

@ -0,0 +1,56 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:marking_app/utils/my_text.dart';
///
class DoPapersJobExam extends StatefulHookWidget {
final int taskId; // ID
final int jobId;
final String taskName;
final String className; // ID
const DoPapersJobExam(
{required this.taskId, required this.jobId, required this.taskName, required this.className, super.key});
@override
State<DoPapersJobExam> createState() => _DoPapersJobExamState();
}
class _DoPapersJobExamState extends State<DoPapersJobExam> {
bool refresh = false; //
@override
void initState() {
super.initState();
Future.delayed(Duration.zero, () {
SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
});
}
@override
void dispose() {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); //
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// titleSpacing: 0,
leading: IconButton(icon: Icon(Icons.arrow_back_ios), onPressed: () => Navigator.of(context).pop(refresh)),
iconTheme: IconThemeData(color: Colors.black),
title: quickText(widget.taskName + '(${widget.className})'),
backgroundColor: Colors.white,
elevation: 0,
// actions: [
// FavoriteWidget(),
// ],
),
body: Container(),
);
}
}

View File

@ -172,6 +172,28 @@ class UseSwitchStudentAndType with CommonMixin, EventBusMixin {
if (indexLocated == null) return null;
return indexLocated == 0 ? null : tabs.value[indexLocated - 1].pageIndex;
}
/// ==>
Future<void> jobPriorityReviewCancel(int jobId) async {
RestClient _client = await getClient();
var studentId = currentStudent.value?.studentId;
if (studentId == null) return ToastUtils.showInfo('无法获取到学生ID请重试');
BaseStructureResult result = await _client.jobPriorityReviewCancel(jobId, studentId);
if (result.success) {
isFirst.value = !isFirst.value;
}
}
/// ==>
Future<void> jobPriorityReviewJoin(int jobId) async {
RestClient _client = await getClient();
var studentId = currentStudent.value?.studentId;
if (studentId == null) return ToastUtils.showInfo('无法获取到学生ID请重试');
BaseStructureResult result = await _client.jobPriorityReviewJoin(jobId, studentId);
if (result.success) {
isFirst.value = !isFirst.value;
}
}
}
class ExamStatus extends Object {

View File

@ -13,6 +13,7 @@ import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:marking_app/common/model/enum/marking_list_type.dart';
import 'package:marking_app/pages/common/startUpPage.dart';
import 'package:marking_app/pages/homework_correction/do_papers_job_exam.dart';
import 'package:marking_app/pages/homework_correction/job_report.dart';
import 'package:marking_app/pages/homework_correction/review_job.dart';
@ -50,6 +51,8 @@ class RouterManager {
//
static const String jobReportPagePath = '/job/report/index';
// ==>
static const String jobExamPagePath = '/job/exam/index';
static const String reportClassTeacherPath = 'report/details/reportClassTeacher';
static const String reportSubjectTeacherPath = 'report/details/reportSubjectTeacher';
@ -158,9 +161,10 @@ class RouterManager {
Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
try {
int taskId = int.parse(params['taskId']![0]);
int jobId = int.parse(params['jobId']![0]);
String taskName = params['taskName']![0];
String className = params['className']![0];
return DoPapersHomework.DoPapersJob(taskId: taskId, taskName: taskName, className: className);
return DoPapersHomework.DoPapersJob(taskId: taskId, jobId: jobId, taskName: taskName, className: className);
} catch (e) {
toPrint(val: '进入跳转报错啦,$e');
}
@ -171,6 +175,16 @@ class RouterManager {
String title = params['title']![0];
return JobReport(id: id, title: title);
});
//
static final _jobExamPageHandler = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
int taskId = int.parse(params['taskId']![0]);
int jobId = int.parse(params['JobId']![0]);
String taskName = params['taskName']![0];
String className = params['className']![0];
return DoPapersJobExam(taskId: taskId, jobId: jobId, taskName: taskName, className: className);
});
static final _agreementPageHandler = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
AGREEMENT_KEY key = AGREEMENT_KEY.values.byName(params['type']![0]);
return AgreementPage(type: key);
@ -258,6 +272,7 @@ class RouterManager {
router.define(userMinePath, handler: _userMinePageHandler, transitionType: TransitionType.material);
router.define(reportDetailPath, handler: _reportDetailPath, transitionType: TransitionType.material);
router.define(jobReportPagePath, handler: _jobReportPageHandler, transitionType: TransitionType.material);
router.define(jobExamPagePath, handler: _jobExamPageHandler, transitionType: TransitionType.material);
// getTransition()

View File

@ -245,6 +245,16 @@ abstract class RestClient {
Future<BaseStructureResult<bool>> getJobCollect(
@the_retrofit.Query("taskId") int taskId, @the_retrofit.Query("studentId") int studentId);
// =>
@the_retrofit.POST("/api/read/cancel-job-read-level")
Future<BaseStructureResult<bool>> jobPriorityReviewCancel(
@the_retrofit.Field("jobId") int jobId, @the_retrofit.Field("studentId") int studentId);
// =>
@the_retrofit.POST("/api/read/join-read-level")
Future<BaseStructureResult> jobPriorityReviewJoin(
@the_retrofit.Field("jobId") int jobId, @the_retrofit.Field("studentId") int studentId);
// =>
@the_retrofit.POST("${RequestConfig.hwProxyKeywords}/api/Dpc/collect")
Future<BaseStructureResult<bool>> toJobFavoriteCancel(@the_retrofit.Body() JobCollectParams params);