Selaa lähdekoodia

Merge branch 'develop' into feature/dev_Chris

Chris 5 vuotta sitten
vanhempi
commit
4c62420efd
16 muutettua tiedostoa jossa 529 lisäystä ja 198 poistoa
  1. BIN
      .DS_Store
  2. 2 0
      RainbowPlanet/Podfile
  3. 51 7
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  4. 10 0
      RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+HandleOpen.swift
  5. 47 0
      RainbowPlanet/RainbowPlanet/Macro/Common.swift
  6. 30 0
      RainbowPlanet/RainbowPlanet/Model/OpenAppModel/OpenAppModel.swift
  7. 3 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/AllCommentCell/RecommendMajorCommentCell.swift
  8. 0 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/imageCell/RecommendDetailContentCell.swift
  9. 0 103
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunitySubCommentController.swift
  10. 34 16
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunityMajorCommentCell.swift
  11. 49 18
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunityReplyCommentCell.swift
  12. 176 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift
  13. 34 0
      RainbowPlanet/RainbowPlanet/Router/CommunityRouterModuleType.swift
  14. 43 0
      RainbowPlanet/RainbowPlanet/Router/RouterManager.swift
  15. 1 1
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift
  16. 49 52
      RainbowPlanet/RainbowPlanet/Tools/CommentKeyboard/LXKeyBoard.m

BIN
.DS_Store


+ 2 - 0
RainbowPlanet/Podfile

@@ -54,6 +54,8 @@ target 'RainbowPlanet' do
   pod 'DPScrollNumberLabel'
   # 左右Label
   pod 'FlickerNumber'
+  # 生成二维码
+  pod 'EFQRCode'
   
 
   #======================第三方平台===========

+ 51 - 7
RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj

@@ -194,6 +194,9 @@
 		A76390EB2248E27A0067EEE0 /* UserNotifications.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A76390EA2248E27A0067EEE0 /* UserNotifications.framework */; };
 		A7649B6922977A4300BCE9D1 /* ShopSectionHeaderModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7649B6822977A4300BCE9D1 /* ShopSectionHeaderModel.swift */; };
 		A76B786922CE04940047EC1B /* CommunityRecommendDetailHTMLTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A76B786822CE04940047EC1B /* CommunityRecommendDetailHTMLTableViewCell.swift */; };
+		A770E5DB22CED8C600CBD0A4 /* RouterManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A770E5DA22CED8C600CBD0A4 /* RouterManager.swift */; };
+		A770E5DD22CEDF4F00CBD0A4 /* OpenAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A770E5DC22CEDF4F00CBD0A4 /* OpenAppModel.swift */; };
+		A770E5E022CF19FA00CBD0A4 /* CommunityRouterModuleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A770E5DF22CF19FA00CBD0A4 /* CommunityRouterModuleType.swift */; };
 		A771F07C226D4E1C007999DB /* AddressPOITableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A771F07B226D4E1C007999DB /* AddressPOITableViewCell.swift */; };
 		A773D02F229FDC3B007A5751 /* DIYEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A773D02E229FDC3B007A5751 /* DIYEmptyView.swift */; };
 		A775CBFE2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A775CBFD2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift */; };
@@ -870,6 +873,9 @@
 		A76390EA2248E27A0067EEE0 /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; };
 		A7649B6822977A4300BCE9D1 /* ShopSectionHeaderModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopSectionHeaderModel.swift; sourceTree = "<group>"; };
 		A76B786822CE04940047EC1B /* CommunityRecommendDetailHTMLTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityRecommendDetailHTMLTableViewCell.swift; sourceTree = "<group>"; };
+		A770E5DA22CED8C600CBD0A4 /* RouterManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterManager.swift; sourceTree = "<group>"; };
+		A770E5DC22CEDF4F00CBD0A4 /* OpenAppModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenAppModel.swift; sourceTree = "<group>"; };
+		A770E5DF22CF19FA00CBD0A4 /* CommunityRouterModuleType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityRouterModuleType.swift; sourceTree = "<group>"; };
 		A771F07B226D4E1C007999DB /* AddressPOITableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressPOITableViewCell.swift; sourceTree = "<group>"; };
 		A773D02E229FDC3B007A5751 /* DIYEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DIYEmptyView.swift; sourceTree = "<group>"; };
 		A775CBFD2237493600EBDCF8 /* ShoppingMallNavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingMallNavigationBarView.swift; sourceTree = "<group>"; };
@@ -2246,7 +2252,6 @@
 		A72A725422321B9400B21995 /* Manager */ = {
 			isa = PBXGroup;
 			children = (
-				A7AA9FA422C895650086498B /* RouteManner */,
 				A797FDE922C5AC570076DCB3 /* CacheManager */,
 				A7D5F24E22BC7B0500F8E9AF /* WebViewJavascriptBridgeManager */,
 				A73911AB229CD6080033177E /* AlamofireReachabilityManager */,
@@ -2460,6 +2465,7 @@
 		A738D203225AEAD000EEE860 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				A770E5DE22CEDF5700CBD0A4 /* OpenAppModel */,
 				A72A73722233966800B21995 /* RootModel */,
 				A7AA9F5B22C5FCE50086498B /* VirusModel */,
 				A7D5F25D22C0612A00F8E9AF /* CommunityModel */,
@@ -2635,6 +2641,39 @@
 			path = HTMLCell;
 			sourceTree = "<group>";
 		};
+		A76B786A22CE462E0047EC1B /* imageCell */ = {
+			isa = PBXGroup;
+			children = (
+				BD2FCBE322B244250006D974 /* RecommendDetailContentCell.swift */,
+			);
+			path = imageCell;
+			sourceTree = "<group>";
+		};
+		A76B786B22CE46750047EC1B /* ViewController */ = {
+			isa = PBXGroup;
+			children = (
+				BD1FC18522B09F9800D55081 /* CommunitySubCommentController.swift */,
+			);
+			path = ViewController;
+			sourceTree = "<group>";
+		};
+		A76B786C22CE467E0047EC1B /* View */ = {
+			isa = PBXGroup;
+			children = (
+				BD1FC18722B0A30300D55081 /* CommunityMajorCommentCell.swift */,
+				BD1FC18922B0A32100D55081 /* CommunityReplyCommentCell.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
+		A770E5DE22CEDF5700CBD0A4 /* OpenAppModel */ = {
+			isa = PBXGroup;
+			children = (
+				A770E5DC22CEDF4F00CBD0A4 /* OpenAppModel.swift */,
+			);
+			path = OpenAppModel;
+			sourceTree = "<group>";
+		};
 		A773D02D229FD5B7007A5751 /* MainView */ = {
 			isa = PBXGroup;
 			children = (
@@ -2796,6 +2835,7 @@
 				A71CAB3F22CB32A300D908A8 /* ViewModel */,
 				A738D203225AEAD000EEE860 /* Model */,
 				A72A7252223219BD00B21995 /* Service */,
+				A7AA9FA422C895650086498B /* Router */,
 				A72A725422321B9400B21995 /* Manager */,
 				A72A725922321C5E00B21995 /* Macro */,
 				A77F2CBC2232022A001BD3F6 /* Tools */,
@@ -3341,11 +3381,13 @@
 			path = Recommend;
 			sourceTree = "<group>";
 		};
-		A7AA9FA422C895650086498B /* RouteManner */ = {
+		A7AA9FA422C895650086498B /* Router */ = {
 			isa = PBXGroup;
 			children = (
+				A770E5DA22CED8C600CBD0A4 /* RouterManager.swift */,
+				A770E5DF22CF19FA00CBD0A4 /* CommunityRouterModuleType.swift */,
 			);
-			path = RouteManner;
+			path = Router;
 			sourceTree = "<group>";
 		};
 		A7B4E71B22812D390012914A /* ShoppingMallSlidingLeftRight */ = {
@@ -4630,9 +4672,8 @@
 		BD1FC18222B09F4700D55081 /* CommunitySubComment */ = {
 			isa = PBXGroup;
 			children = (
-				BD1FC18522B09F9800D55081 /* CommunitySubCommentController.swift */,
-				BD1FC18722B0A30300D55081 /* CommunityMajorCommentCell.swift */,
-				BD1FC18922B0A32100D55081 /* CommunityReplyCommentCell.swift */,
+				A76B786C22CE467E0047EC1B /* View */,
+				A76B786B22CE46750047EC1B /* ViewController */,
 			);
 			path = CommunitySubComment;
 			sourceTree = "<group>";
@@ -4711,13 +4752,13 @@
 		BD2FCBE022B21C600006D974 /* View */ = {
 			isa = PBXGroup;
 			children = (
+				A76B786A22CE462E0047EC1B /* imageCell */,
 				A76B786722CE04730047EC1B /* HTMLCell */,
 				BDAF83AE22B3B6150004BCC3 /* AllCommentCell */,
 				BDAF83A922B388F20004BCC3 /* RecommendDefaultBackCell.swift */,
 				BDAF83A722B343C50004BCC3 /* RecommendBottomCommentView.swift */,
 				A7C2567022CC895F00420828 /* CommunityPostDetailTableViewHeaderView.swift */,
 				A7C2567222CC8BB000420828 /* CommunityPostDetailFSPagerViewCell.swift */,
-				BD2FCBE322B244250006D974 /* RecommendDetailContentCell.swift */,
 				BD2FCBE522B2586C0006D974 /* CommunityTagCollectionCell.swift */,
 				BD2FCBE922B267280006D974 /* RecommendNoneCommentCell.swift */,
 				BDAF83A122B330540004BCC3 /* RecommendSimilarCell.swift */,
@@ -5672,6 +5713,7 @@
 				BD20F1D52283D15500677D8E /* OrderFinishPayFailureCell.swift in Sources */,
 				A72A72C022321DE000B21995 /* Extension+UIView.swift in Sources */,
 				BDAF83B022B3B63B0004BCC3 /* RecommendCommentHeader.swift in Sources */,
+				A770E5DD22CEDF4F00CBD0A4 /* OpenAppModel.swift in Sources */,
 				BD7AB83A2284288D0030646A /* ShoppingCartPayOrderFooter.swift in Sources */,
 				A719EE6E22AF441F001AAC98 /* CommunityViewController.swift in Sources */,
 				BD13B6C622BA034D008BB323 /* PublishEditTitleCell.swift in Sources */,
@@ -5703,6 +5745,7 @@
 				BDF47D7E22827C3F00941AB9 /* ProductSlidingTopBottomCollectionViewCell.swift in Sources */,
 				BD108C9522A60C2100837DAB /* HGImageCollectionViewCell.swift in Sources */,
 				A7FF1589228C854900A85748 /* OrderDetailBottomView.swift in Sources */,
+				A770E5DB22CED8C600CBD0A4 /* RouterManager.swift in Sources */,
 				BD1FC1A722B1075F00D55081 /* UIColor+Expanded.m in Sources */,
 				A7D5F22B22BB687100F8E9AF /* BaseJSWebViewController.swift in Sources */,
 				BD1DC6C5228CFD0B00B89C57 /* SwiftMoyaNetWorkServiceOrder.swift in Sources */,
@@ -6210,6 +6253,7 @@
 				A757849F22C1CEA900D4DB61 /* FollowStatusModel.swift in Sources */,
 				A7CC751F227190C5003C4F38 /* AccountSecurityViewController.swift in Sources */,
 				BD13B6C422BA034D008BB323 /* PublishEditDefaultCollectionCell.swift in Sources */,
+				A770E5E022CF19FA00CBD0A4 /* CommunityRouterModuleType.swift in Sources */,
 				BD29A92E228F99780018CFC3 /* OrderCommentParameterModel.swift in Sources */,
 				BD61230522C36C6900D3F513 /* AlivcPushBeautyDataManager.m in Sources */,
 				A7284440224DFACD00F82F30 /* InfoModel.swift in Sources */,

+ 10 - 0
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+HandleOpen.swift

@@ -17,6 +17,11 @@ extension AppDelegate {
         if (!result) {
             // 其他如支付等SDK的回调
             result = PayManager.shared().handleOpen(url: url)
+            if !result {
+                // 自己路由
+                result = RouterManager.shared.handleOpen(url: url)
+                return result
+            }
             return result
         }
         return result;
@@ -27,6 +32,11 @@ extension AppDelegate {
         if (!result) {
             // 其他如支付等SDK的回调
             result = PayManager.shared().handleOpen(url: url)
+            if !result {
+                // 自己路由
+                result = RouterManager.shared.handleOpen(url: url)
+                return result
+            }
             return result
         }
         return result;

+ 47 - 0
RainbowPlanet/RainbowPlanet/Macro/Common.swift

@@ -299,3 +299,50 @@ func getImageHeight(imgStr:String) -> CGFloat {
 //    NXLLog(heightFloat)
     return heightFloat/2
 }
+
+/// url字符串转字典
+///
+/// - Parameter urlString: urlString字符串
+/// - Returns: [String: Any]
+public func urlStringtoParams(_ urlString:String) -> [String: Any] {
+    // 1 保存参数
+    var url_array = [""]
+    // 2 内容中是否存在?或者//
+    if urlString.contains("?") {
+        url_array = urlString.components(separatedBy:"?")
+    }else{
+        url_array = urlString.components(separatedBy: "//")
+    }
+    // 3 多个参数,分割参数
+    let urlComponents = url_array[1].components(separatedBy: "&")
+    // 4 保存返回值
+    var params = [String: Any]()
+    // 5 遍历参数
+    for keyValuePair in urlComponents {
+        // 5.1 分割参数 生成Key/Value
+        let pairComponents = keyValuePair.components(separatedBy:"=")
+        // 5.2 获取数组首元素作为key
+        let key = pairComponents.first?.removingPercentEncoding
+        // 5.3 获取数组末元素作为value
+        let value = pairComponents.last?.removingPercentEncoding
+        // 5.4 判断参数是否是数组
+        if let key = key, let value = value {
+            // 5.5 已存在的值,生成数组
+            if let existValue = params[key] {
+                // 5.8 如果是已经生成的数组
+                if var existValue = existValue as? [Any] {
+                    // 5.9 把新的值添加到已经生成的数组中去
+                    existValue.append(value)
+                    params[key] = existValue
+                } else {
+                    // 5.7 已存在的值,先将他生成数组
+                    params[key] = [existValue, value]
+                }
+            } else {
+                // 5.6 参数是非数组
+                params[key] = value
+            }
+        }
+    }
+    return params
+}

+ 30 - 0
RainbowPlanet/RainbowPlanet/Model/OpenAppModel/OpenAppModel.swift

@@ -0,0 +1,30 @@
+//
+//	OpenAppModel.swift
+//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport
+
+import Foundation 
+import ObjectMapper
+
+
+class OpenAppModel : NSObject, Mappable{
+
+	var postId : String?
+	var postType : String?
+	var type : String?
+
+
+	class func newInstance(map: Map) -> Mappable?{
+		return OpenAppModel()
+	}
+	required init?(map: Map){}
+	private override init(){}
+
+	func mapping(map: Map)
+	{
+		postId <- map["post_id"]
+		postType <- map["post_type"]
+		type <- map["type"]
+		
+	}
+
+}

+ 3 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/AllCommentCell/RecommendMajorCommentCell.swift

@@ -195,7 +195,9 @@ extension RecommendMajorCommentCell: UITableViewDataSource, UITableViewDelegate
     }
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
-        
+        let vc = CommunitySubCommentController()
+        vc.communityPostCommentModel = communityPostCommentModel
+        findViewController()?.navigationController?.pushViewController(vc, animated: true)
     }
     
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/RecommendDetailContentCell.swift → RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityRecommendDetail/View/imageCell/RecommendDetailContentCell.swift


+ 0 - 103
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunitySubCommentController.swift

@@ -1,103 +0,0 @@
-//
-//  CommunitySubCommentController.swift
-//  RainbowPlanet
-//
-//  Created by Christopher on 2019/6/12.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-
-class CommunitySubCommentController: BaseViewController {
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        setupViews()
-        setupLayouts()
-    }
-    
-    override func viewWillAppear(_ animated: Bool) {
-        cmtKeyboard.isDisappear = false
-    }
-    
-    override func viewWillDisappear(_ animated: Bool) {
-        cmtKeyboard.isDisappear = true
-    }
-    
-    override func setupViews() {
-        navigationBar.title = "3条评论"
-        view.backgroundColor = kf7f8faColor
-        
-        view.addSubview(tableView)
-        view.addSubview(cmtKeyboard)
-    }
-    
-    override func setupLayouts() {
-        tableView.snp.makeConstraints { (make) in
-            make.top.equalToSuperview().offset(kNavBarTotalHeight)
-            make.left.right.bottom.equalTo(0)
-        }
-    }
-    
-    override func setupData() {
-        
-    }
-    
-    lazy var tableView: UITableView = {
-        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
-        tableView.separatorStyle = .none
-        tableView.backgroundColor = kf7f8faColor
-        tableView.dataSource = self
-        tableView.delegate = self
-        tableView.estimatedRowHeight = 60
-        tableView.estimatedSectionFooterHeight = 0.000001
-        tableView.estimatedSectionHeaderHeight = 0.000001
-        return tableView
-    }()
-    
-    lazy var cmtKeyboard: LXKeyBoard = {
-        let cmtKeyboard = LXKeyBoard.init()
-        cmtKeyboard.backgroundColor = kffffffColor
-        cmtKeyboard.maxLine = 3
-        cmtKeyboard.font = kRegularFont14
-        cmtKeyboard.topOrBottomEdge = 10
-        cmtKeyboard.beginUpdateUI()
-        cmtKeyboard.sendBlock = {
-            [weak self] (text) in
-            print("----\(text)")
-        }
-        
-        return cmtKeyboard
-    }()
-}
-
-// MARK: - tableView dataSource && delegate
-extension CommunitySubCommentController: UITableViewDataSource, UITableViewDelegate {
-    
-    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
-    }
-    
-}

+ 34 - 16
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunityMajorCommentCell.swift

@@ -7,9 +7,11 @@
 //  主评论のCell
 
 import UIKit
-
+import RxSwift
 class CommunityMajorCommentCell: UITableViewCell {
     
+    let disposeBag = DisposeBag()
+    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommunityMajorCommentCell {
         let ID = "CommunityMajorCommentCell"
         tableView.register(CommunityMajorCommentCell.self, forCellReuseIdentifier: ID)
@@ -39,47 +41,51 @@ class CommunityMajorCommentCell: UITableViewCell {
         self.selectionStyle = .none
         backgroundColor = kffffffColor
         
-        addSubview(iconImageView)
+        addSubview(iconButton)
         addSubview(titleLabel)
         addSubview(contentLabel)
         addSubview(timeLabel)
     }
     
     private func setupLayouts() {
-        iconImageView.snp.makeConstraints { (make) in
+        iconButton.snp.makeConstraints { (make) in
             make.top.equalTo(20)
             make.left.equalTo(14)
             make.size.equalTo(24)
         }
         titleLabel.snp.makeConstraints { (make) in
-            make.left.equalTo(iconImageView.snp_right).offset(10)
+            make.left.equalTo(iconButton.snp_right).offset(10)
             make.right.equalToSuperview().offset(-26)
-            make.centerY.equalTo(iconImageView)
+            make.centerY.equalTo(iconButton)
             make.height.equalTo(17)
         }
+        
         contentLabel.snp.makeConstraints { (make) in
-            make.top.equalTo(titleLabel.snp_bottom).offset(12)
-            make.left.equalTo(titleLabel.snp_left)
-            make.right.equalToSuperview().offset(-26)
+            make.top.equalTo(iconButton.snp_bottom).offset(6)
+            make.left.equalTo(48)
+            make.right.equalToSuperview().offset(-14)
         }
         timeLabel.snp.makeConstraints { (make) in
             make.top.equalTo(contentLabel.snp_bottom).offset(8)
             make.left.equalTo(titleLabel.snp_left)
             make.right.equalTo(contentLabel.snp_right)
             make.height.equalTo(15)
-            make.bottom.equalToSuperview().offset(-20)
         }
     }
     
-    lazy var iconImageView : UIImageView = {
-        let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "page05")
-        return iconImageView
+    private lazy var iconButton : UIButton = {
+        let iconButton = UIButton(type: UIButton.ButtonType.custom)
+        iconButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
+        iconButton.cornerRadius = 12
+        iconButton.masksToBounds = true
+        iconButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+            
+        }).disposed(by: disposeBag)
+        return iconButton
     }()
     
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
-        titleLabel.text = "张吃饭"
         titleLabel.textColor = k999999Color
         titleLabel.font = kRegularFont14
         titleLabel.textAlignment = .left
@@ -88,7 +94,6 @@ class CommunityMajorCommentCell: UITableViewCell {
     
     private lazy var contentLabel: UILabel = {
         let contentLabel = UILabel()
-        contentLabel.text = "点击单条评时弹出选择操作框(目前仅支持回复),点击操作框后进行相应的操作"
         contentLabel.textColor = k333333Color
         contentLabel.font = kRegularFont14
         contentLabel.textAlignment = .left
@@ -98,11 +103,24 @@ class CommunityMajorCommentCell: UITableViewCell {
     
     private lazy var timeLabel: UILabel = {
         let timeLabel = UILabel()
-        timeLabel.text = "6个小时前"
         timeLabel.textColor = kbbbbbbColor
         timeLabel.font = kRegularFont12
         timeLabel.textAlignment = .left
         return timeLabel
     }()
     
+    var communityPostCommentModel : CommunityPostCommentModel? {
+        didSet {
+            iconButton.kf.setImage(with: kURLImage(name: communityPostCommentModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
+            titleLabel.text = communityPostCommentModel?.username
+            contentLabel.text = communityPostCommentModel?.content
+            timeLabel.text = communityPostCommentModel?.createdAt
+            let contentLabelHeight = communityPostCommentModel?.content?.heightForComment(font: kRegularFont14!, width: kScreenWidth - 14 - 48)
+            let subViewHeight = 24.0 + (contentLabelHeight ?? 0) + 15.0
+            let spacHeight = 20 + 6.0 + 8.0 + 20.0
+            communityPostCommentModel?.height = CGFloat(subViewHeight) + CGFloat(spacHeight)
+        }
+    }
+    
+    
 }

+ 49 - 18
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/CommunityReplyCommentCell.swift

@@ -7,9 +7,12 @@
 //  二级评论--评论回复のCell
 
 import UIKit
+import RxSwift
 
 class CommunityReplyCommentCell: UITableViewCell {
     
+    let disposeBag = DisposeBag()
+    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommunityReplyCommentCell {
         let ID = "CommunityReplyCommentCell"
         tableView.register(CommunityReplyCommentCell.self, forCellReuseIdentifier: ID)
@@ -37,58 +40,62 @@ class CommunityReplyCommentCell: UITableViewCell {
     //MRAK: - 设置View
     private func setupViews() {
         self.selectionStyle = .none
+        
         backgroundColor = kf7f8faColor
         
-        addSubview(iconImageView)
+        addSubview(iconButton)
         addSubview(titleLabel)
         addSubview(contentLabel)
         addSubview(timeLabel)
     }
     
     private func setupLayouts() {
-        iconImageView.snp.makeConstraints { (make) in
-            make.top.equalTo(10)
+        iconButton.snp.makeConstraints { (make) in
+            make.top.equalTo(0)
             make.left.equalTo(24)
             make.size.equalTo(24)
         }
         titleLabel.snp.makeConstraints { (make) in
-            make.left.equalTo(iconImageView.snp_right).offset(10)
-            make.right.equalToSuperview().offset(-26)
-            make.centerY.equalTo(iconImageView)
+            make.left.equalTo(iconButton.snp_right).offset(10)
+            make.right.equalToSuperview().offset(-10)
+            make.centerY.equalTo(iconButton)
             make.height.equalTo(17)
         }
         contentLabel.snp.makeConstraints { (make) in
             make.top.equalTo(titleLabel.snp_bottom).offset(12)
             make.left.equalTo(titleLabel.snp_left)
-            make.right.equalToSuperview().offset(-26)
+            make.right.equalToSuperview().offset(-10)
+            make.width.equalTo(kScreenWidth-62-54)
         }
         timeLabel.snp.makeConstraints { (make) in
             make.top.equalTo(contentLabel.snp_bottom).offset(8)
             make.left.equalTo(titleLabel.snp_left)
             make.right.equalTo(contentLabel.snp_right)
             make.height.equalTo(15)
-            make.bottom.equalToSuperview()
         }
     }
     
-    lazy var iconImageView : UIImageView = {
-        let iconImageView = UIImageView()
-        iconImageView.image = kImage(name: "page05")
-        return iconImageView
+    private lazy var iconButton : UIButton = {
+        let iconButton = UIButton(type: UIButton.ButtonType.custom)
+        iconButton.setImage(kImage(name: "default_avatar"), for: UIControl.State.normal)
+        iconButton.cornerRadius = 12
+        iconButton.masksToBounds = true
+        iconButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+            
+        }).disposed(by: disposeBag)
+        return iconButton
     }()
     
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
-        titleLabel.text = "Monster"
         titleLabel.textColor = k999999Color
         titleLabel.font = kRegularFont14
         titleLabel.textAlignment = .left
         return titleLabel
     }()
     
-    private lazy var contentLabel: UILabel = {
-        let contentLabel = UILabel()
-        contentLabel.text = "我也觉得好看"
+    private lazy var contentLabel: FMLinkLabel = {
+        let contentLabel = FMLinkLabel()
         contentLabel.textColor = k333333Color
         contentLabel.font = kRegularFont14
         contentLabel.textAlignment = .left
@@ -96,13 +103,37 @@ class CommunityReplyCommentCell: UITableViewCell {
         return contentLabel
     }()
     
-    private lazy var timeLabel: UILabel = {
+    lazy var timeLabel: UILabel = {
         let timeLabel = UILabel()
-        timeLabel.text = "6个小时前"
         timeLabel.textColor = kbbbbbbColor
         timeLabel.font = kRegularFont12
         timeLabel.textAlignment = .left
         return timeLabel
     }()
     
+    var communityPostReplyModel: CommunityPostReplyModel? {
+        didSet {
+            iconButton.kf.setImage(with: kURLImage(name: communityPostReplyModel?.avatar ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "default_avatar"))
+            
+            titleLabel.text = communityPostReplyModel?.username
+            
+            let replyUsername = "回复 @\(communityPostReplyModel?.replyUsername ?? ""):"
+            let content = "\(communityPostReplyModel?.content ?? "")"
+            if communityPostReplyModel?.replyUsername != "" && communityPostReplyModel?.replyUsername != nil  {
+                contentLabel.text =  replyUsername + content
+                contentLabel.addClickText("@\(communityPostReplyModel?.replyUsername ?? "")", attributeds: [NSAttributedString.Key.font:kMediumFont14 as Any], transmitBody: nil) {
+                    (data) in
+                }
+            }else {
+                contentLabel.text = content
+            }
+            
+            timeLabel.text = communityPostReplyModel?.createdAt
+            let contentLabelHeight = contentLabel.text?.heightForComment(font: kRegularFont14!, width: kScreenWidth - 58 - 14)
+            let subViewHeight = 24.0 + (contentLabelHeight ?? 0) + 15.0
+            let spacHeight = 10.0 + 8.0 + 8.0
+            communityPostReplyModel?.height = CGFloat(subViewHeight) + CGFloat(spacHeight)
+        }
+    }
+    
 }

+ 176 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunitySubComment/ViewController/CommunitySubCommentController.swift

@@ -0,0 +1,176 @@
+//
+//  CommunitySubCommentController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/12.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class CommunitySubCommentController: BaseViewController {
+    
+    var communityPostCommentModel : CommunityPostCommentModel?
+    var communityPostReplyModels = Array<CommunityPostReplyModel>()
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        setupViews()
+        setupLayouts()
+        setupData()
+    }
+    
+    override func viewWillAppear(_ animated: Bool) {
+        cmtKeyboard.isDisappear = false
+    }
+    
+    override func viewWillDisappear(_ animated: Bool) {
+        cmtKeyboard.isDisappear = true
+    }
+    
+    override func setupViews() {
+        navigationBar.title = "3条评论"
+        view.backgroundColor = kf7f8faColor
+        
+        view.addSubview(tableView)
+        view.addSubview(cmtKeyboard)
+    }
+    
+    override func setupLayouts() {
+        tableView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview().offset(kNavBarTotalHeight)
+            make.left.right.bottom.equalTo(0)
+        }
+    }
+    
+    lazy var tableView: UITableView = {
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
+        tableView.separatorStyle = .none
+        tableView.backgroundColor = kf7f8faColor
+        tableView.dataSource = self
+        tableView.delegate = self
+        tableView.estimatedRowHeight = 0
+        tableView.estimatedSectionFooterHeight = 0
+        tableView.estimatedSectionHeaderHeight = 0
+        return tableView
+    }()
+    
+    lazy var cmtKeyboard: LXKeyBoard = {
+        let cmtKeyboard = LXKeyBoard.init()
+        cmtKeyboard.backgroundColor = kffffffColor
+        cmtKeyboard.maxLine = 3
+        cmtKeyboard.font = kRegularFont14
+        cmtKeyboard.topOrBottomEdge = 10
+        cmtKeyboard.beginUpdateUI()
+        cmtKeyboard.sendBlock = {
+            [weak self] (text) in
+            print("----\(text)")
+        }
+        
+        return cmtKeyboard
+    }()
+    
+    override func setupData() {
+        tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
+            self?.communityPostReplyApi(page: page)
+        }
+        tableView.addFooterWithWithHeader(withAutomaticallyRefresh: false) {
+            [weak self] (page) in
+            self?.communityPostReplyApi(page: page)
+        }
+    }
+}
+
+extension CommunitySubCommentController {
+    
+    /// 获取子评论
+    ///
+    /// - Parameter page: 分页
+    func communityPostReplyApi(page:Int) {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityPostReplyApi(postId: communityPostCommentModel?.id ?? 0, page: page) { [weak self] (communityPostReplysModel) -> (Void) in
+            let communityPostReplysModel = communityPostReplysModel as? CommunityPostReplysModel
+            if communityPostReplysModel?.pagination?.currentPage ?? 1  <= communityPostReplysModel?.pagination?.totalPages ?? 1 {
+                if communityPostReplysModel?.pagination?.currentPage == 1{
+                    self?.communityPostReplyModels.removeAll()
+                }
+                self?.communityPostReplyModels = (self?.communityPostReplyModels)! + (communityPostReplysModel?.data!)!
+                self?.tableView.reloadData()
+                if  self?.communityPostReplyModels.count ?? 0 >= communityPostReplysModel?.pagination?.total ?? 0 {
+                    self?.tableView.endFooterNoMoreData()
+                }
+            }else {
+                self?.tableView.endFooterNoMoreData()
+            }
+        }
+    }
+}
+
+// MARK: - tableView dataSource && delegate
+extension CommunitySubCommentController: UITableViewDataSource, UITableViewDelegate {
+    
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 2
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        switch section {
+        case 0:
+            if communityPostCommentModel != nil {
+                return 1
+            }else {
+                return 0
+            }
+        default:
+            return communityPostReplyModels.isEmpty ? 0 : communityPostReplyModels.count
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        
+        switch indexPath.section {
+        case 0:
+            let cell = CommunityMajorCommentCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.communityPostCommentModel = communityPostCommentModel
+            return cell
+        default:
+            let cell = CommunityReplyCommentCell.cellWith(tableView: tableView, indexPath: indexPath)
+            cell.communityPostReplyModel = communityPostReplyModels[indexPath.row]
+            return cell
+        }
+        
+    }
+    
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+       
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        switch indexPath.section {
+        case 0:
+            return communityPostCommentModel?.height ?? 0
+        default:
+            return communityPostReplyModels[indexPath.row].height ?? 0
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 10
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return UIView()
+        
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0.000001
+        
+    }
+    
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return UIView()
+    }
+    
+}
+
+

+ 34 - 0
RainbowPlanet/RainbowPlanet/Router/CommunityRouterModuleType.swift

@@ -0,0 +1,34 @@
+//
+//  CommunityRouterModuleType.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/5.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import SwiftyMediator
+
+/// 社区模块的
+///
+/// - pushPostDetailContent: 跳转帖子内容
+/// - pushPostDetailVoide: 跳转视频内容
+public enum CommunityRouterModuleType: MediatorTargetType {
+    case pushPostDetailContent(postId: String)
+    case pushPostDetailVoide(postId: String)
+}
+
+extension CommunityRouterModuleType: MediatorSourceType {
+    public var viewController: UIViewController? {
+        switch self {
+        case .pushPostDetailContent(let postId):
+            let vc = CommunityRecommendController()
+            vc.id = Int(postId) ?? 0
+            return vc
+        case .pushPostDetailVoide(let postId):
+            let vc = CommunityVideoListController()
+            vc.contentId = Int(postId) ?? 0
+            return vc
+        }
+    }
+}

+ 43 - 0
RainbowPlanet/RainbowPlanet/Router/RouterManager.swift

@@ -0,0 +1,43 @@
+//
+//  RouterManner.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/5.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import SwiftyMediator
+
+
+
+
+class RouterManager: NSObject {
+    static let shared : RouterManager = RouterManager()
+    
+    /// 打开App
+    ///
+    /// - Parameter url:
+    /// - Returns:
+    func handleOpen(url:URL) -> Bool {
+        
+        if url.host == "home" { //社区
+            let dict = urlStringtoParams(url.absoluteString)
+            let openAppModel = OpenAppModel(JSON: dict)
+            if openAppModel?.postId != nil {
+                switch PostType(rawValue: openAppModel?.postType ?? "image") {
+                case .image?,.html?:
+                    Mediator.push(CommunityRouterModuleType.pushPostDetailContent(postId: openAppModel?.postId ?? "0"))
+                    break
+                case .video?:
+                    Mediator.push(CommunityRouterModuleType.pushPostDetailVoide(postId: openAppModel?.postId ?? "0"))
+                    break
+                default:
+                    break
+                }
+            }
+            return true
+        }
+        return false
+    }
+}

+ 1 - 1
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift

@@ -79,7 +79,7 @@ public let kCommunityPostCommentApi = "/community/post/comment"
 
 // MARK: - 回复列表
 /// 回复列表
-public let kCommunityPostReplyApi = "community/post/reply"
+public let kCommunityPostReplyApi = "/community/post/reply"
 
 
 

+ 49 - 52
RainbowPlanet/RainbowPlanet/Tools/CommentKeyboard/LXKeyBoard.m

@@ -54,6 +54,7 @@
         self.font = Font(14);
         self.maxLine = 3;
         
+        
     }
     return self;
 }
@@ -78,7 +79,7 @@
 
 -(void)beginUpdateUI{
     //初始化高度 textView的lineHeight + 2 * 上下间距
-    CGFloat orignTextH  = 28 + 2 * self.topOrBottomEdge;
+    CGFloat orignTextH  = 28 + 2 * self.topOrBottomEdge + 34;
     
     self.frame = CGRectMake(0, Device_Height - orignTextH, Device_Width, orignTextH);
     
@@ -96,39 +97,39 @@
         }
     }];
 }
--(void)textViewDidChange:(UITextView *)textView{
-    
-    CGFloat contentSizeH = self.textView.contentSize.height;
-    CGFloat lineH = self.textView.font.lineHeight;
-    
-    CGFloat maxHeight = ceil(lineH * self.maxLine + textView.textContainerInset.top + textView.textContainerInset.bottom);
-    if (contentSizeH <= maxHeight) {
-        self.textView.lx_height = contentSizeH;
-    }else{
-        self.textView.lx_height = maxHeight;
-    }
-    
-    [textView scrollRangeToVisible:NSMakeRange(textView.selectedRange.location, 1)];
-    
-    
-    CGFloat totalH = ceil(self.textView.lx_height) + 2 * self.topOrBottomEdge;
-    self.frame = CGRectMake(0, keyboardY - totalH, self.lx_width, totalH);
-    
-    
-    if (self.lx_height-38 < 10) {
-        self.sendBtn.lx_y = 10;
-    } else {
-        self.sendBtn.lx_y = self.lx_height-38;
-    }
-    
-    
-    if (textView.text.length > 0) {
-        _sendBtn.backgroundColor = [UIColor hexStringToColor:@"62cc74"];
-    } else {
-        _sendBtn.backgroundColor = [UIColor hexStringToColor:@"d8d8d8"];
-    }
-    
-}
+//-(void)textViewDidChange:(UITextView *)textView{
+//
+//    CGFloat contentSizeH = self.textView.contentSize.height;
+//    CGFloat lineH = self.textView.font.lineHeight;
+//
+//    CGFloat maxHeight = ceil(lineH * self.maxLine + textView.textContainerInset.top + textView.textContainerInset.bottom);
+//    if (contentSizeH <= maxHeight) {
+//        self.textView.lx_height = contentSizeH;
+//    }else{
+//        self.textView.lx_height = maxHeight;
+//    }
+//
+//    [textView scrollRangeToVisible:NSMakeRange(textView.selectedRange.location, 1)];
+//
+//
+//    CGFloat totalH = ceil(self.textView.lx_height) + 2 * self.topOrBottomEdge;
+//    self.frame = CGRectMake(0, keyboardY - totalH, self.lx_width, totalH);
+//
+//
+//    if (self.lx_height-38 < 10) {
+//        self.sendBtn.lx_y = 10;
+//    } else {
+//        self.sendBtn.lx_y = self.lx_height-38;
+//    }
+//
+//
+//    if (textView.text.length > 0) {
+//        _sendBtn.backgroundColor = [UIColor hexStringToColor:@"62cc74"];
+//    } else {
+//        _sendBtn.backgroundColor = [UIColor hexStringToColor:@"d8d8d8"];
+//    }
+//
+//}
 -(void)keyboardWillChangeFrame:(NSNotification *)notification{
     
     NSDictionary *userInfo = notification.userInfo;
@@ -140,13 +141,7 @@
     //        NSLog(@"%@",NSStringFromCGRect(keyboardF));
     keyboardY = keyboardF.origin.y;
     
-    if (!_isDisappear) {
-        
-        [self dealKeyBoardWithKeyboardF:keyboardY duration:duration];
-        
-    }
-    
-    
+    [self dealKeyBoardWithKeyboardF:keyboardY duration:duration];
 }
 
 -(void)keyboardDidChangeFrame:(NSNotification *)notification{
@@ -160,9 +155,7 @@
     
     keyboardY = keyboardF.origin.y;
     //    // 工具条的Y值 == 键盘的Y值 - 工具条的高度
-    if (_isDisappear) {
-        [self dealKeyBoardWithKeyboardF:keyboardY duration:duration];
-    }
+    [self dealKeyBoardWithKeyboardF:keyboardY duration:duration];
     
 }
 #pragma mark---处理高度---
@@ -173,19 +166,23 @@
             // 工具条的Y值 == 键盘的Y值 - 工具条的高度
             
             if (keyboardY > Device_Height) {
-                self.lx_y = Device_Height- self.lx_height;
+                self.lx_y = Device_Height - self.lx_height;
             }else
             {
                 self.lx_y = keyboardY - self.lx_height;
             }
         }];
     }else{
-        if (keyboardY > Device_Height) {
-            self.lx_y = Device_Height- self.lx_height;
-        }else
-        {
-            self.lx_y = keyboardY - self.lx_height;
-        }
+        [UIView animateWithDuration:duration animations:^{
+            // 工具条的Y值 == 键盘的Y值 - 工具条的高度
+            
+            if (keyboardY > Device_Height) {
+                self.lx_y = Device_Height- self.lx_height;
+            }else
+            {
+                self.lx_y = keyboardY - self.lx_height;
+            }
+        }];
     }
     
     
@@ -223,7 +220,7 @@
         _textView =[[LXTextView alloc]initWithFrame:CGRectMake(14, self.topOrBottomEdge, self.lx_width-89-14, 28)];
         _textView.backgroundColor = [UIColor hexStringToColor:@"fafafa"];
         _textView.font = self.font;
-        _textView.delegate = self;
+//        _textView.delegate = self;
         _textView.layoutManager.allowsNonContiguousLayout = NO;
         _textView.enablesReturnKeyAutomatically = YES;
         _textView.scrollsToTop = NO;