提交 3ff7ccc1 authored 作者: yueweilu's avatar yueweilu

书籍已下架 收藏列表跳转处理

上级 91e9f931
...@@ -44,6 +44,9 @@ class CourseModel { ...@@ -44,6 +44,9 @@ class CourseModel {
/// 笔记 /// 笔记
this.commentNum, this.commentNum,
/// ///
///
/// 收藏
this.isHave,
}); });
...@@ -80,6 +83,10 @@ class CourseModel { ...@@ -80,6 +83,10 @@ class CourseModel {
/// 讨论 /// 讨论
commentNum = json['comment_num']; commentNum = json['comment_num'];
/// ///
/// 收藏
status = json['status'];
isHave = json['is_have'];
} }
num? bookId; num? bookId;
String? bookName; String? bookName;
...@@ -115,6 +122,8 @@ class CourseModel { ...@@ -115,6 +122,8 @@ class CourseModel {
num? commentNum; num? commentNum;
/// ///
/// 收藏
num? isHave;
...@@ -171,6 +180,9 @@ class CourseModel { ...@@ -171,6 +180,9 @@ class CourseModel {
num? commentNum, num? commentNum,
/// ///
/// 收藏
num? isHave,
}) => CourseModel( bookId: bookId ?? this.bookId, }) => CourseModel( bookId: bookId ?? this.bookId,
bookName: bookName ?? this.bookName, bookName: bookName ?? this.bookName,
authors: authors ?? this.authors, authors: authors ?? this.authors,
...@@ -202,6 +214,9 @@ class CourseModel { ...@@ -202,6 +214,9 @@ class CourseModel {
/// 讨论 /// 讨论
commentNum: commentNum ?? this.commentNum, commentNum: commentNum ?? this.commentNum,
/// ///
/// 收藏
isHave: isHave ?? this.isHave,
); );
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
...@@ -225,6 +240,7 @@ class CourseModel { ...@@ -225,6 +240,7 @@ class CourseModel {
map['notes_num'] = notesNum; map['notes_num'] = notesNum;
map['wrong_num'] = wrongNum; map['wrong_num'] = wrongNum;
map['comment_num'] = commentNum; map['comment_num'] = commentNum;
map['is_have'] = isHave;
return map; return map;
} }
......
...@@ -33,7 +33,12 @@ class _UserLovePageState extends State<UserLovePage> { ...@@ -33,7 +33,12 @@ class _UserLovePageState extends State<UserLovePage> {
CourseModel model = controller.loves[index]; CourseModel model = controller.loves[index];
return GestureDetector( return GestureDetector(
onTap: (){ onTap: (){
if(model.status == 0 && model.isHave == 0){
Toast.show('书籍已下架');
}
else{
context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()}); context.pushNamed(Routes.bookDetail,queryParameters: {'book_id':model.bookId.toString()});
}
}, },
child: BuildItem(model: model,onTap: (){ child: BuildItem(model: model,onTap: (){
controller.unLoved(bookId: model.bookId.toString()); controller.unLoved(bookId: model.bookId.toString());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论