no message
This commit is contained in:
parent
63658cf6e1
commit
47eb2ad17c
|
|
@ -18,7 +18,7 @@ class DoPaperDetailsResult extends Object {
|
|||
@JsonKey(name: 'templateIdKeyMap')
|
||||
Map<int, int>? templateIdKeyMap;
|
||||
|
||||
@JsonKey(name: 'students')
|
||||
@JsonKey(name: 'submitStudents') // 当前页 总提交学生集合
|
||||
List<PaperStudents> students;
|
||||
|
||||
@JsonKey(name: 'templateId')
|
||||
|
|
@ -59,8 +59,9 @@ class DoPaperDetailsResult extends Object {
|
|||
@JsonKey(name: 'studentQuestions')
|
||||
List<StudentQuestions> studentQuestions;
|
||||
|
||||
// 当前页 未提交学生集合
|
||||
@JsonKey(name: 'unSubmitStudents')
|
||||
Object unSubmitStudents;
|
||||
List<PaperStudents> unSubmitStudents;
|
||||
|
||||
@JsonKey(name: 'lastPage')
|
||||
LastPage? lastPage;
|
||||
|
|
@ -68,7 +69,12 @@ class DoPaperDetailsResult extends Object {
|
|||
@JsonKey(name: 'nextPage')
|
||||
NextPage? nextPage;
|
||||
|
||||
// 所有页 总待提交数量
|
||||
@JsonKey(name: 'totalUnAnnotateCount')
|
||||
int totalUnAnnotateCount;
|
||||
|
||||
DoPaperDetailsResult(
|
||||
this.totalUnAnnotateCount,
|
||||
this.templateIds,
|
||||
this.students,
|
||||
this.templateId,
|
||||
|
|
@ -111,8 +117,8 @@ class DoPaperDetailsResult extends Object {
|
|||
if (annotateTime != null) showZgtAnnotate = '${showZgtAnnotate!}?$annotateTime';
|
||||
}
|
||||
|
||||
print('学生作答图片:${zgtAnswer}');
|
||||
print('老师批注图片:${showZgtAnnotate}');
|
||||
// print('学生作答图片:${annotatedCount}');
|
||||
// print('老师批注图片提交数量:${submitCount}');
|
||||
}
|
||||
|
||||
factory DoPaperDetailsResult.fromJson(Map<String, dynamic> srcJson) => _$DoPaperDetailsResultFromJson(srcJson);
|
||||
|
|
@ -128,6 +134,7 @@ class PaperStudents extends Object {
|
|||
@JsonKey(name: 'name')
|
||||
String name;
|
||||
|
||||
// 优先批阅
|
||||
@JsonKey(name: 'isPriority')
|
||||
bool isPriority;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,24 +35,24 @@ class MyApp extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return ScreenUtilInit(
|
||||
designSize: const Size(AppConfig.UI_WIDTH, AppConfig.UI_HEIGHT),
|
||||
/* minTextAdapt: true,
|
||||
/* minTextAdapt: true,
|
||||
splitScreenMode: true,*/
|
||||
builder: () => GetMaterialApp(
|
||||
title: '作业',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
brightness: Brightness.light,
|
||||
primarySwatch: createMaterialColor(const Color.fromRGBO(46, 91, 255, 1)),
|
||||
primaryColor: const Color.fromRGBO(46, 91, 255, 1),
|
||||
// textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp,),
|
||||
primaryTextTheme: TextTheme(
|
||||
bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87),
|
||||
),
|
||||
useMaterial3: false,
|
||||
brightness: Brightness.light,
|
||||
primarySwatch: createMaterialColor(const Color.fromRGBO(46, 91, 255, 1)),
|
||||
primaryColor: const Color.fromRGBO(46, 91, 255, 1),
|
||||
// textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp,),
|
||||
primaryTextTheme: TextTheme(
|
||||
bodyLarge: TextStyle(fontSize: 14.sp, color: Colors.black87),
|
||||
),
|
||||
useMaterial3: false,
|
||||
colorScheme: const ColorScheme.light(
|
||||
// 修改亮色主题的主题颜色
|
||||
primary: Color.fromRGBO(46, 91, 255, 1),
|
||||
)
|
||||
),
|
||||
primary: Color.fromRGBO(46, 91, 255, 1),
|
||||
)),
|
||||
enableLog: true,
|
||||
logWriterCallback: (text, {bool isError = false}) {
|
||||
// isError ? LoggerUtils.e(text) : LoggerUtils.i(text);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
|
|
@ -36,76 +37,180 @@ class _QuestionPaperViewState extends State<QuestionPaperView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
return Stack(
|
||||
children: [
|
||||
// 试题图片视图
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||
var maxWidth = constraints.maxWidth;
|
||||
var maxHeight = constraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
// 主图
|
||||
QuestionImageView(maxWidth, maxHeight, sateData, annotationState, logic),
|
||||
// 继续批阅按钮
|
||||
Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
||||
// 上一题按钮
|
||||
Positioned(
|
||||
left: 2.w,
|
||||
top: (maxHeight / 2) - 20.h,
|
||||
child: Obx(() {
|
||||
LastPage? lastPageVal = sateData.data.value?.lastPage;
|
||||
if (lastPageVal == null) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往上一题',
|
||||
tooltip: '点击前往上一题',
|
||||
focusColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
elevation: 10.r,
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = lastPageVal.studentId;
|
||||
param.templateId = lastPageVal.templateId;
|
||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
||||
Row(
|
||||
children: [
|
||||
// 试题图片视图
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||
var maxWidth = constraints.maxWidth;
|
||||
var maxHeight = constraints.maxHeight;
|
||||
return Stack(
|
||||
children: [
|
||||
// 主图
|
||||
QuestionImageView(maxWidth, maxHeight, sateData, annotationState, logic),
|
||||
// 继续批阅按钮
|
||||
Positioned(right: 3.w, bottom: 4.h, child: const $ContinueToReview(isFloatingAction: true)),
|
||||
// 上一题按钮
|
||||
Positioned(
|
||||
left: 2.w,
|
||||
top: (maxHeight / 2) - 20.h,
|
||||
child: Obx(() {
|
||||
LastPage? lastPageVal = sateData.data.value?.lastPage;
|
||||
if (lastPageVal == null) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往上一题',
|
||||
tooltip: '点击前往上一题',
|
||||
focusColor: Theme.of(context).primaryColor,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
elevation: 10.r,
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = lastPageVal.studentId;
|
||||
param.templateId = lastPageVal.templateId;
|
||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
||||
}),
|
||||
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
|
||||
);
|
||||
}),
|
||||
child: Icon(Icons.arrow_back_ios, color: Colors.white, size: 22.sp),
|
||||
);
|
||||
}),
|
||||
),
|
||||
// 下一题按钮
|
||||
Positioned(
|
||||
right: 2.w,
|
||||
top: (maxHeight / 2) - 20.h,
|
||||
child: Obx(() {
|
||||
NextPage? nextPageVal = sateData.data.value?.nextPage;
|
||||
if (nextPageVal == null) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往下一题',
|
||||
tooltip: '点击前往下一题',
|
||||
elevation: 10.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = nextPageVal.studentId;
|
||||
param.templateId = nextPageVal.templateId;
|
||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
||||
),
|
||||
// 下一题按钮
|
||||
Positioned(
|
||||
right: 2.w,
|
||||
top: (maxHeight / 2) - 20.h,
|
||||
child: Obx(() {
|
||||
NextPage? nextPageVal = sateData.data.value?.nextPage;
|
||||
if (nextPageVal == null) return const SizedBox();
|
||||
return FloatingActionButton(
|
||||
heroTag: '点击前往下一题',
|
||||
tooltip: '点击前往下一题',
|
||||
elevation: 10.r,
|
||||
backgroundColor: const Color.fromRGBO(24, 32, 32, 0.05),
|
||||
onPressed: () => easyThrottle('TestQuestionSwitch', () {
|
||||
var param = sateData.param.value;
|
||||
param.studentId = nextPageVal.studentId;
|
||||
param.templateId = nextPageVal.templateId;
|
||||
sateData.param.value = DoPaperDetailsParam.fromJson(param.toJson());
|
||||
}),
|
||||
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
|
||||
);
|
||||
}),
|
||||
child: Icon(Icons.arrow_forward_ios, color: Colors.white, size: 22.sp),
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
// 底部数据
|
||||
$TotalSubmitCountView(sateData)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
// 试题题号视图
|
||||
Expanded(flex: 2, child: $QuestionNumberView(sateData)),
|
||||
],
|
||||
),
|
||||
// 试题题号视图
|
||||
Expanded(flex: 2, child: $QuestionNumberView(sateData)),
|
||||
Obx(() {
|
||||
if (!sateData.getDataError.value) return const SizedBox();
|
||||
|
||||
return Center(
|
||||
child: CupertinoButton(
|
||||
color: Colors.grey[300],
|
||||
onPressed: () => easyThrottle('home_work_reload_data', () {
|
||||
sateData.param.value = DoPaperDetailsParam.fromJson(sateData.param.value.toJson());
|
||||
}),
|
||||
child: quickText('重新请求', color: Colors.black38),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@swidget
|
||||
Widget $totalSubmitCountView(BuildContext context, HomeworkReviewState sateData) {
|
||||
return Obx(() {
|
||||
var data = sateData.data.value;
|
||||
if (data == null) return Container();
|
||||
return Positioned(
|
||||
bottom: 10.h,
|
||||
right: 8.w,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
// List<JobConcernedWithStudent>? students = await getStudents();
|
||||
// if (students == null) return;
|
||||
// students = students..sort((e, e1) => e.studentName.compareTo(e1.studentName));
|
||||
// showModalBottomSheet(
|
||||
// context: context,
|
||||
// elevation: 10,
|
||||
// backgroundColor: Colors.white,
|
||||
// shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.only(
|
||||
// topLeft: Radius.circular(10.r),
|
||||
// topRight: Radius.circular(10.r),
|
||||
// ),
|
||||
// ),
|
||||
// builder: (BuildContext context) {
|
||||
// return Padding(
|
||||
// padding: EdgeInsets.symmetric(horizontal: 2.w),
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(top: 14.h),
|
||||
// child: quickText(
|
||||
// '当前页未提交学生名单',
|
||||
// size: 15.sp,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// color: Color.fromRGBO(60, 60, 60, 1),
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 10.h),
|
||||
// Expanded(
|
||||
// child: ListView(
|
||||
// padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 4.w),
|
||||
// children: [
|
||||
// Wrap(
|
||||
// spacing: 6.0, // 主轴(水平)方向间距
|
||||
// runSpacing: 4.0, // 纵轴(垂直)方向间距
|
||||
// alignment: WrapAlignment.spaceAround, //沿主轴方向居中
|
||||
// children: students!.map((e) {
|
||||
// return Chip(
|
||||
// labelPadding: EdgeInsets.symmetric(vertical: 1.5.h, horizontal: 5.w),
|
||||
// backgroundColor: Color.fromRGBO(239, 242, 255, 1),
|
||||
// // avatar: CircleAvatar(
|
||||
// // backgroundColor: Colors.white,
|
||||
// // child: quickText(e.studentName.substring(0, 1),
|
||||
// // size: 12.sp, color: Theme.of(context).primaryColor),
|
||||
// // ),
|
||||
// label: quickText(e.studentName, color: Color.fromRGBO(80, 94, 110, 1), size: 12.sp),
|
||||
// );
|
||||
// }).toList(),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// 试题题号视图
|
||||
@hwidget
|
||||
Widget $questionNumberView(BuildContext context, HomeworkReviewState sateData) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.dar
|
|||
import 'package:making_school_asignment_app/common/utils/toast_utils.dart';
|
||||
import 'package:making_school_asignment_app/common/utils/upload_oss_img_utils.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/personnel_data_overview.dart';
|
||||
|
||||
// 数据
|
||||
class HomeworkReviewState {
|
||||
|
|
@ -30,6 +31,9 @@ class HomeworkReviewState {
|
|||
late bool? panQuestView;
|
||||
late Rx<TestQuestionsImageInfo?> imageScale;
|
||||
List<dynamic> handwritings = [];
|
||||
bool needRefresh = false;
|
||||
bool lastQuestionPrompt = false; // 最后一题提示
|
||||
Rx<bool> getDataError = false.obs; // 获取作业数据报错
|
||||
|
||||
// late String dateEnd = '';
|
||||
// late int knowledgeId = 0;
|
||||
|
|
@ -99,9 +103,14 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
|
||||
// item.topHeight = itemPre.height;
|
||||
// }
|
||||
state.getDataError.value = false;
|
||||
state.data.value = data;
|
||||
state.handwritings = [];
|
||||
state.studentQuestions.value = data.studentQuestions;
|
||||
} catch (e) {
|
||||
print('获取数据报错了:$e');
|
||||
ToastUtils.showError('获取试题数据出错,请重试');
|
||||
state.getDataError.value = true;
|
||||
} finally {
|
||||
if (timerControl.isActive) timerControl.cancel();
|
||||
|
||||
|
|
@ -187,8 +196,6 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
options: Options(contentType: null, headers: {Headers.contentLengthHeader: bytes.length}),
|
||||
);
|
||||
|
||||
// var res = await getClient().uploadImag(resUrl, file);
|
||||
|
||||
return imgKey;
|
||||
} catch (e) {
|
||||
print('图片上传失败');
|
||||
|
|
@ -235,20 +242,28 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
);
|
||||
}).toList()))
|
||||
.then((e) async {
|
||||
var annotatedCount = data.annotatedCount + 1; // 批阅数量
|
||||
var submitCount = data.submitCount; // 学生提交数量
|
||||
if (annotatedCount == submitCount) {
|
||||
state.needRefresh = true;
|
||||
var totalUnAnnotateCount = data.totalUnAnnotateCount;
|
||||
if (data.annotateTime == null) totalUnAnnotateCount -= 1;
|
||||
|
||||
if (totalUnAnnotateCount <= 0 && !state.lastQuestionPrompt) {
|
||||
// 批阅完成
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context1) {
|
||||
return AlertDialog(
|
||||
title: quickText('完成批阅提示'),
|
||||
content: const Text('暂无更多待批阅项,是否返回主页?'),
|
||||
title: quickText('批阅已完成'),
|
||||
content: const Text('暂无更多待批阅项'),
|
||||
actions: <Widget>[
|
||||
TextButton(child: const Text('否'), onPressed: () => Navigator.of(context1).pop()),
|
||||
TextButton(
|
||||
child: const Text('是'),
|
||||
child: const Text('继续'),
|
||||
onPressed: () {
|
||||
state.lastQuestionPrompt = true;
|
||||
Navigator.of(context1).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('退出批阅'),
|
||||
onPressed: () {
|
||||
Navigator.of(context1).pop();
|
||||
Get.back();
|
||||
|
|
@ -260,8 +275,11 @@ class HomeworkReviewLogic extends GetxController with RequestToolMixin {
|
|||
return;
|
||||
}
|
||||
var newParams = DoPaperDetailsParam.fromJson(state.param.value.toJson());
|
||||
newParams.templateId = null;
|
||||
newParams.studentId = null;
|
||||
if (totalUnAnnotateCount > 0) {
|
||||
// 当前批阅任务完成 重复提交后 停留在当前数据位置
|
||||
newParams.templateId = null;
|
||||
newParams.studentId = null;
|
||||
}
|
||||
state.param.value = newParams;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||
import 'package:get/get.dart';
|
||||
import 'package:making_school_asignment_app/page/global_widget/ReturnToHomepage.dart';
|
||||
import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
|
||||
import 'package:making_school_asignment_app/page/home_page/children/annotate_class/annotate_class_logic.dart';
|
||||
|
||||
import 'components/bottom_operation_bar.dart';
|
||||
import 'components/button_floating_action.dart';
|
||||
|
|
@ -22,6 +23,7 @@ class HomeworkReview extends StatefulWidget {
|
|||
class _HomeworkReviewState extends State<HomeworkReview> {
|
||||
final logic = Get.find<HomeworkReviewLogic>();
|
||||
final sateData = Get.find<HomeworkReviewLogic>().state;
|
||||
final AnnotateClassLogic _controller = Get.find<AnnotateClassLogic>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -37,33 +39,38 @@ class _HomeworkReviewState extends State<HomeworkReview> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
// titleSpacing: 0,
|
||||
leading: IconButton(icon: const Icon(Icons.arrow_back_ios), onPressed: () => Get.back()),
|
||||
iconTheme: const IconThemeData(color: Colors.black),
|
||||
title: quickText(sateData.param.value.homeworkName),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
actions: [
|
||||
const FavoriteWidget(),
|
||||
SizedBox(width: 5.w),
|
||||
const ReturnToHomepage(),
|
||||
],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// 下拉切换
|
||||
const DropdownSwitchStudentsType(),
|
||||
SizedBox(height: 1.h),
|
||||
const Expanded(child: QuestionPaperView()),
|
||||
const BottomAnnotationSwitch(),
|
||||
],
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
onPopInvoked: (e) {
|
||||
if (e && sateData.needRefresh) _controller.getList();
|
||||
},
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
// titleSpacing: 0,
|
||||
leading: IconButton(icon: const Icon(Icons.arrow_back_ios), onPressed: () => Get.back()),
|
||||
iconTheme: const IconThemeData(color: Colors.black),
|
||||
title: quickText(sateData.param.value.homeworkName),
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
actions: [const FavoriteWidget(), SizedBox(width: 5.w), const ReturnToHomepage()],
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// 下拉切换
|
||||
const DropdownSwitchStudentsType(),
|
||||
SizedBox(height: 1.h),
|
||||
const Expanded(child: QuestionPaperView()),
|
||||
|
||||
const BottomAnnotationSwitch()
|
||||
],
|
||||
),
|
||||
),
|
||||
// floatingActionButton: const ButtonFloatingAction(),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||
),
|
||||
),
|
||||
floatingActionButton: const ButtonFloatingAction(),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.startFloat,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,12 +24,9 @@ class HomePage extends StatefulWidget {
|
|||
State<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
|
||||
final logic = Get.find<HomeLogic>();
|
||||
final state = Get
|
||||
.find<HomeLogic>()
|
||||
.state;
|
||||
final state = Get.find<HomeLogic>().state;
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
|
@ -38,7 +35,8 @@ class _HomePageState extends State<HomePage>
|
|||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
var spaceWidth = SizedBox(height: ScreenUtil().screenWidth / 19);
|
||||
return AnnotatedRegion(
|
||||
return SafeArea(
|
||||
child: AnnotatedRegion(
|
||||
value: const SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Color(0xFF000000),
|
||||
systemNavigationBarDividerColor: null,
|
||||
|
|
@ -53,13 +51,13 @@ class _HomePageState extends State<HomePage>
|
|||
controller: logic.refreshController,
|
||||
header: MaterialHeader(),
|
||||
footer: TaurusFooter(),
|
||||
onRefresh: () async{
|
||||
onRefresh: () async {
|
||||
state.pageNumber = 1;
|
||||
return logic.getList();
|
||||
},
|
||||
onLoad: () async{
|
||||
if(state.workList.length<state.totalCount){
|
||||
state.pageNumber ++;
|
||||
onLoad: () async {
|
||||
if (state.workList.length < state.totalCount) {
|
||||
state.pageNumber++;
|
||||
return logic.getList();
|
||||
}
|
||||
},
|
||||
|
|
@ -75,28 +73,21 @@ class _HomePageState extends State<HomePage>
|
|||
),
|
||||
),
|
||||
),*/
|
||||
SizedBox(height: 30.h),
|
||||
Obx(() {
|
||||
return $TermRow([
|
||||
EntranceModel(title: '作业批阅',
|
||||
image: 'assets/images/job_home_marking.png',
|
||||
navigationUrl: Routes.readOverPage),
|
||||
EntranceModel(title: '作业批阅', image: 'assets/images/job_home_marking.png', navigationUrl: Routes.readOverPage),
|
||||
EntranceModel(
|
||||
title: '学生历史作业',
|
||||
image: 'assets/images/job_home_history.png',
|
||||
navigationUrl: Routes.studentHistoryWorkPage,
|
||||
page: 'history',
|
||||
),
|
||||
EntranceModel(title: '知识点点掌握',
|
||||
image: 'assets/images/job_home_knowledge.png',
|
||||
navigationUrl: Routes.knowledgePointsGraspPage)
|
||||
EntranceModel(title: '知识点点掌握', image: 'assets/images/job_home_knowledge.png', navigationUrl: Routes.knowledgePointsGraspPage)
|
||||
], state.readOver.value);
|
||||
}),
|
||||
spaceWidth,
|
||||
$TermRow([
|
||||
EntranceModel(title: '答题轨迹',
|
||||
image: 'assets/images/job_home_answer_record.png',
|
||||
navigationUrl: Routes.answerTrajectoryPage),
|
||||
EntranceModel(title: '答题轨迹', image: 'assets/images/job_home_answer_record.png', navigationUrl: Routes.answerTrajectoryPage),
|
||||
EntranceModel(
|
||||
title: '优先批阅设定',
|
||||
image: 'assets/images/job_home_youxian.png',
|
||||
|
|
@ -127,7 +118,7 @@ class _HomePageState extends State<HomePage>
|
|||
'id': item.id,
|
||||
'name': item.name,
|
||||
'grade': item.grade,
|
||||
'subject':item.subject,
|
||||
'subject': item.subject,
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
|
|
@ -136,8 +127,7 @@ class _HomePageState extends State<HomePage>
|
|||
children: [
|
||||
SizedBox(height: 4.h),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 16.h, horizontal: 10.w),
|
||||
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 10.w),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.r),
|
||||
|
|
@ -152,25 +142,18 @@ class _HomePageState extends State<HomePage>
|
|||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment
|
||||
.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment
|
||||
.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: Utils.isPad() ? 32.w : 38.w,
|
||||
height: 18.h,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(
|
||||
left: Utils.isPad() ? 2.w : 3.w),
|
||||
padding: EdgeInsets.only(left: Utils.isPad() ? 2.w : 3.w),
|
||||
decoration: BoxDecoration(
|
||||
color: state.type == 1
|
||||
? const Color.fromRGBO(
|
||||
104, 136, 253, 1)
|
||||
: const Color.fromRGBO(
|
||||
255, 175, 56, 1),
|
||||
color: state.type == 1 ? const Color.fromRGBO(104, 136, 253, 1) : const Color.fromRGBO(255, 175, 56, 1),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(14.r),
|
||||
topRight: Radius.circular(3.r),
|
||||
|
|
@ -179,17 +162,14 @@ class _HomePageState extends State<HomePage>
|
|||
),
|
||||
),
|
||||
margin: EdgeInsets.only(right: 4.w),
|
||||
child: quickText(
|
||||
state.type == 1 ? '作业' : '考试',
|
||||
color: Colors.white, size: 10.sp),
|
||||
child: quickText(state.type == 1 ? '作业' : '考试', color: Colors.white, size: 10.sp),
|
||||
),
|
||||
Expanded(
|
||||
child: quickText(
|
||||
item.name,
|
||||
maxLines: 2,
|
||||
size: Utils.isPad() ? 14.sp : 16.sp,
|
||||
color: const Color.fromRGBO(
|
||||
70, 70, 70, 1),
|
||||
color: const Color.fromRGBO(70, 70, 70, 1),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
|
|
@ -201,41 +181,24 @@ class _HomePageState extends State<HomePage>
|
|||
children: [
|
||||
quickText(
|
||||
EnumUtils.formatSubject(item.subject),
|
||||
color: const Color.fromRGBO(
|
||||
97, 97, 97, 1),
|
||||
color: const Color.fromRGBO(97, 97, 97, 1),
|
||||
size: 12.sp,
|
||||
),
|
||||
quickText(' / ',
|
||||
color: const Color.fromRGBO(
|
||||
130, 130, 130, 1),
|
||||
size: 11.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment
|
||||
.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
quickText('题量:',
|
||||
color: const Color.fromRGBO(
|
||||
130, 130, 130, 1),
|
||||
size: 11.sp),
|
||||
quickText('题量:', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp),
|
||||
quickText(
|
||||
'${item.questionCount! - item.annotateCount!}',
|
||||
color: const Color.fromRGBO(
|
||||
97, 97, 97, 1),
|
||||
color: const Color.fromRGBO(97, 97, 97, 1),
|
||||
size: 13.sp,
|
||||
),
|
||||
],
|
||||
),
|
||||
quickText(' / ',
|
||||
color: const Color.fromRGBO(
|
||||
130, 130, 130, 1),
|
||||
size: 11.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
quickText(DateTime.parse(item.publishTime)
|
||||
.toString()
|
||||
.substring(0, 10),
|
||||
color: const Color.fromRGBO(
|
||||
97, 97, 97, 1), size: 12.sp),
|
||||
quickText(' / ', color: const Color.fromRGBO(130, 130, 130, 1), size: 11.sp, fontWeight: FontWeight.w500),
|
||||
quickText(DateTime.parse(item.publishTime).toString().substring(0, 10),
|
||||
color: const Color.fromRGBO(97, 97, 97, 1), size: 12.sp),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.h),
|
||||
|
|
@ -244,21 +207,16 @@ class _HomePageState extends State<HomePage>
|
|||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
10.r),
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
),
|
||||
child: LinearPercentIndicator(
|
||||
padding: EdgeInsets.zero,
|
||||
animation: true,
|
||||
lineHeight: 8.h,
|
||||
animationDuration: 2500,
|
||||
percent: item.annotateRate == null
|
||||
? 0
|
||||
: item.annotateRate! / 100,
|
||||
progressColor: const Color(
|
||||
0xFF6888FD),
|
||||
backgroundColor: const Color(
|
||||
0xFFE8E8E8),
|
||||
percent: item.annotateRate == null ? 0 : item.annotateRate! / 100,
|
||||
progressColor: const Color(0xFF6888FD),
|
||||
backgroundColor: const Color(0xFFE8E8E8),
|
||||
barRadius: Radius.circular(10.r),
|
||||
),
|
||||
),
|
||||
|
|
@ -266,10 +224,7 @@ class _HomePageState extends State<HomePage>
|
|||
SizedBox(
|
||||
width: 10.r,
|
||||
),
|
||||
quickText(
|
||||
'${item.annotateRate!.toStringAsFixed(
|
||||
0)}%', size: 10.sp,
|
||||
color: const Color(0xFF464646)),
|
||||
quickText('${item.annotateRate!.toStringAsFixed(0)}%', size: 10.sp, color: const Color(0xFF464646)),
|
||||
],
|
||||
),
|
||||
// FavoriteButton(jobTaskItem.id, jobTaskItem.title),
|
||||
|
|
@ -287,7 +242,7 @@ class _HomePageState extends State<HomePage>
|
|||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -303,8 +258,7 @@ class EntranceModel extends Object {
|
|||
String navigationUrl;
|
||||
String? page;
|
||||
|
||||
EntranceModel(
|
||||
{required this.title, required this.image, required this.navigationUrl, this.page});
|
||||
EntranceModel({required this.title, required this.image, required this.navigationUrl, this.page});
|
||||
}
|
||||
|
||||
@swidget
|
||||
|
|
@ -313,8 +267,7 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
|
|||
Widget childWidget;
|
||||
switch (leng) {
|
||||
case 1:
|
||||
childWidget =
|
||||
Row(children: [Expanded(child: $TermItem(items[0], data!))]);
|
||||
childWidget = Row(children: [Expanded(child: $TermItem(items[0], data!))]);
|
||||
break;
|
||||
case 2:
|
||||
childWidget = Row(children: [
|
||||
|
|
@ -348,13 +301,11 @@ Widget $termRow(BuildContext context, List<EntranceModel> items, int? data) {
|
|||
childWidget = Container();
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget);
|
||||
return Container(padding: EdgeInsets.symmetric(horizontal: 14.w), child: childWidget);
|
||||
}
|
||||
|
||||
@swidget
|
||||
Widget $termItem(BuildContext context, EntranceModel e, int data,
|
||||
{double? theHeight}) {
|
||||
Widget $termItem(BuildContext context, EntranceModel e, int data, {double? theHeight}) {
|
||||
bool isJob = e.title == '作业批阅';
|
||||
|
||||
return Material(
|
||||
|
|
@ -383,13 +334,10 @@ Widget $termItem(BuildContext context, EntranceModel e, int data,
|
|||
badgeStyle: badges.BadgeStyle(
|
||||
badgeColor: const Color.fromRGBO(255, 105, 105, 1),
|
||||
shape: badges.BadgeShape.square,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r),
|
||||
topRight: Radius.circular(8.5.r),
|
||||
bottomRight: Radius.circular(8.5.r)),
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(10.r), topRight: Radius.circular(8.5.r), bottomRight: Radius.circular(8.5.r)),
|
||||
// borderSide: BorderSide(color: Colors.white, width: 2),
|
||||
elevation: 1,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h),
|
||||
padding: EdgeInsets.symmetric(horizontal: Utils.isPad() ? 11.w : 16.w, vertical: 2.h),
|
||||
),
|
||||
position: badges.BadgePosition.topEnd(top: 10.r, end: 10.r),
|
||||
child: Container(
|
||||
|
|
@ -410,27 +358,21 @@ Widget $termItem(BuildContext context, EntranceModel e, int data,
|
|||
alignment: Alignment.center,
|
||||
child: isJob
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(height: 6.r),
|
||||
quickText(e.title, size: 12.sp,
|
||||
color: const Color.fromRGBO(79, 79, 79, 1),
|
||||
fontWeight: FontWeight.w500),
|
||||
],
|
||||
)
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(height: 6.r),
|
||||
quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(width: 6.r),
|
||||
quickText(e.title, size: 12.sp,
|
||||
color: const Color.fromRGBO(79, 79, 79, 1),
|
||||
fontWeight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(e.image, height: 32.r, width: 32.r, fit: BoxFit.cover),
|
||||
SizedBox(width: 6.r),
|
||||
quickText(e.title, size: 12.sp, color: const Color.fromRGBO(79, 79, 79, 1), fontWeight: FontWeight.w500),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue