|
@@ -39,6 +39,8 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
|
|
|
addSubview(commentLabel)
|
|
|
addSubview(likeCountLabel)
|
|
|
addSubview(likeButton)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private func setupLayouts() {
|
|
@@ -63,7 +65,7 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
|
|
|
commentLabel.numberOfLines = 0
|
|
|
commentLabel.textColor = k333333Color
|
|
|
commentLabel.font = kRegularFont14
|
|
|
- commentLabel.isUserInteractionEnabled = true
|
|
|
+ commentLabel.isUserInteractionEnabled = false
|
|
|
commentLabel.textAlignment = .left
|
|
|
return commentLabel
|
|
|
}()
|
|
@@ -73,6 +75,7 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
|
|
|
likeButton.setImage(kImage(name: "btn_praise"), for: UIControl.State.normal)
|
|
|
likeButton.setImage(kImage(name: "btn_praise_pre_36px"), for: UIControl.State.selected)
|
|
|
likeButton.addTarget(self, action: #selector(likeAction), for: UIControl.Event.touchUpInside)
|
|
|
+
|
|
|
return likeButton
|
|
|
}()
|
|
|
|
|
@@ -81,13 +84,67 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
|
|
|
likeCountLabel.textColor = k313334Color
|
|
|
likeCountLabel.font = kRegularFont14
|
|
|
likeCountLabel.addTapGesture(1, target: self, action: #selector(likeAction))
|
|
|
+
|
|
|
return likeCountLabel
|
|
|
}()
|
|
|
|
|
|
@objc func likeAction() {
|
|
|
+ if communityRecommendCommentModel != nil {
|
|
|
+ VirusViewModel.shared.commentlikeVirueRecordApi(button: likeButton,
|
|
|
+ label: likeCountLabel,
|
|
|
+ isCommentLike: communityRecommendCommentModel?.isLike,
|
|
|
+ postId: communityRecommendDataModel?.id,
|
|
|
+ postAuthorUid: "\(communityRecommendDataModel?.uid ?? 0)",
|
|
|
+ title: communityRecommendDataModel?.title,
|
|
|
+ content: communityRecommendDataModel?.content,
|
|
|
+ postCover: communityRecommendDataModel?.img,
|
|
|
+ actionId: "\(communityRecommendCommentModel?.id ?? 0)",
|
|
|
+ postType: communityRecommendDataModel?.type,
|
|
|
+ commentContent: communityRecommendCommentModel?.content,
|
|
|
+ commentId: communityRecommendCommentModel?.id,
|
|
|
+ commentUId: communityRecommendCommentModel?.uid,
|
|
|
+ commentLikeCount: communityRecommendCommentModel?.likeCount) {
|
|
|
+ [weak self] (isCommentLike) in
|
|
|
+ self?.communityRecommendCommentModel?.isLike = isCommentLike
|
|
|
+ if isCommentLike == 1 {
|
|
|
+ self?.communityRecommendCommentModel?.likeCount = (self?.communityRecommendCommentModel?.likeCount ?? 0) + 1
|
|
|
+ }
|
|
|
+ if isCommentLike == 0 {
|
|
|
+ self?.communityRecommendCommentModel?.likeCount = (self?.communityRecommendCommentModel?.likeCount ?? 0) - 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if communityFollowPostCommentModel != nil {
|
|
|
+ VirusViewModel.shared.commentlikeVirueRecordApi(button: likeButton,
|
|
|
+ label: likeCountLabel,
|
|
|
+ isCommentLike: communityFollowPostCommentModel?.isLike,
|
|
|
+ postId: communityFollowRelateDataModel?.id,
|
|
|
+ postAuthorUid: "\(communityFollowRelateDataModel?.uid ?? 0)",
|
|
|
+ title: communityFollowRelateDataModel?.title,
|
|
|
+ content: communityFollowRelateDataModel?.content,
|
|
|
+ postCover: communityFollowRelateDataModel?.img,
|
|
|
+ actionId: "\(communityFollowPostCommentModel?.id ?? 0)",
|
|
|
+ postType: communityFollowRelateDataModel?.type,
|
|
|
+ commentContent: communityFollowPostCommentModel?.content,
|
|
|
+ commentId: communityFollowPostCommentModel?.id,
|
|
|
+ commentUId: communityFollowPostCommentModel?.uid,
|
|
|
+ commentLikeCount: communityFollowPostCommentModel?.likeCount) {
|
|
|
+ [weak self] (isCommentLike) in
|
|
|
+ self?.communityFollowPostCommentModel?.isLike = isCommentLike
|
|
|
+
|
|
|
+ if isCommentLike == 1 {
|
|
|
+ self?.communityFollowPostCommentModel?.likeCount = (self?.communityFollowPostCommentModel?.likeCount ?? 0) + 1
|
|
|
+ }
|
|
|
+ if isCommentLike == 0 {
|
|
|
+ self?.communityFollowPostCommentModel?.likeCount = (self?.communityFollowPostCommentModel?.likeCount ?? 0) - 1
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ var communityRecommendDataModel: CommunityRecommendDataModel?
|
|
|
var communityRecommendCommentModel: CommunityRecommendCommentModel? {
|
|
|
didSet {
|
|
|
let nameStr = "\(communityRecommendCommentModel?.username ?? ""):"
|
|
@@ -110,6 +167,8 @@ class CardContentCommentListContentTableViewCell: UITableViewCell {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ var communityFollowRelateDataModel : CommunityFollowRelateDataModel?
|
|
|
var communityFollowPostCommentModel: CommunityFollowPostCommentModel? {
|
|
|
didSet {
|
|
|
let nameStr = "\(communityFollowPostCommentModel?.username ?? ""):"
|