Просмотр исходного кода

Merge branch 'develop' into feature/jeremy

南鑫林 лет назад: 5
Родитель
Сommit
95c6a076c1

+ 4 - 0
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -530,6 +530,7 @@
 		BD3474F522857B85000908C5 /* CommonPayHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD3474F422857B85000908C5 /* CommonPayHeader.swift */; };
 		BD37E38322CDF5BA003A14A2 /* CommunityVideoTopicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD37E38222CDF5BA003A14A2 /* CommunityVideoTopicView.swift */; };
 		BD37E38522CDF91A003A14A2 /* CommunityVideoSelTopicCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD37E38422CDF91A003A14A2 /* CommunityVideoSelTopicCell.swift */; };
+		BD37E38722CE200E003A14A2 /* CommunityAllCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD37E38622CE200E003A14A2 /* CommunityAllCommentView.swift */; };
 		BD3AA45822AE63EC00EF4F20 /* MessageMainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD3AA45722AE63EC00EF4F20 /* MessageMainViewController.swift */; };
 		BD477F6322C23D66008BE2CB /* AliyunReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = BD477F6222C23D66008BE2CB /* AliyunReachability.m */; };
 		BD4B50AC22BC7DEA0073B516 /* FilterResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BD4B50AB22BC7DEA0073B516 /* FilterResource.bundle */; };
@@ -1244,6 +1245,7 @@
 		BD3474F422857B85000908C5 /* CommonPayHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommonPayHeader.swift; sourceTree = "<group>"; };
 		BD37E38222CDF5BA003A14A2 /* CommunityVideoTopicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityVideoTopicView.swift; sourceTree = "<group>"; };
 		BD37E38422CDF91A003A14A2 /* CommunityVideoSelTopicCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityVideoSelTopicCell.swift; sourceTree = "<group>"; };
+		BD37E38622CE200E003A14A2 /* CommunityAllCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityAllCommentView.swift; sourceTree = "<group>"; };
 		BD3AA45722AE63EC00EF4F20 /* MessageMainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageMainViewController.swift; sourceTree = "<group>"; };
 		BD477F6122C23D65008BE2CB /* AliyunReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AliyunReachability.h; sourceTree = "<group>"; };
 		BD477F6222C23D66008BE2CB /* AliyunReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AliyunReachability.m; sourceTree = "<group>"; };
@@ -4708,6 +4710,7 @@
 				BD27F0B122CC9E2A00A6514D /* CommunityVideoPlayView.swift */,
 				BD37E38222CDF5BA003A14A2 /* CommunityVideoTopicView.swift */,
 				BD37E38422CDF91A003A14A2 /* CommunityVideoSelTopicCell.swift */,
+				BD37E38622CE200E003A14A2 /* CommunityAllCommentView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -6025,6 +6028,7 @@
 				A7D5F23322BB9BE600F8E9AF /* H5CommonViewController.swift in Sources */,
 				BD13B6C522BA034D008BB323 /* PublishEditAddAddressCell.swift in Sources */,
 				A7B4E71F228131720012914A /* ProductSlidingLeftRightCollectionViewCell.swift in Sources */,
+				BD37E38722CE200E003A14A2 /* CommunityAllCommentView.swift in Sources */,
 				A7778CA92244904500C7C47A /* Extension+Gifu.GIFImageView.swift in Sources */,
 				A71738AB22898660000AEA6A /* ShopModel.swift in Sources */,
 				A7FF1557228AC3E800A85748 /* ProductAllCommentViewController.swift in Sources */,

+ 150 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityAllCommentView.swift

@@ -0,0 +1,150 @@
+//
+//  CommunityAllCommentView.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/4.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  评价View
+
+import UIKit
+import FWPopupView
+import RxSwift
+import RxCocoa
+
+class CommunityAllCommentView: FWPopupView {
+    
+    let disposeBag = DisposeBag()
+    
+    typealias DismissTransBlock = () -> Void
+    var disTransBlock : DismissTransBlock?
+    
+    typealias ConfirmPayBlock = (_ pType: PayType) -> Void
+    var confirmPayBlock : ConfirmPayBlock?
+    
+    var curPayType : PayType = PayType.wechatPay
+    
+    var paymentAmount:String? {
+        didSet {
+            tableView.reloadData()
+        }
+    }
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        
+        addSubview(topView)
+        topView.addSubview(titleLabel)
+        topView.addSubview(dismissBtn)
+        
+        addSubview(tableView)
+        
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    func setupLayouts() {
+        topView.snp.makeConstraints { (make) in
+            make.top.left.right.equalToSuperview()
+            make.height.equalTo(48)
+        }
+        titleLabel.snp.makeConstraints { (make) in
+            make.left.equalTo(14)
+            make.top.equalTo(13)
+            make.height.equalTo(23)
+        }
+        dismissBtn.snp.makeConstraints { (make) in
+            make.top.equalTo(4)
+            make.right.equalTo(-5)
+            make.size.equalTo(40)
+        }
+        
+        tableView.snp.makeConstraints { (make) in
+            make.top.equalTo(topView.snp_bottom)
+            make.left.right.equalToSuperview()
+            make.bottom.equalTo(-48)
+        }
+    }
+    
+    private lazy var topView: UIView = {
+        let topView = UIView()
+        topView.backgroundColor = kffffffColor
+        return topView
+    }()
+    
+    private lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kRegularFont18
+        titleLabel.text = "全部评论 n"
+        return titleLabel
+    }()
+    
+    private lazy var dismissBtn: UIButton = {
+        let dismissBtn = UIButton(type: UIButton.ButtonType.custom)
+        dismissBtn.setImage(kImage(name: "popup_btn_close_black"), for: .normal)
+        dismissBtn.rx.tap.subscribe(onNext: { [weak self] (data) in
+            if let disTransBlock = self?.disTransBlock {
+                disTransBlock()
+            }
+        }).disposed(by: disposeBag)
+        return dismissBtn
+    }()
+    
+    lazy var tableView: UITableView = {
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
+        tableView.separatorStyle = .none
+        tableView.backgroundColor = kffffffColor
+        tableView.dataSource = self
+        tableView.delegate = self
+        tableView.estimatedRowHeight = 0.000001
+        tableView.estimatedSectionFooterHeight = 0.000001
+        tableView.estimatedSectionHeaderHeight = 0.000001
+        tableView.isScrollEnabled = false
+        return tableView
+    }()
+    
+}
+
+extension CommunityAllCommentView : UITableViewDelegate, UITableViewDataSource {
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 3
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        if indexPath.row == 0 {
+            let cell = CommunityMajorCommentCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return cell
+        } else {
+            let cell = CommunityReplyCommentCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return cell
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        print("点击了----\(indexPath.row)")
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return UITableView.automaticDimension
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 10
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0.000001
+    }
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+}

+ 30 - 5
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -26,6 +26,32 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
             if !(self.videoItemMdl?.video == nil || self.videoItemMdl?.video == "")  {
                 videoPlayView.assetURLString = self.videoItemMdl?.video
             }
+            
+            personIconBtn.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)"
+            
+            collectBtn.isSelected = self.videoItemMdl?.isCollect == 0 ? false : true
+            likeBtn.isSelected = self.videoItemMdl?.isLike == 0 ? false : true
+            
+            if self.videoItemMdl?.isFollow == 0 {
+                // 未关注
+                followButton.setTitle("+关注", for: UIControl.State.normal)
+                followButton.backgroundColor = k62CC74Color
+            } else {
+                // 已关注
+                followButton.setTitle("已关注", for: UIControl.State.normal)
+                followButton.backgroundColor = .clear
+                followButton.layer.borderWidth = 1
+                followButton.layer.borderColor = kffffffColor.cgColor
+            }
+            
+//            title    string    标题
+//            content    string    内容
+//            topic    array    话题数组,id=>name
         }
     }
     
@@ -309,7 +335,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var commentBtn: UIButton = {
         let commentBtn = UIButton(type: UIButton.ButtonType.custom)
-        commentBtn.setTitle("5178", for: UIControl.State.normal)
+        commentBtn.setTitle("0", for: UIControl.State.normal)
         commentBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
         commentBtn.setImage(kImage(name: "video_btn_note_white"), for: UIControl.State.normal)
         commentBtn.titleLabel?.font = kRegularFont14
@@ -323,7 +349,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var collectBtn: UIButton = {
         let collectBtn = UIButton(type: UIButton.ButtonType.custom)
-        collectBtn.setTitle("6124", for: UIControl.State.normal)
+        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)        
@@ -339,7 +365,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var likeBtn: UIButton = {
         let likeBtn = UIButton(type: UIButton.ButtonType.custom)
-        likeBtn.setTitle("8844", for: UIControl.State.normal)
+        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)
@@ -405,7 +431,6 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     private lazy var personLabel: UILabel = {
         let personLabel = UILabel()
-        personLabel.text = "林萌萌的萌萌哒"
         personLabel.textColor = kffffffColor
         personLabel.font = kRegularFont15
         return personLabel
@@ -416,7 +441,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         followButton.titleLabel?.font = kMediumFont13
         followButton.layer.cornerRadius = 13
         followButton.layer.masksToBounds = true
-        followButton.layer.borderWidth = 1
+        followButton.setTitleColor(kffffffColor, for: .normal)
         followButton.rx.tap.subscribe(onNext: {[weak self] (data) in
             if let buttonClickClosure = self?.buttonClickClosure {
                 buttonClickClosure(videoBtnClickType.typeFollow)

+ 17 - 3
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -11,9 +11,6 @@ import RxSwift
 
 class CommunityVideoListController: BaseViewController {
     
-    override var prefersStatusBarHidden: Bool {
-        return true
-    }
     // 内容Id
     var contentId: Int?
     
@@ -28,6 +25,10 @@ class CommunityVideoListController: BaseViewController {
     }
     weak var observe : NSObjectProtocol?
     
+    override var prefersStatusBarHidden: Bool {
+        return true
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -128,6 +129,8 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
             switch clickType {
             case videoBtnClickType.typeComment:
                 print("添加评论")
+                self?.showCommentView()
+                
             case videoBtnClickType.typeLike:
                 print("添加喜欢")
             case videoBtnClickType.typeCollect:
@@ -190,4 +193,15 @@ extension CommunityVideoListController {
         }
     }
     
+    func showCommentView() {
+        
+        AlertSheetView.commentAlertSheetView(paymentAmount: "20", cancelClosure: {
+            [weak self] in
+            
+        }) {
+            [weak self] (payType) in
+            print("----\(payType)")
+        }
+    }
+    
 }

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/popup_btn_close_black.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "popup_btn_close_black@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "popup_btn_close_black@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/popup_btn_close_black.imageset/popup_btn_close_black@2x.png


BIN
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/popup_btn_close_black.imageset/popup_btn_close_black@3x.png


+ 23 - 0
RainbowPlanet/RainbowPlanet/Tools/AlertSheetView/AlertSheetView.swift

@@ -113,6 +113,29 @@ class AlertSheetView: NSObject {
         }
     }
     
+    /// 自定义评论View
+    class func commentAlertSheetView(paymentAmount:String, cancelClosure:@escaping () -> Void, sureClosure:@escaping (_ pType: PayType) -> Void) {
+        let commentView = CommunityAllCommentView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 500))
+        commentView.paymentAmount = paymentAmount
+        let vProperty = FWPopupViewProperty()
+        vProperty.popupCustomAlignment = .bottomCenter
+        vProperty.popupAnimationType = .frame
+        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.5)
+        vProperty.touchWildToHide = "0"
+        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+        vProperty.animationDuration = 0.3
+        commentView.vProperty = vProperty
+        commentView.show()
+        commentView.disTransBlock = {
+            cancelClosure()
+            commentView.hide()
+        }
+        commentView.confirmPayBlock = { payType in
+            sureClosure(payType)
+            commentView.hide()
+        }
+    }
+    
     /// 分享
     class func sheetShareView() {
         let view = ShareView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: kSafeTabBarHeight + 250))