no message
This commit is contained in:
parent
314638a3ae
commit
e4c889fc6d
|
|
@ -205,3 +205,4 @@ marking_app/lib/common/model/job/job_favorite_model.g.dart
|
|||
marking_app/lib/common/model/job/job_level_set_params.g.dart
|
||||
marking_app/lib/common/model/job/job_student_goups.g.dart
|
||||
marking_app/lib/common/model/job/job_student_level.g.dart
|
||||
marking_app/lib/common/model/job/job_favorite_item_model.g.dart
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'job_favorite_item_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class JobFavoriteItemModel extends Object {
|
||||
@JsonKey(name: 'studentId')
|
||||
int studentId;
|
||||
|
||||
@JsonKey(name: 'studentName')
|
||||
String studentName;
|
||||
|
||||
@JsonKey(name: 'createTime')
|
||||
String createTime;
|
||||
|
||||
JobFavoriteItemModel(
|
||||
this.studentId,
|
||||
this.studentName,
|
||||
this.createTime,
|
||||
);
|
||||
|
||||
factory JobFavoriteItemModel.fromJson(Map<String, dynamic> srcJson) => _$JobFavoriteItemModelFromJson(srcJson);
|
||||
|
||||
Map<String, dynamic> toJson() => _$JobFavoriteItemModelToJson(this);
|
||||
}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:marking_app/common/mixin/common.dart';
|
||||
import 'package:marking_app/common/model/job/job_favorite_item_model.dart';
|
||||
import 'package:marking_app/utils/index.dart';
|
||||
import 'package:marking_app/utils/my_text.dart';
|
||||
|
||||
/// 作业收藏学生名单列表
|
||||
class JobFavorite extends StatefulWidget {
|
||||
final int jobId;
|
||||
final int schoolId;
|
||||
final int gradeId;
|
||||
final String className;
|
||||
|
||||
const JobFavorite({
|
||||
required this.jobId,
|
||||
required this.schoolId,
|
||||
required this.gradeId,
|
||||
required this.className,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<JobFavorite> createState() => _JobFavoriteState();
|
||||
}
|
||||
|
||||
class _JobFavoriteState extends State<JobFavorite> with CommonMixin {
|
||||
late Future<List<JobFavoriteItemModel>?> _future;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_future = getData();
|
||||
}
|
||||
|
||||
Future<List<JobFavoriteItemModel>?> getData() async {
|
||||
var _client = await getClient();
|
||||
var result = await _client.getListOfJobFavorites(widget.jobId, widget.gradeId, widget.schoolId, widget.className);
|
||||
return result.data;
|
||||
}
|
||||
|
||||
Future<void> toGoCancelFavorite(int jobId, int studentId) async {
|
||||
var _client = await getClient();
|
||||
var result = await _client.toJobCancelFavorite(jobId, studentId);
|
||||
if (result.success && (result.data ?? false)) {
|
||||
_future = getData();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
// titleSpacing: 0,
|
||||
leading: IconButton(icon: Icon(Icons.arrow_back_ios), onPressed: () => Navigator.of(context).pop()),
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
title: quickText('收藏夹'),
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
body: MyFutureBuilder.buildFutureBuilderOfSingleInstance<List<JobFavoriteItemModel>>(
|
||||
context,
|
||||
_future,
|
||||
(List<JobFavoriteItemModel>? datas) {
|
||||
if (datas == null)
|
||||
return Container(
|
||||
child: Center(
|
||||
child: quickText('请求错误'),
|
||||
),
|
||||
);
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(child: quickText(widget.className)),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
JobFavoriteItemModel item = datas[index];
|
||||
return Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
quickText(item.studentName, color: Color.fromRGBO(102, 102, 102, 1), size: 14.sp),
|
||||
quickText('收藏时间:${item.createTime}', color: Color.fromRGBO(137, 137, 137, 1), size: 10.sp),
|
||||
InkWell(
|
||||
onTap: () async {},
|
||||
child: Icon(
|
||||
Icons.favorite,
|
||||
size: 28.sp,
|
||||
color: Color.fromRGBO(252, 108, 108, 1),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: datas.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ class _JobListParticipateInClassState extends State<JobListParticipateInClass> w
|
|||
|
||||
Future<void> getListOfJobFavoritesData() async {
|
||||
RestClient _client = await getClient();
|
||||
BaseStructureResult<List<JobFavoriteModel>> result = await _client.getListOfJobFavorites(widget.jobId);
|
||||
BaseStructureResult<List<JobFavoriteModel>> result = await _client.getListOfJobFavoriteNumber(widget.jobId);
|
||||
if (result.success) {
|
||||
result.data?.forEach((e) {
|
||||
favoriteMap['${e.schoolId}+${e.gradeId}+${e.className}'] = e.count;
|
||||
|
|
@ -814,7 +814,7 @@ class MobileEndCompleted extends StatelessWidget {
|
|||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(vertical: 5.h),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.r)),
|
||||
child: quickText('收藏夹(${task.collectNumber})',
|
||||
child: quickText(task.collectNumber > 0 ? '收藏夹(${task.collectNumber})' : '收藏夹',
|
||||
size: 10.sp, color: Color.fromRGBO(102, 102, 102, 1)),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import 'package:marking_app/common/model/job/job_concerned_with_student.dart';
|
|||
import 'package:marking_app/common/model/job/job_concerned_with_student_params.dart';
|
||||
import 'package:marking_app/common/model/job/job_data_report.dart';
|
||||
import 'package:marking_app/common/model/job/job_do_marking_status_info.dart';
|
||||
import 'package:marking_app/common/model/job/job_favorite_item_model.dart';
|
||||
import 'package:marking_app/common/model/job/job_favorite_model.dart';
|
||||
import 'package:marking_app/common/model/job/job_level_set_params.dart';
|
||||
import 'package:marking_app/common/model/job/job_note_taking_trajectory.dart';
|
||||
|
|
@ -296,9 +297,24 @@ abstract class RestClient {
|
|||
Future<BaseStructureResult<List<MarkingTasks>>> getJobListParticipateInClass(
|
||||
@the_retrofit.Query("markingId") int jobId);
|
||||
|
||||
// 作业 => 收藏列表
|
||||
// 作业 => 作业收藏数量
|
||||
@the_retrofit.GET("${RequestConfig.hwProxyKeywords}/dpc-api/api/read/job-favorite-count-by-class")
|
||||
Future<BaseStructureResult<List<JobFavoriteModel>>> getListOfJobFavorites(@the_retrofit.Query("jobid") int jobId);
|
||||
Future<BaseStructureResult<List<JobFavoriteModel>>> getListOfJobFavoriteNumber(
|
||||
@the_retrofit.Query("jobid") int jobId);
|
||||
|
||||
// 作业 => 作业收藏列表
|
||||
@the_retrofit.GET("${RequestConfig.hwProxyKeywords}/dpc-api/api/read/job-favorites")
|
||||
Future<BaseStructureResult<List<JobFavoriteItemModel>>> getListOfJobFavorites(
|
||||
@the_retrofit.Query("jobid") int jobId,
|
||||
@the_retrofit.Query("gradeId") int gradeId,
|
||||
@the_retrofit.Query("schoolId") int schoolId,
|
||||
@the_retrofit.Query("className") String className,
|
||||
);
|
||||
|
||||
// 作业 => 作业收藏列表
|
||||
@the_retrofit.POST("${RequestConfig.hwProxyKeywords}/dpc-api/api/read/cancel-favorite")
|
||||
Future<BaseStructureResult<bool>> toJobCancelFavorite(
|
||||
@the_retrofit.Field() int jobId, @the_retrofit.Field() int studentId);
|
||||
|
||||
// 作业 => 数据快查
|
||||
@the_retrofit.GET("/api/read/job-data-center-report")
|
||||
|
|
@ -322,6 +338,4 @@ abstract class RestClient {
|
|||
// 作业 => 取消/设置优先
|
||||
@the_retrofit.POST("/api/read/jc-job-read-level")
|
||||
Future<BaseStructureResult> getSetJobReadLevel(@the_retrofit.Body() JobLevelSetParams params);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue