点赞列表显示评论点赞关联的动态

This commit is contained in:
2024-10-12 17:35:48 +08:00
parent dc363122c9
commit 7ec5abe362
3 changed files with 80 additions and 53 deletions

View File

@@ -132,6 +132,8 @@ data class NoticeComment(
val replyComment: NoticeComment?, val replyComment: NoticeComment?,
@SerializedName("postId") @SerializedName("postId")
val postId: Int, val postId: Int,
@SerializedName("post")
val post: NoticePost?,
) { ) {
fun toNoticeCommentEntity(): NoticeCommentEntity { fun toNoticeCommentEntity(): NoticeCommentEntity {
return NoticeCommentEntity( return NoticeCommentEntity(
@@ -139,7 +141,8 @@ data class NoticeComment(
content = content, content = content,
postId = postId, postId = postId,
time = ApiClient.dateFromApiString(time), time = ApiClient.dateFromApiString(time),
replyComment = replyComment?.toNoticeCommentEntity() replyComment = replyComment?.toNoticeCommentEntity(),
post = post?.toNoticePostEntity()
) )
} }
} }

View File

@@ -88,6 +88,8 @@ data class NoticeCommentEntity(
val replyComment: NoticeCommentEntity?, val replyComment: NoticeCommentEntity?,
// 动态 // 动态
val postId: Int, val postId: Int,
// 动态
val post : NoticePostEntity?,
) )
/** /**

View File

@@ -199,11 +199,11 @@ fun LikeCommentNoticeItem(
initImagePagerIndex = 0 initImagePagerIndex = 0
) )
} }
} }
) { ) {
Row {
Column( Column(
modifier = Modifier.weight(1f)
) { ) {
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -268,9 +268,31 @@ fun LikeCommentNoticeItem(
) )
} }
} }
}
Spacer(modifier = Modifier.width(16.dp))
if (item.comment?.replyComment?.post != null) {
item.comment.replyComment.post.let {
CustomAsyncImage(
context = context,
imageUrl = it.images[0].thumbnail,
contentDescription = "Post Thumbnail",
modifier = Modifier.size(48.dp),
contentScale = ContentScale.Crop
)
}
} else {
item.comment?.post?.let {
CustomAsyncImage(
context = context,
imageUrl = it.images[0].thumbnail,
contentDescription = "Post Thumbnail",
modifier = Modifier.size(48.dp),
contentScale = ContentScale.Crop
)
}
}
} }
} }
} }