From 0ea085de97f106de99ec0b97e5f7ee3c1fd68304 Mon Sep 17 00:00:00 2001 From: "1147192855@qq.com" <1147192855@qq.com> Date: Wed, 3 Jul 2024 12:02:36 +0800 Subject: [PATCH] no message --- making_school_asignment_app/lib/main.dart | 3 + .../lib/page/global_widget/start_page.dart | 3 +- .../components/bottom_operation_bar.dart | 4 +- .../dropdown_switch_students_type.dart | 79 ++++++++++++++----- .../components/job_handwriting.dart | 1 - .../components/question_paper_view.dart | 27 +++++-- .../student_personal_view.dart | 62 ++++----------- 7 files changed, 101 insertions(+), 78 deletions(-) diff --git a/making_school_asignment_app/lib/main.dart b/making_school_asignment_app/lib/main.dart index 477f302..de556cc 100644 --- a/making_school_asignment_app/lib/main.dart +++ b/making_school_asignment_app/lib/main.dart @@ -10,6 +10,7 @@ import 'package:making_school_asignment_app/common/utils/storage.dart'; import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'common/utils/app_upgrade/upgradeLogic.dart'; @@ -31,6 +32,8 @@ void main() async { SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); // 屏幕刘海 await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); // 屏幕强制竖屏 runApp(const MyApp()); + + Permission.storage.request(); } class MyApp extends StatelessWidget { diff --git a/making_school_asignment_app/lib/page/global_widget/start_page.dart b/making_school_asignment_app/lib/page/global_widget/start_page.dart index f978920..047f15b 100644 --- a/making_school_asignment_app/lib/page/global_widget/start_page.dart +++ b/making_school_asignment_app/lib/page/global_widget/start_page.dart @@ -40,9 +40,8 @@ class _StartPageState extends State with RequestToolMixin { Get.put(WorkLogic()); _bodyList = [const HomePage(), const WorkPage(), const MyInfo()]; - // TODO 启动APP 后直接请求更新 + // APP 启动后就直接更新 if (!_upgradeLogic.showUpgrade.value) _upgradeLogic.getAppUpgrade(context); - _timer?.cancel(); _timer = Timer.periodic(const Duration(seconds: 40), (e) { if (Get.currentRoute == Routes.login) return; // 在登录页面不更新APP diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart index b021c3f..ae55890 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/bottom_operation_bar.dart @@ -200,7 +200,7 @@ class _BottomAnnotationSwitchJobState extends State with height: double.infinity, child: TextButton( onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.cancelAllRatings()), - child: quickText('取 消', size: 12.sp, color: Colors.white), + child: quickText('取 消', size: 14.sp, color: Colors.white), ), ), ), @@ -211,7 +211,7 @@ class _BottomAnnotationSwitchJobState extends State with height: double.infinity, child: TextButton( onPressed: () => easyThrottle('homework_bottom_operation_bar_scoring_related', () => _homeworkLogic.submit(context)), - child: quickText('提 交', size: 12.sp, color: const Color.fromRGBO(76, 199, 147, 1)), + child: quickText('提 交', size: 14.sp, color: const Color.fromRGBO(76, 199, 147, 1)), ), ), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart index a1dadc1..f0fe943 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/dropdown_switch_students_type.dart @@ -5,9 +5,13 @@ 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/utils/anti_shake_throttling.dart'; +import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/page/global_widget/my_text.dart'; import 'package:making_school_asignment_app/page/home_page/children/homework_review/configuration_files/index.dart'; +import 'package:making_school_asignment_app/routes/app_pages.dart'; + +import 'original_manuscript_handwriting/answer_handwriting_view.dart'; part 'dropdown_switch_students_type.g.dart'; @@ -41,7 +45,7 @@ class _DropdownSwitchStudentsTypeState extends State child: Row( children: [ Expanded( - flex: 3, + flex: 2, child: Container( padding: EdgeInsets.only(left: 10.w), decoration: BoxDecoration( @@ -54,7 +58,7 @@ class _DropdownSwitchStudentsTypeState extends State underline: Container(), padding: EdgeInsets.only(right: 4.w), icon: const Icon(Icons.keyboard_arrow_down_rounded), - value: sateData.value?.templateId, // TODO 数据 + value: sateData.value?.templateId, hint: const Text('请选择作业页码'), // 锚点的显示文本 items: sateData.value?.templateIdKeys?.map((e) { return DropdownMenuItem( @@ -74,7 +78,7 @@ class _DropdownSwitchStudentsTypeState extends State ), const Expanded(flex: 1, child: SizedBox()), Expanded( - flex: 4, + flex: 3, child: Stack( children: [ Container( @@ -90,9 +94,6 @@ class _DropdownSwitchStudentsTypeState extends State value: sateData.value?.studentId, underline: Container(), isExpanded: true, - onTap: () { - print('数据..................'); - }, items: sateData.value?.students.map((e) { return DropdownMenuItem( value: e.id, @@ -125,7 +126,6 @@ class _DropdownSwitchStudentsTypeState extends State }).toList(), hint: const Text('请选择学生'), // 锚点的显示文本 onChanged: (value) { - print('1111111111'); if (logic.state.param.value.studentId == value) return; logic.state.param.value.studentId = value; logic.state.param.value = DoPaperDetailsParam.fromJson(logic.state.param.value.toJson()); @@ -152,15 +152,17 @@ class _DropdownSwitchStudentsTypeState extends State ], ), ), - const Expanded(flex: 1, child: SizedBox()), + // const Expanded(flex: 1, child: SizedBox()), + SizedBox(width: 8.w), Expanded( flex: isPad() ? 4 : 5, child: const Row( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ $ContinueToReview(), // 继续批阅 - $HistoryHomework() // 学生历史作业 + $HistoryHomework(), // 学生历史作业 + $StudentHandwriting(), // 学生笔迹 ], ), ), @@ -170,6 +172,42 @@ class _DropdownSwitchStudentsTypeState extends State } } +@swidget +Widget $studentHandwriting(BuildContext context) { + final logic = Get.find(); + final sateData = Get.find().state.data; + return InkWell( + onTap: () => easyThrottle( + 'SHOW_ANSWER_HANDWRITING', + () async { + var homeworkId = logic.state.param.value.homeworkId; + var studentId = sateData.value?.studentId; + if (studentId == null) return; + var templateIdKeyMap = sateData.value?.templateIdKeyMap; + int? pageNum; + var templateId = sateData.value?.templateId; + if (templateIdKeyMap != null && templateId != null) { + pageNum = templateIdKeyMap[templateId]; + } + await showAnswerHandwriting(context, homeworkId: homeworkId, studentId: studentId, templateId: templateId, pageNum: pageNum); + ToastUtils.dismiss(); + }, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.edit_outlined, size: 12.sp, color: Theme.of(context).primaryColor.withOpacity(0.8)), + SizedBox(width: 1.w), + quickText( + '学生笔迹', + size: 12.sp, + decoration: TextDecoration.underline, + color: Theme.of(context).primaryColor.withOpacity(0.9), + ), + ], + )); +} + @swidget Widget $continueToReview(BuildContext context, {bool isFloatingAction = false}) { final logic = Get.find(); @@ -199,7 +237,7 @@ Widget $continueToReview(BuildContext context, {bool isFloatingAction = false}) child: Icon(Icons.flip_camera_android_outlined, size: 20.sp, color: Theme.of(context).primaryColor), ); } - return Expanded( + return SizedBox( child: InkWell( onTap: callFun, child: Row( @@ -210,7 +248,7 @@ Widget $continueToReview(BuildContext context, {bool isFloatingAction = false}) SizedBox(width: 1.w), quickText( '继续批阅', - size: 10.sp, + size: 12.sp, decoration: TextDecoration.underline, color: Theme.of(context).primaryColor.withOpacity(0.9), ), @@ -225,26 +263,25 @@ Widget $continueToReview(BuildContext context, {bool isFloatingAction = false}) @swidget Widget $historyHomework(BuildContext context) { final sateData = Get.find().state.data; - return Expanded( + return SizedBox( child: InkWell( onTap: () => easyThrottle('DO_PAPERS_JOB_HISTORICAL_HOMEWORK', () { - // TODO 学生历史作业页面跳转 int? studentId = sateData.value?.studentId; if (kDebugMode) print(studentId); - // JobConcernedWithStudent? _studentModel = _useSwitchStudentAndType.currentStudent.value; - // if (_studentModel == null) return; - // String url = - // '${RouterManager.jobPersonalDetailPath}?studentId=${_studentModel.studentId}&studentName=${Uri.encodeComponent(_studentModel.studentName)}'; - // RouterManager.router.navigateTo(context, url, transition: getTransition()); + if (studentId == null || (sateData.value?.students.isEmpty ?? true)) return; + var currentStudent = sateData.value!.students.firstWhereOrNull((e) => e.id == studentId); + if (currentStudent == null) return; + Get.toNamed(Routes.studentWorkDetailPage, arguments: {'studentId': studentId, 'studentName': currentStudent.name}); }), child: Row( - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, children: [ Icon(Icons.location_history, size: 12.sp, color: const Color.fromRGBO(104, 103, 103, 1)), SizedBox(width: 1.w), quickText( '历史作业', - size: 10.sp, + size: 12.sp, decoration: TextDecoration.underline, color: Theme.of(context).primaryColor.withOpacity(0.8), ), diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/job_handwriting.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/job_handwriting.dart index 698dd58..2cdf7d9 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/job_handwriting.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/job_handwriting.dart @@ -1,5 +1,4 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:making_school_asignment_app/common/config/request_config.dart'; part 'job_handwriting.g.dart'; diff --git a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart index 630f67a..9ccc15c 100644 --- a/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/homework_review/components/question_paper_view.dart @@ -102,7 +102,7 @@ class _QuestionPaperViewState extends State { }), ), // 试题题号视图 - Expanded(flex: 2, child: $QuestionNumberView(sateData)), + Expanded(flex: 2, child: $QuestionNumberView(logic, sateData)), ], ), Obx(() { @@ -209,7 +209,10 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.end, children: [ - quickText('已阅', color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp), + Padding( + padding: EdgeInsets.only(bottom: 1.h), + child: quickText('已阅', color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp), + ), quickText(data.annotatedCount, color: const Color.fromRGBO(76, 199, 147, 1), size: 12.sp, fontWeight: FontWeight.bold), quickText('/', color: const Color.fromRGBO(117, 117, 117, 1), size: 12.sp), quickText(data.submitCount - data.annotatedCount, color: const Color.fromRGBO(117, 117, 117, 1), size: 10.sp), @@ -222,7 +225,7 @@ Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) // 试题题号视图 @hwidget -Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) { +Widget $questionNumberView(BuildContext context, HomeworkReviewLogic logic, HomeworkReviewState sateData) { final scrollControllerNum = useScrollController(); // 试题题号区域 useEffect(() { @@ -271,7 +274,12 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) { padding: EdgeInsets.only(top: imageVal.remainingHeight > 0 ? imageVal.remainingHeight / 2 : 0), child: Column( mainAxisAlignment: MainAxisAlignment.start, - children: studentQuestions?.asMap().keys.map((e) => $ScoringQuestionsView(studentQuestions[e], imageVal.scaleRatio)).toList() ?? [], + children: studentQuestions + ?.asMap() + .keys + .map((e) => $ScoringQuestionsView(logic, studentQuestions[e], imageVal.scaleRatio, studentQuestions)) + .toList() ?? + [], ), ); }), @@ -281,11 +289,19 @@ Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) { // 单道题得分框 @hwidget -Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double scaleRatio) { +Widget $scoringQuestionsView( + BuildContext context, HomeworkReviewLogic logic, StudentQuestions item, double scaleRatio, List? studentQuestions) { var studentScore = useState(item.studentScore); useValueChanged(studentScore.value, (_, __) { item.studentScore = studentScore.value; + + // 校验是否自动提交 对于已经批阅过的试题 不重复自动提交 + var annotateTime = logic.state.data.value?.annotateTime; + if (annotateTime == null) { + var noRatingGiven = studentQuestions!.firstWhereOrNull((e) => e.studentScore == null); + if (noRatingGiven == null) logic.submit(context); + } }); useValueChanged(item, (_, __) { @@ -295,6 +311,7 @@ Widget $scoringQuestionsView(BuildContext context, StudentQuestions item, double useEffect(() { return () {}; }, []); + var padinVal = item.correctRate > 0 ? EdgeInsets.only(top: 6.4.h) : EdgeInsets.symmetric(vertical: 2.h); return Container( height: item.height * scaleRatio, diff --git a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart index f6d9168..471f529 100644 --- a/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart +++ b/making_school_asignment_app/lib/page/home_page/children/student_personal/student_personal_view.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:making_school_asignment_app/common/utils/toast_utils.dart'; -import 'package:making_school_asignment_app/common/utils/utils.dart'; import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart'; import 'package:making_school_asignment_app/page/home_page/children/homework_review/components/original_manuscript_handwriting/answer_handwriting_view.dart'; import 'package:making_school_asignment_app/page/home_page/children/student_personal/widget/student_kg_table.dart'; @@ -24,8 +23,7 @@ class _StudentPersonalPageState extends State { @override Widget build(BuildContext context) { - return OrientationBuilder( - builder: (BuildContext context, Orientation orientation) { + return OrientationBuilder(builder: (BuildContext context, Orientation orientation) { return Scaffold( backgroundColor: const Color.fromRGBO(245, 245, 245, 1), appBar: AppBar( @@ -56,10 +54,8 @@ class _StudentPersonalPageState extends State { onTap: () { // RouterManager.router.navigateTo(context, // '${RouterManager.jobPersonalDetailPath}?studentId=${widget.studentId}&studentName=${Uri.encodeComponent(state.studentInfo.studentName!)}'); - Get.toNamed(Routes.studentWorkDetailPage, arguments: { - 'studentId': state.studentInfo.value.studentId, - 'studentName': state.studentInfo.value.studentName - }); + Get.toNamed(Routes.studentWorkDetailPage, + arguments: {'studentId': state.studentInfo.value.studentId, 'studentName': state.studentInfo.value.studentName}); }, child: Container( width: 93.r, @@ -71,8 +67,7 @@ class _StudentPersonalPageState extends State { child: Center( child: Text( '历史作业', - style: TextStyle( - fontSize: 10.r, color: const Color(0xFF2080F7)), + style: TextStyle(fontSize: 10.r, color: const Color(0xFF2080F7)), ), ), ), @@ -81,10 +76,8 @@ class _StudentPersonalPageState extends State { width: 10.r, ), InkWell( - onTap: () => showAnswerHandwriting(context, - homeworkId: state.homeworkId, - studentId: state.studentId) - .then((e) => ToastUtils.dismiss()), + onTap: () => + showAnswerHandwriting(context, homeworkId: state.homeworkId, studentId: state.studentId).then((e) => ToastUtils.dismiss()), child: Container( width: 93.r, height: 28.r, @@ -95,8 +88,7 @@ class _StudentPersonalPageState extends State { child: Center( child: Text( '原稿笔迹', - style: TextStyle( - fontSize: 10.r, color: const Color(0xFF4CC793)), + style: TextStyle(fontSize: 10.r, color: const Color(0xFF4CC793)), ), ), ), @@ -120,10 +112,7 @@ class _StudentPersonalPageState extends State { children: [ Text( '客观题', - style: TextStyle( - fontSize: 14.sp, - color: const Color(0xFF5C5C5C), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF5C5C5C), fontWeight: FontWeight.w600), ), SizedBox( width: 10.r, @@ -131,10 +120,7 @@ class _StudentPersonalPageState extends State { Obx(() { return Text( '${state.studentInfo.value.kgtCorrectRate}%', - style: TextStyle( - fontSize: 14.sp, - color: const Color(0xFF4CC793), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF4CC793), fontWeight: FontWeight.w600), ); }), ], @@ -144,19 +130,13 @@ class _StudentPersonalPageState extends State { ), Obx(() { return SizedBox( - height: state.studentInfo.value.kgtList.length > 8 - ? 300.r - : state.studentInfo.value.kgtList.length * 40.r + - 40.r, + height: state.studentInfo.value.kgtList.length > 8 ? 300.r : state.studentInfo.value.kgtList.length * 40.r + 40.r, child: StudentKgTable( headList: const ['题号', '学生答案', '标准答案'], bodyList: state.studentInfo.value.kgtList, questionNumCall: (questionNo, templateId) { showAnswerHandwriting(context, - homeworkId: state.homeworkId, - studentId: state.studentId, - questionNo: questionNo, - templateId: templateId) + homeworkId: state.homeworkId, studentId: state.studentId, questionNo: questionNo, templateId: templateId) .then((e) => ToastUtils.dismiss()); // showAnswerHandwriting(context, jobId: widget.jobId, studentId: widget.studentId, questionNo: int.parse(no)).then((value) { // ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).setVal([]); @@ -187,10 +167,7 @@ class _StudentPersonalPageState extends State { children: [ Text( '主观题', - style: TextStyle( - fontSize: 14.sp, - color: const Color(0xFF5C5C5C), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF5C5C5C), fontWeight: FontWeight.w600), ), SizedBox( width: 10.r, @@ -198,10 +175,7 @@ class _StudentPersonalPageState extends State { Obx(() { return Text( '${state.studentInfo.value.zgtCorrectRate}%', - style: TextStyle( - fontSize: 14.sp, - color: const Color(0xFF4CC793), - fontWeight: FontWeight.w600), + style: TextStyle(fontSize: 14.sp, color: const Color(0xFF4CC793), fontWeight: FontWeight.w600), ); }), ], @@ -211,10 +185,7 @@ class _StudentPersonalPageState extends State { ), Obx(() { return SizedBox( - height: state.studentInfo.value.zgtList.length > 8 - ? 300.r - : state.studentInfo.value.zgtList.length * 40.r + - 40.r, + height: state.studentInfo.value.zgtList.length > 8 ? 300.r : state.studentInfo.value.zgtList.length * 40.r + 40.r, child: StudentZgTable( headList: const ['题号', '用时', '批注结果', '答案'], bodyList: state.studentInfo.value.zgtList, @@ -223,10 +194,7 @@ class _StudentPersonalPageState extends State { ref.read(jobHandwritingDrawingTrajectoryProvider.notifier).setVal([]); });*/ showAnswerHandwriting(context, - homeworkId: state.homeworkId, - studentId: state.studentId, - questionNo: questionNo, - templateId: templateId) + homeworkId: state.homeworkId, studentId: state.studentId, questionNo: questionNo, templateId: templateId) .then((e) => ToastUtils.dismiss()); }, ),