Browse Source

player contentView

Chris 5 years ago
parent
commit
b75e162e9f

+ 142 - 12
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -9,6 +9,14 @@
 import UIKit
 import RxSwift
 
+enum videoBtnClickType {
+    case typeComment
+    case typeLike
+    case typeCollect
+    case typePerson
+    case typeFollow
+}
+
 class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     let disposeBag = DisposeBag()
@@ -27,8 +35,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     typealias ShareClosure = () -> Void
     var shareClosure : ShareClosure?
     
-    typealias BottomClickClosure = (_ clickType: BottomClickType) -> Void
-    var bottomClickClosure : BottomClickClosure?
+    typealias ButtonClickClosure = (_ clickType: videoBtnClickType) -> Void
+    var buttonClickClosure : ButtonClickClosure?
     
     class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> CommunityVideoCoverCollectionCell {
         let ID = "CommunityVideoCoverCollectionCell"
@@ -79,8 +87,19 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         commentView.addSubview(commentLabel)
         commentView.addSubview(textBtn)
         
+        // 话题View
         addSubview(topicView)
         
+        addSubview(personBackView)
+        personBackView.addSubview(personIconBtn)
+        personBackView.addSubview(personLabel)
+        personBackView.addSubview(followButton)
+        
+        addSubview(rainbowBeanView)
+        rainbowBeanView.addSubview(beanIconImageView)
+        rainbowBeanView.addSubview(beanLabel)
+        
+        
         addSubview(playStatusImageView)
         
         
@@ -165,7 +184,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
             make.edges.equalToSuperview()
         }
         
-        //
+        // 话题View
         topicView.snp.makeConstraints { (make) in
             make.bottom.equalTo(bottomCommentView.snp_top)
             make.left.right.equalToSuperview()
@@ -173,6 +192,50 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         }
         
         
+        // personView
+        personBackView.snp.makeConstraints { (make) in
+            make.left.equalTo(14)
+            make.height.equalTo(30)
+            
+            // FIXME:待调整底约束
+            make.bottom.equalToSuperview().offset(-200)
+        }
+        personIconBtn.snp.makeConstraints { (make) in
+            make.left.top.equalToSuperview()
+            make.size.equalTo(30)
+        }
+        personLabel.snp.makeConstraints { (make) in
+            make.left.equalTo(personIconBtn.snp_right).offset(10)
+            make.centerY.equalToSuperview()
+            make.height.equalTo(18)
+        }
+        followButton.snp.makeConstraints { (make) in
+            make.left.equalTo(personLabel.snp_right).offset(10)
+            make.centerY.equalToSuperview()
+            make.width.equalTo(64)
+            make.height.equalTo(20)
+        }
+        
+        // 彩虹豆View
+        rainbowBeanView.snp.makeConstraints { (make) in
+            make.left.equalTo(14)
+            make.height.equalTo(24)
+            
+            // FIXME:待调整底约束
+            make.bottom.equalToSuperview().offset(-250)
+        }
+        beanIconImageView.snp.makeConstraints { (make) in
+            make.left.equalTo(6)
+            make.centerY.equalToSuperview()
+            make.size.equalTo(19)
+        }
+        beanLabel.snp.makeConstraints { (make) in
+            make.left.equalTo(beanIconImageView.snp_right).offset(5)
+            make.top.bottom.equalToSuperview()
+            make.right.equalTo(-6)
+        }
+        
+        
         
         //
         playStatusImageView.snp.makeConstraints { (make) in
@@ -251,8 +314,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         commentBtn.setImage(kImage(name: "video_btn_note_white"), for: UIControl.State.normal)
         commentBtn.titleLabel?.font = kRegularFont14
         commentBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
-            if let bottomClickClosure = self?.bottomClickClosure {
-                bottomClickClosure(BottomClickType.typeComment)
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typeComment)
             }
         }).disposed(by: disposeBag)
         return commentBtn
@@ -267,8 +330,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         collectBtn.titleLabel?.font = kRegularFont14
         collectBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
             collectBtn.isSelected = !collectBtn.isSelected
-            if let bottomClickClosure = self?.bottomClickClosure {
-                bottomClickClosure(BottomClickType.typeCollect)
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typeCollect)
             }
         }).disposed(by: disposeBag)
         return collectBtn
@@ -283,8 +346,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         likeBtn.titleLabel?.font = kRegularFont14
         likeBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
             likeBtn.isSelected = !likeBtn.isSelected
-            if let bottomClickClosure = self?.bottomClickClosure {
-                bottomClickClosure(BottomClickType.typeLike)
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typeLike)
             }
         }).disposed(by: disposeBag)
         return likeBtn
@@ -292,7 +355,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var commentView: UIView = {
         let commentView = UIView()
-        commentView.backgroundColor = kDDDDDDColor
+        commentView.backgroundColor = kRGBAColor(r: 0/255.0, g: 0/255.0, b: 0/255.0, a: 0.3)
         commentView.cornerRadius = 15
         commentView.masksToBounds = true
         return commentView
@@ -309,8 +372,8 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     private lazy var textBtn: UIButton = {
         let textBtn = UIButton(type: UIButton.ButtonType.custom)
         textBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
-            if let bottomClickClosure = self?.bottomClickClosure {
-                bottomClickClosure(BottomClickType.typeComment)
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typeComment)
             }
         }).disposed(by: disposeBag)
         return textBtn
@@ -322,8 +385,75 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         return topicView
     }()
     
+    private lazy var personBackView: UIView = {
+        let personBackView = UIView()
+        personBackView.backgroundColor = UIColor.clear
+        return personBackView
+    }()
+    
+    private lazy var personIconBtn: UIButton = {
+        let personIconBtn = UIButton(type: UIButton.ButtonType.custom)
+        personIconBtn.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
+        personIconBtn.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typePerson)
+            }
+        }).disposed(by: disposeBag)
+        return personIconBtn
+    }()
+    
+    private lazy var personLabel: UILabel = {
+        let personLabel = UILabel()
+        personLabel.text = "林萌萌的萌萌哒"
+        personLabel.textColor = kffffffColor
+        personLabel.font = kRegularFont15
+        return personLabel
+    }()
+    
+    private lazy var followButton: UIButton = {
+        let followButton = UIButton(type: UIButton.ButtonType.custom)
+        followButton.titleLabel?.font = kMediumFont13
+        followButton.layer.cornerRadius = 13
+        followButton.layer.masksToBounds = true
+        followButton.layer.borderWidth = 1
+        followButton.rx.tap.subscribe(onNext: {[weak self] (data) in
+            if let buttonClickClosure = self?.buttonClickClosure {
+                buttonClickClosure(videoBtnClickType.typeFollow)
+            }
+        }).disposed(by: disposeBag)
+        return followButton
+    }()
     
+    private lazy var rainbowBeanView: UIView = {
+        let rainbowBeanView = UIView()
+        rainbowBeanView.backgroundColor = kRGBAColor(r: 0/255.0, g: 0/255.0, b: 0/255.0, a: 0.3)
+        rainbowBeanView.cornerRadius = 12
+        rainbowBeanView.masksToBounds = true
+        return rainbowBeanView
+    }()
+    
+    private lazy var beanIconImageView: UIImageView = {
+        let beanIconImageView = UIImageView()
+        beanIconImageView.image = kImage(name: "ico_bean_white")
+        return beanIconImageView
+    }()
+    
+    private lazy var beanLabel: UILabel = {
+        let beanLabel = UILabel()
+        beanLabel.text = "xx彩虹豆待收获"
+        beanLabel.textColor = kffffffColor
+        beanLabel.font = kRegularFont13
+        return beanLabel
+    }()
     
+    private lazy var videoTitleLabel: UILabel = {
+        let videoTitleLabel = UILabel()
+        videoTitleLabel.text = "我就是一个视频的Title"
+        videoTitleLabel.textColor = kffffffColor
+        videoTitleLabel.font = kMediumFont16
+        return videoTitleLabel
+    }()    
     
     
     // 播放暂停icon

+ 0 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoSelTopicCell.swift

@@ -69,7 +69,6 @@ class CommunityVideoSelTopicCell: UICollectionViewCell {
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
         titleLabel.text = "运动健身"
-//        titleLabel.backgroundColor = kRGBAColor(r: 0/255.0, g: 0/255.0, b: 0/255.0, a: 0.3)
         titleLabel.textColor = kffffffColor
         titleLabel.font = kRegularFont13
         titleLabel.textAlignment = .left

+ 9 - 5
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -123,17 +123,21 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
             [weak self] in
             print("------点击了[分享]")
         }
-        cell.bottomClickClosure = {
+        cell.buttonClickClosure = {
             [weak self] (clickType) in
             switch clickType {
-            case BottomClickType.typeComment:
+            case videoBtnClickType.typeComment:
                 print("添加评论")
-            case BottomClickType.typeLike:
+            case videoBtnClickType.typeLike:
                 print("添加喜欢")
-            case BottomClickType.typeCollect:
+            case videoBtnClickType.typeCollect:
                 print("添加收藏")
+            case videoBtnClickType.typePerson:
+                print("个人主页")
+            case videoBtnClickType.typeFollow:
+                print("关注动作")
             default:
-                print("添加收藏")
+                break
             }
         }
         return cell