|
@@ -33,9 +33,20 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
avatarButton.kf.setImage(with: kURLImage(name: self.videoItemMdl?.avatar ?? ""), for: .normal, placeholder: kImage(name: "default_avatar"))
|
|
|
personLabel.text = self.videoItemMdl?.username
|
|
|
|
|
|
- commentBtn.titleLabel?.text = "\(self.videoItemMdl?.commentCount ?? 0)"
|
|
|
- collectBtn.titleLabel?.text = "\(self.videoItemMdl?.collectCount ?? 0)"
|
|
|
- likeBtn.titleLabel?.text = "\(self.videoItemMdl?.praiseCount ?? 0)"
|
|
|
+ // 点赞
|
|
|
+ if self.videoItemMdl?.isLike == 0 {
|
|
|
+ likeBtn.setTitle("\(self.videoItemMdl?.praiseCount ?? 0)", for: .normal)
|
|
|
+ } else {
|
|
|
+ likeBtn.setTitle("\(self.videoItemMdl?.praiseCount ?? 0)", for: .selected)
|
|
|
+ }
|
|
|
+ // 收藏
|
|
|
+ if self.videoItemMdl?.isCollect == 0 {
|
|
|
+ collectBtn.setTitle("\(self.videoItemMdl?.collectCount ?? 0)", for: .normal)
|
|
|
+ } else {
|
|
|
+ collectBtn.setTitle("\(self.videoItemMdl?.collectCount ?? 0)", for: .selected)
|
|
|
+ }
|
|
|
+ // 评论
|
|
|
+ commentBtn.setTitle("\(self.videoItemMdl?.commentCount ?? 0)", for: .normal)
|
|
|
|
|
|
collectBtn.isSelected = self.videoItemMdl?.isCollect == 0 ? false : true
|
|
|
likeBtn.isSelected = self.videoItemMdl?.isLike == 0 ? false : true
|
|
@@ -436,13 +447,22 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
|
|
|
private lazy var collectBtn: UIButton = {
|
|
|
let collectBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
- collectBtn.setTitle("0", for: UIControl.State.normal)
|
|
|
collectBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
collectBtn.setImage(kImage(name: "video_btn_collect_white"), for: UIControl.State.normal)
|
|
|
collectBtn.setImage(kImage(name: "btn_collect_pre"), for: UIControl.State.selected)
|
|
|
collectBtn.titleLabel?.font = kRegularFont14
|
|
|
collectBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
collectBtn.isSelected = !collectBtn.isSelected
|
|
|
+ // 本地修改收藏数据
|
|
|
+ var collectCount = self?.videoItemMdl?.collectCount ?? 0
|
|
|
+ if self?.videoItemMdl?.isCollect == 0 {
|
|
|
+ collectBtn.setTitle("\(collectCount)", for: .normal)
|
|
|
+ collectBtn.setTitle("\(collectCount+1)", for: .selected)
|
|
|
+ } else {
|
|
|
+ collectBtn.setTitle("\(collectCount)", for: .selected)
|
|
|
+ collectBtn.setTitle("\(collectCount-1)", for: .normal)
|
|
|
+ }
|
|
|
+ // 点击回调
|
|
|
if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
buttonClickClosure(videoBtnClickType.typeCollect, self?.videoItemMdl?.uid ?? 0)
|
|
|
}
|
|
@@ -452,13 +472,22 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
|
|
|
|
|
|
private lazy var likeBtn: UIButton = {
|
|
|
let likeBtn = UIButton(type: UIButton.ButtonType.custom)
|
|
|
- likeBtn.setTitle("0", for: UIControl.State.normal)
|
|
|
likeBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
|
|
|
likeBtn.setImage(kImage(name: "video_btn_praise_white"), for: UIControl.State.normal)
|
|
|
likeBtn.setImage(kImage(name: "btn_praise_pre_36px"), for: UIControl.State.selected)
|
|
|
likeBtn.titleLabel?.font = kRegularFont14
|
|
|
likeBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
|
|
|
likeBtn.isSelected = !likeBtn.isSelected
|
|
|
+ // 本地修改点赞数据
|
|
|
+ var praiseCount = self?.videoItemMdl?.praiseCount ?? 0
|
|
|
+ if self?.videoItemMdl?.isLike == 0 {
|
|
|
+ likeBtn.setTitle("\(praiseCount)", for: .normal)
|
|
|
+ likeBtn.setTitle("\(praiseCount+1)", for: .selected)
|
|
|
+ } else {
|
|
|
+ likeBtn.setTitle("\(praiseCount)", for: .selected)
|
|
|
+ likeBtn.setTitle("\(praiseCount-1)", for: .normal)
|
|
|
+ }
|
|
|
+ // 点击回调
|
|
|
if let buttonClickClosure = self?.buttonClickClosure {
|
|
|
buttonClickClosure(videoBtnClickType.typeLike, self?.videoItemMdl?.uid ?? 0)
|
|
|
}
|