|
@@ -80,7 +80,6 @@ class RecommendSubCommentTableViewCell: UITableViewCell {
|
|
|
make.left.equalTo(titleLabel.snp_left)
|
|
|
make.right.equalTo(contentLabel.snp_right)
|
|
|
make.height.equalTo(15)
|
|
|
- make.bottom.equalToSuperview()
|
|
|
}
|
|
|
|
|
|
likeCountLabel.snp.makeConstraints { (make) in
|
|
@@ -152,34 +151,68 @@ class RecommendSubCommentTableViewCell: UITableViewCell {
|
|
|
}()
|
|
|
|
|
|
@objc func likeAction() {
|
|
|
- VirusViewModel.shared.commentlikeVirueRecordApi(button: likeButton,
|
|
|
- label: likeCountLabel,
|
|
|
- isCommentLike: communityPostReplyModel?.isLike,
|
|
|
- postId: communityPostDetailModel?.id,
|
|
|
- postAuthorUid: "\(communityPostDetailModel?.uid ?? 0)",
|
|
|
- title: communityPostDetailModel?.title,
|
|
|
- content: communityPostDetailModel?.content,
|
|
|
- postCover: communityPostDetailModel?.img,
|
|
|
- actionId: "\(communityPostDetailModel?.id ?? 0)",
|
|
|
- postType: communityPostDetailModel?.type,
|
|
|
- commentContent: communityPostReplyModel?.content,
|
|
|
- commentId: communityPostReplyModel?.id,
|
|
|
- commentUId: communityPostReplyModel?.uid,
|
|
|
- commentLikeCount: communityPostReplyModel?.likeCount) {
|
|
|
- [weak self] (isCommentLike) in
|
|
|
- self?.communityPostReplyModel?.isLike = isCommentLike
|
|
|
- if isCommentLike == 1 {
|
|
|
- self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) + 1
|
|
|
- }
|
|
|
- if isCommentLike == 0 {
|
|
|
- self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) - 1
|
|
|
- }
|
|
|
+
|
|
|
+ if communityPostDetailModel != nil {
|
|
|
+ VirusViewModel.shared.commentlikeVirueRecordApi(button: likeButton,
|
|
|
+ label: likeCountLabel,
|
|
|
+ isCommentLike: communityPostReplyModel?.isLike,
|
|
|
+ postId: communityPostDetailModel?.id,
|
|
|
+ postAuthorUid: "\(communityPostDetailModel?.uid ?? 0)",
|
|
|
+ title: communityPostDetailModel?.title,
|
|
|
+ content: communityPostDetailModel?.content,
|
|
|
+ postCover: communityPostDetailModel?.img,
|
|
|
+ actionId: "\(communityPostDetailModel?.id ?? 0)",
|
|
|
+ postType: communityPostDetailModel?.type,
|
|
|
+ commentContent: communityPostReplyModel?.content,
|
|
|
+ commentId: communityPostReplyModel?.id,
|
|
|
+ commentUId: communityPostReplyModel?.uid,
|
|
|
+ commentLikeCount: communityPostReplyModel?.likeCount) {
|
|
|
+ [weak self] (isCommentLike) in
|
|
|
+ self?.communityPostReplyModel?.isLike = isCommentLike
|
|
|
+ if isCommentLike == 1 {
|
|
|
+ self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) + 1
|
|
|
+ }
|
|
|
+ if isCommentLike == 0 {
|
|
|
+ self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) - 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if communityVideoItemModel != nil {
|
|
|
+ VirusViewModel.shared.commentlikeVirueRecordApi(button: likeButton,
|
|
|
+ label: likeCountLabel,
|
|
|
+ isCommentLike: communityPostReplyModel?.isLike,
|
|
|
+ postId: communityVideoItemModel?.id,
|
|
|
+ postAuthorUid: "\(communityVideoItemModel?.uid ?? 0)",
|
|
|
+ title: communityVideoItemModel?.title,
|
|
|
+ content: communityVideoItemModel?.content,
|
|
|
+ postCover: communityVideoItemModel?.img,
|
|
|
+ actionId: "\(communityVideoItemModel?.id ?? 0)",
|
|
|
+ postType: communityVideoItemModel?.type,
|
|
|
+ commentContent: communityPostReplyModel?.content,
|
|
|
+ commentId: communityPostReplyModel?.id,
|
|
|
+ commentUId: communityPostReplyModel?.uid,
|
|
|
+ commentLikeCount: communityPostReplyModel?.likeCount) {
|
|
|
+ [weak self] (isCommentLike) in
|
|
|
+ self?.communityPostReplyModel?.isLike = isCommentLike
|
|
|
+ if isCommentLike == 1 {
|
|
|
+ self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) + 1
|
|
|
+ }
|
|
|
+ if isCommentLike == 0 {
|
|
|
+ self?.communityPostReplyModel?.likeCount = (self?.communityPostReplyModel?.likeCount ?? 0) - 1
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/// 帖子Id
|
|
|
var communityPostDetailModel : CommunityPostDetailModel?
|
|
|
|
|
|
+ var communityVideoItemModel : CommunityVideoItemModel?
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var communityPostReplyModel: CommunityPostReplyModel? {
|
|
|
didSet {
|
|
|
iconButton.kf.setImage(with: kURLImage(name: communityPostReplyModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
|
|
@@ -215,10 +248,10 @@ class RecommendSubCommentTableViewCell: UITableViewCell {
|
|
|
likeCountLabel.isHidden = false
|
|
|
likeButton.isHidden = false
|
|
|
}
|
|
|
-
|
|
|
+ contentLabel.sizeToFit()
|
|
|
let contentLabelHeight = contentLabel.text?.heightForComment(font: kRegularFont14!, width: kScreenWidth - 24 - 92)
|
|
|
let subViewHeight = 17.0 + (contentLabelHeight ?? 0) + 15.0
|
|
|
- let spacHeight = 10.0 + 8.0 + 8.0
|
|
|
+ let spacHeight = 10.0 + 12 + 8.0
|
|
|
communityPostReplyModel?.height = CGFloat(subViewHeight) + CGFloat(spacHeight)
|
|
|
}
|
|
|
}
|