收藏夹详情

This commit is contained in:
machuanyu 2024-06-04 15:03:52 +08:00
parent 8d27f76311
commit d8aa258e80
11 changed files with 376 additions and 278 deletions

View File

@ -116,4 +116,7 @@ abstract class RetrofitClient {
Future<BasePageData<HomeworkFavs>> getFavList( Future<BasePageData<HomeworkFavs>> getFavList(
@Query('HomeworkName') String homeworkName, @Query('ClassId') String classId); @Query('HomeworkName') String homeworkName, @Query('ClassId') String classId);
// ()
@POST("/api/hms/Annotate/AllCorrect")
Future getAllCorrect(@Field() String homeworkId,@Field() String classId);
} }

View File

@ -30,6 +30,8 @@ class UserStore extends GetxController with RequestToolMixin {
RxInt readOver = 0.obs; RxInt readOver = 0.obs;
RxInt assessType = 0.obs;
UserStore init() { UserStore init() {
token = StorageService.to.read(AppStorageKey.token.value); token = StorageService.to.read(AppStorageKey.token.value);
xToken = StorageService.to.read(AppStorageKey.xToken.value); xToken = StorageService.to.read(AppStorageKey.xToken.value);

View File

@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart'; import 'package:get_storage/get_storage.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.dart'; import 'package:making_school_asignment_app/common/job/annotated_class.dart';
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.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/routes/app_pages.dart'; import 'package:making_school_asignment_app/routes/app_pages.dart';
import 'annotate_class_state.dart'; import 'annotate_class_state.dart';
@ -42,6 +43,17 @@ class AnnotateClassLogic extends GetxController with RequestToolMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
void getAllCorrect(classId) async{
EasyLoading.show(status: 'loading...');
try {
await getClient().getAllCorrect(state.homeworkId.value,classId);
getList();
} catch (e) {
EasyLoading.dismiss();
ToastUtils.showError('操作失败,请重试');
}
}
void goQuickDataCheck(item) { void goQuickDataCheck(item) {
Get.toNamed(Routes.quickDataCheckPage, Get.toNamed(Routes.quickDataCheckPage,
arguments: {'homeworkId': state.homeworkId.value, 'classId': item.classId, 'grade': state.grade, 'className': item.className}); arguments: {'homeworkId': state.homeworkId.value, 'classId': item.classId, 'grade': state.grade, 'className': item.className});

View File

@ -59,6 +59,7 @@ class _AnnotateClassPageState extends State<AnnotateClassPage> {
return CompletedAnnotateItem( return CompletedAnnotateItem(
taskItem: taskItem, taskItem: taskItem,
logic: logic, logic: logic,
name: state.name.value,
); );
}).toList(), }).toList(),
) )
@ -69,6 +70,7 @@ class _AnnotateClassPageState extends State<AnnotateClassPage> {
return CompletedAnnotateItem( return CompletedAnnotateItem(
taskItem: taskItem, taskItem: taskItem,
logic: logic, logic: logic,
name: state.name.value,
); );
}) })
: Utils.isPad() : Utils.isPad()

View File

@ -23,6 +23,64 @@ class AnnotateItem extends StatefulWidget {
} }
class _AnnotateItemState extends State<AnnotateItem> { class _AnnotateItemState extends State<AnnotateItem> {
Future<bool> confirmDialog() async {
return await showDialog(
context: context,
builder: (context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), //
),
actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
content: SizedBox(
width: 200.r,
child: Text(
'一键批阅后,默认学生答题结果全部正确, 是否进行此操作?',
style: TextStyle(fontSize: 14.sp, color: const Color(0xFF505E6E)),
),
),
actionsAlignment: MainAxisAlignment.center,
actions: <Widget>[
InkWell(
child: Container(
width: 97.r,
height: 27.r,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.r)),
color: const Color(0xFF6888FD),
),
child: const Center(
child: Text(
'确定',
style: TextStyle(color: Colors.white),
))),
onTap: () {
//
Get.back(result: true);
},
),
InkWell(
onTap: () {
Get.back(result: false);
},
child: Container(
width: 97.r,
height: 27.r,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.r)),
color: const Color(0xFFF4F4F4),
),
child: const Center(
child: Text(
'取消',
style: TextStyle(color: Color(0xFF666666)),
))),
),
],
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AnnotatedClass itemData = widget.item; AnnotatedClass itemData = widget.item;
@ -71,7 +129,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
Expanded( Expanded(
flex: 4, flex: 4,
child: ItemBtn( child: ItemBtn(
title: "收藏夹", title: "收藏夹${widget.item.homeworkFavs.isNotEmpty?'(${ widget.item.homeworkFavs.length})':''}",
font: widget.font - 2.sp, font: widget.font - 2.sp,
clickFunction: () { clickFunction: () {
Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade}); Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade});
@ -89,7 +147,14 @@ class _AnnotateItemState extends State<AnnotateItem> {
child: ItemBtn( child: ItemBtn(
title: "一键批阅", title: "一键批阅",
font: widget.font - 2.sp, font: widget.font - 2.sp,
clickFunction: () {}, clickFunction: () async{
var confim =
await confirmDialog();
if (confim) {
widget.logic.getAllCorrect(
widget.item.classId);
}
},
), ),
), ),
const Expanded( const Expanded(
@ -113,7 +178,7 @@ class _AnnotateItemState extends State<AnnotateItem> {
Expanded( Expanded(
flex: 4, flex: 4,
child: ItemBtn( child: ItemBtn(
title: "收藏夹", title: "收藏夹${widget.item.homeworkFavs.isNotEmpty?'(${ widget.item.homeworkFavs.length})':''}",
font: widget.font - 2.sp, font: widget.font - 2.sp,
clickFunction: () { clickFunction: () {
Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade}); Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':widget.name,'classId':widget.item.classId,'homeworkId':widget.logic.state.homeworkId.value,'grade':widget.item.grade});

View File

@ -8,11 +8,13 @@ import 'package:making_school_asignment_app/page/global_widget/my_text.dart';
import 'package:making_school_asignment_app/page/global_widget/show_student_list.dart'; import 'package:making_school_asignment_app/page/global_widget/show_student_list.dart';
import 'package:making_school_asignment_app/page/home_page/children/annotate_class/annotate_class_logic.dart'; import 'package:making_school_asignment_app/page/home_page/children/annotate_class/annotate_class_logic.dart';
import 'package:making_school_asignment_app/page/home_page/widget/progress_bar.dart'; import 'package:making_school_asignment_app/page/home_page/widget/progress_bar.dart';
import 'package:making_school_asignment_app/routes/app_pages.dart';
class CompletedAnnotateItem extends StatelessWidget { class CompletedAnnotateItem extends StatelessWidget {
final AnnotatedClass taskItem; final AnnotatedClass taskItem;
final AnnotateClassLogic logic; final AnnotateClassLogic logic;
const CompletedAnnotateItem({Key? key, required this.taskItem, required this.logic}) : super(key: key); final String name;
const CompletedAnnotateItem({Key? key, required this.taskItem, required this.logic,required this.name}) : super(key: key);
void showStudentList(context, List<AnnotatedStudents> students, [bool submitted = false]) async { void showStudentList(context, List<AnnotatedStudents> students, [bool submitted = false]) async {
showDialog( showDialog(
@ -47,7 +49,7 @@ class CompletedAnnotateItem extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ProgressBar( ProgressBar(
color: Color.fromRGBO(76, 199, 147, 1), color: const Color.fromRGBO(76, 199, 147, 1),
percent: taskItem.kgtCorrectRate / 100, percent: taskItem.kgtCorrectRate / 100,
title: '客观题正确率:', title: '客观题正确率:',
padingEdg: EdgeInsets.only(left: 10.w, right: 10.w), padingEdg: EdgeInsets.only(left: 10.w, right: 10.w),
@ -56,7 +58,7 @@ class CompletedAnnotateItem extends StatelessWidget {
marginEdg: EdgeInsets.only(top: 5.h), marginEdg: EdgeInsets.only(top: 5.h),
), ),
ProgressBar( ProgressBar(
color: Color.fromRGBO(76, 199, 147, 1), color: const Color.fromRGBO(76, 199, 147, 1),
percent: taskItem.zgtCorrectRate / 100, percent: taskItem.zgtCorrectRate / 100,
title: '主观题正确率:', title: '主观题正确率:',
fontSize: 8.sp, fontSize: 8.sp,
@ -65,7 +67,7 @@ class CompletedAnnotateItem extends StatelessWidget {
marginEdg: EdgeInsets.only(top: 5.h), marginEdg: EdgeInsets.only(top: 5.h),
), ),
ProgressBar( ProgressBar(
color: Color.fromRGBO(76, 199, 147, 1), color: const Color.fromRGBO(76, 199, 147, 1),
percent: taskItem.correctRate / 100, percent: taskItem.correctRate / 100,
title: '总正确率:', title: '总正确率:',
fontSize: 8.sp, fontSize: 8.sp,
@ -133,14 +135,16 @@ class CompletedAnnotateItem extends StatelessWidget {
color: Color.fromRGBO(244, 244, 244, 1), color: Color.fromRGBO(244, 244, 244, 1),
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: InkWell( child: InkWell(
onTap: () {}, onTap: () {
Get.toNamed(Routes.favStudentPage,arguments: {'homeworkName':name,'classId':taskItem.classId,'homeworkId':logic.state.homeworkId.value,'grade':taskItem.grade});
},
splashColor: Theme.of(context).primaryColor, splashColor: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(vertical: 4.h), padding: EdgeInsets.symmetric(vertical: 4.h),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)), decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)),
child: quickText('收藏夹', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)), child: quickText('收藏夹${taskItem.homeworkFavs.isNotEmpty?'(${taskItem.homeworkFavs.length})':''}', size: 8.sp, color: Color.fromRGBO(102, 102, 102, 1)),
), ),
), ),
)), )),

View File

@ -2,7 +2,9 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.dart'; import 'package:making_school_asignment_app/common/job/annotated_class.dart';
import 'package:making_school_asignment_app/common/job/common/base_page_data.dart'; import 'package:making_school_asignment_app/common/job/common/base_page_data.dart';
import 'package:making_school_asignment_app/common/job/marking_models/favor_param.dart';
import 'package:making_school_asignment_app/common/mixins/request_tool_mixin.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 'fav_student_state.dart'; import 'fav_student_state.dart';
@ -56,14 +58,21 @@ class FavStudentLogic extends GetxController with RequestToolMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
getDelete(student) async { void getDelete(student) async {
/* RestClient _client = await getClient(); EasyLoading.show(status: 'loading...');
BaseStructureResult res = await _client.getJobDeFavorites( try {
widget.jobId, student.studentId, student.questionPage!); await getClient().toFavStudent(FavorParam(
if (res.success) { homeworkId: state.homeworkId,
_future = getData(); studentId: student.studentId,
setState(() {}); templateId: student.templateId,
}*/ questionNo: student.questionNo,
isFav: false,
));
getList();
} catch (e) {
EasyLoading.dismiss();
ToastUtils.showError('操作失败,请重试');
}
} }
} }

View File

@ -48,7 +48,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r), actionsPadding: EdgeInsets.symmetric(vertical: 10.r, horizontal: 10.r),
content: Text( content: Text(
'确定删除吗?', '确定删除吗?',
style: TextStyle(fontSize: 14.sp, color: Color(0xFF505E6E)), style: TextStyle(fontSize: 14.sp, color: const Color(0xFF505E6E)),
), ),
actionsAlignment: MainAxisAlignment.center, actionsAlignment: MainAxisAlignment.center,
actions: <Widget>[ actions: <Widget>[
@ -58,7 +58,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
height: 27.r, height: 27.r,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.r)), borderRadius: BorderRadius.all(Radius.circular(20.r)),
color: Color(0xFF6888FD), color: const Color(0xFF6888FD),
), ),
child: const Center( child: const Center(
child: Text( child: Text(
@ -81,7 +81,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
height: 27.r, height: 27.r,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.r)), borderRadius: BorderRadius.all(Radius.circular(20.r)),
color: Color(0xFFF4F4F4), color: const Color(0xFFF4F4F4),
), ),
child: const Center( child: const Center(
child: Text( child: Text(
@ -96,14 +96,14 @@ class _FavStudentPageState extends State<FavStudentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Color.fromRGBO(245, 245, 245, 1), backgroundColor: const Color.fromRGBO(245, 245, 245, 1),
appBar: AppBar( appBar: AppBar(
// titleSpacing: 0, // titleSpacing: 0,
elevation: 0.0, elevation: 0.0,
leading: IconButton( leading: IconButton(
icon: Icon(Icons.arrow_back_ios), icon: const Icon(Icons.arrow_back_ios),
onPressed: () => Navigator.of(context).pop()), onPressed: () => Navigator.of(context).pop()),
iconTheme: IconThemeData(color: Colors.black), iconTheme: const IconThemeData(color: Colors.black),
title: quickText('收藏夹'), title: quickText('收藏夹'),
centerTitle: true, centerTitle: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -111,8 +111,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
ReturnToHomepage(), ReturnToHomepage(),
], ],
), ),
body: Container( body: Column(
child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric(vertical: 0.r, horizontal: 14.r), padding: EdgeInsets.symmetric(vertical: 0.r, horizontal: 14.r),
@ -125,7 +124,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
return Text( return Text(
state.homeworkName.value, state.homeworkName.value,
style: style:
TextStyle(fontSize: 14.sp, color: Color(0xFF3C3C3C),), TextStyle(fontSize: 14.sp, color: const Color(0xFF3C3C3C),),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
); );
}), }),
@ -191,7 +190,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
'${item['questionPage']}', '${item['questionPage']}',
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF2E5BFF)), color: const Color(0xFF2E5BFF)),
), ),
), ),
GridView( GridView(
@ -248,12 +247,12 @@ class _FavStudentPageState extends State<FavStudentPage> {
), ),
InkWell( InkWell(
onTap: () async { onTap: () async {
/* var confim = var confim =
await confirmDialog(); await confirmDialog();
if (confim) { if (confim) {
getDelete( logic.getDelete(
student); student);
}*/ }
}, },
child: Image.asset( child: Image.asset(
'assets/images/favorite_delete_icon.png', 'assets/images/favorite_delete_icon.png',
@ -291,7 +290,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
'${item['questionPage']}', '${item['questionPage']}',
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF2E5BFF)), color: const Color(0xFF2E5BFF)),
), ),
), ),
ListView.builder( ListView.builder(
@ -299,8 +298,8 @@ class _FavStudentPageState extends State<FavStudentPage> {
HomeworkFavs student = item['list'][i]; HomeworkFavs student = item['list'][i];
return InkWell( return InkWell(
onTap: () { onTap: () {
/* showStudentDialog( showStudentDialog(
context, student, groupList);*/ context, student, state.favList);
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -318,7 +317,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
.spaceBetween, .spaceBetween,
children: [ children: [
quickText(student.studentName, quickText(student.studentName,
color: Color(0xFF333333), color: const Color(0xFF333333),
size: 14.sp), size: 14.sp),
Expanded(child: Container()), Expanded(child: Container()),
Padding( Padding(
@ -328,17 +327,17 @@ class _FavStudentPageState extends State<FavStudentPage> {
student.className!, student.className!,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Color( color: const Color(
0xFF666666)), 0xFF666666)),
), ),
), ),
InkWell( InkWell(
onTap: () async { onTap: () async {
/*var confim = var confim =
await confirmDialog(); await confirmDialog();
if (confim) { if (confim) {
getDelete(student); logic.getDelete(student);
}*/ }
}, },
child: Image.asset( child: Image.asset(
'assets/images/favorite_delete_icon.png', 'assets/images/favorite_delete_icon.png',
@ -372,7 +371,7 @@ class _FavStudentPageState extends State<FavStudentPage> {
}), }),
], ],
)), ),
); );
} }

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_rx/get_rx.dart'; import 'package:get/get_rx/get_rx.dart';
import 'package:making_school_asignment_app/common/config/request_config.dart';
import 'package:making_school_asignment_app/common/job/annotated_class.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/MyEmptyWidget.dart';
import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view.dart';
@ -141,7 +142,7 @@ class _FavoriteStudentDialogState extends State<FavoriteStudentDialog> {
builder: (BuildContext context, int index) { builder: (BuildContext context, int index) {
final HomeworkFavs item = imageList[index]; final HomeworkFavs item = imageList[index];
return PhotoViewGalleryPageOptions( return PhotoViewGalleryPageOptions(
imageProvider: NetworkImage(item.zgtAnswer!), imageProvider: NetworkImage(RequestConfig.imgUrl + item.zgtAnswer!),
heroAttributes: PhotoViewHeroAttributes(tag: item.id!), heroAttributes: PhotoViewHeroAttributes(tag: item.id!),
); );
}, },

View File

@ -19,11 +19,11 @@ class ReadOverLogic extends GetxController with RequestToolMixin, GetTickerProvi
late final EasyRefreshController refreshController2; late final EasyRefreshController refreshController2;
WorkStudentParams params = WorkStudentParams( WorkStudentParams params = WorkStudentParams(
assessType: 0, assessType: UserStore.to.assessType.value,
pageSize: 10, pageSize: 10,
); );
WorkStudentParams params2 = WorkStudentParams( WorkStudentParams params2 = WorkStudentParams(
assessType: 0, assessType: UserStore.to.assessType.value,
pageSize: 10, pageSize: 10,
); );

View File

@ -60,6 +60,7 @@ class _ReadOverPageState extends State<ReadOverPage> {
padding: EdgeInsets.only(left: 10.w), padding: EdgeInsets.only(left: 10.w),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
// SystemNavigator.pop();
Get.back(); Get.back();
}, },
child: Icon( child: Icon(