Bladeren bron

no message

南鑫林 5 jaren geleden
bovenliggende
commit
31b3074cd9

+ 1 - 1
RainbowPlanet/Podfile

@@ -63,7 +63,7 @@ target 'RainbowPlanet' do
   
   pod 'ESTabBarController-swift'
   # 内存泄露
-  pod 'MLeaksFinder'
+#  pod 'MLeaksFinder'
 
 
   #======================第三方平台===========

+ 1 - 9
RainbowPlanet/Podfile.lock

@@ -28,7 +28,6 @@ PODS:
   - EFQRCode (5.0.0):
     - swift_qrcodejs (~> 1.1.1)
   - ESTabBarController-swift (2.7)
-  - FBRetainCycleDetector (0.1.4)
   - FlickerNumber (1.1)
   - FMDB (2.7.5):
     - FMDB/standard (= 2.7.5)
@@ -46,8 +45,6 @@ PODS:
   - LYEmptyView (1.2.5)
   - MBProgressHUD (1.1.0)
   - MJRefresh (3.2.0)
-  - MLeaksFinder (1.0.0):
-    - FBRetainCycleDetector
   - Moya/Core (13.0.1):
     - Alamofire (~> 4.1)
     - Result (~> 4.1)
@@ -122,7 +119,6 @@ DEPENDENCIES:
   - LYEmptyView
   - MBProgressHUD
   - MJRefresh
-  - MLeaksFinder
   - Moya/RxSwift
   - ObjectMapper
   - pop
@@ -161,7 +157,6 @@ SPEC REPOS:
     - DPScrollNumberLabel
     - EFQRCode
     - ESTabBarController-swift
-    - FBRetainCycleDetector
     - FlickerNumber
     - FMDB
     - FSPagerView
@@ -176,7 +171,6 @@ SPEC REPOS:
     - LYEmptyView
     - MBProgressHUD
     - MJRefresh
-    - MLeaksFinder
     - Moya
     - ObjectMapper
     - pop
@@ -213,7 +207,6 @@ SPEC CHECKSUMS:
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
   EFQRCode: 07437cfbce3a1e497397a4f3d766c980d8972608
   ESTabBarController-swift: 4fb52ad03d94d0717ef97bc9eb09a5abfdded0a2
-  FBRetainCycleDetector: 46f8179bbb1c587deee3ea838a1a3ee02acf5015
   FlickerNumber: bce41da51904d533393d69e9734df6281ab1c646
   FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
   FSPagerView: 816a18842306973cc7cc6df8a5332272f7815c30
@@ -228,7 +221,6 @@ SPEC CHECKSUMS:
   LYEmptyView: b17adfc2dd9ad2988ecaf7c9606efa916e24c767
   MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
   MJRefresh: ed450d6eb9d3346a2cb033ab7eb6de090aeef437
-  MLeaksFinder: 8c435bd2f6d070af18cff082b503b21adc130fc0
   Moya: f4a4b80ff2f8a4ffc208dfb31cd91636622fee6e
   ObjectMapper: 70187b8941977c62ccfb423caf6b50be405cabf0
   pop: d582054913807fd11fd50bfe6a539d91c7e1a55a
@@ -252,6 +244,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 3e72005663525386830186d7b72455f4e5867eb5
+PODFILE CHECKSUM: dde03b8404ebfe7d3c71d9c71b566546a5a93c5c
 
 COCOAPODS: 1.7.4

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

@@ -40,6 +40,7 @@
 		A70B842E228F97EC00882BC5 /* ProcuctDetailSelectSkuTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B842D228F97EC00882BC5 /* ProcuctDetailSelectSkuTableViewCell.swift */; };
 		A70B8430228FF6D400882BC5 /* ProductCartCountModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B842F228FF6D400882BC5 /* ProductCartCountModel.swift */; };
 		A70B843422911AF600882BC5 /* ProductDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70B843322911AF600882BC5 /* ProductDetailView.swift */; };
+		A70DE55222E7E53F009E06BE /* KeyBoardInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70DE55122E7E53F009E06BE /* KeyBoardInputView.swift */; };
 		A70EBBC022561179000AD74F /* Extension+UITableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70EBBBF22561179000AD74F /* Extension+UITableView.swift */; };
 		A714348722DD9D4700132DA9 /* RedemptionAreaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A714348622DD9D4700132DA9 /* RedemptionAreaViewController.swift */; };
 		A714348C22DDA3E400132DA9 /* CMSRedemptionAreaModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A714348B22DDA3E300132DA9 /* CMSRedemptionAreaModel.swift */; };
@@ -110,7 +111,6 @@
 		A7284A75225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7284A74225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift */; };
 		A7284A7722547333000BAEC4 /* AlipayResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7284A7622547333000BAEC4 /* AlipayResultModel.swift */; };
 		A7297C6622D72FA4001A7AE6 /* KeyBoardCommentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */; };
-		A7297C6822D753C9001A7AE6 /* KeyBoardCommentTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7297C6722D753C9001A7AE6 /* KeyBoardCommentTextView.swift */; };
 		A729B5A82266F2E0004AE098 /* AlertSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A729B5A72266F2E0004AE098 /* AlertSheetView.swift */; };
 		A729B5AA2266F6FD004AE098 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A729B5A92266F6FD004AE098 /* Launch Screen.storyboard */; };
 		A729B5AD2266FF45004AE098 /* BindPhoneNumberView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A729B5AC2266FF45004AE098 /* BindPhoneNumberView.swift */; };
@@ -748,6 +748,7 @@
 		A70B842D228F97EC00882BC5 /* ProcuctDetailSelectSkuTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProcuctDetailSelectSkuTableViewCell.swift; sourceTree = "<group>"; };
 		A70B842F228FF6D400882BC5 /* ProductCartCountModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductCartCountModel.swift; sourceTree = "<group>"; };
 		A70B843322911AF600882BC5 /* ProductDetailView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductDetailView.swift; sourceTree = "<group>"; };
+		A70DE55122E7E53F009E06BE /* KeyBoardInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBoardInputView.swift; sourceTree = "<group>"; };
 		A70EBBBF22561179000AD74F /* Extension+UITableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UITableView.swift"; sourceTree = "<group>"; };
 		A714348622DD9D4700132DA9 /* RedemptionAreaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RedemptionAreaViewController.swift; sourceTree = "<group>"; };
 		A714348B22DDA3E300132DA9 /* CMSRedemptionAreaModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CMSRedemptionAreaModel.swift; sourceTree = "<group>"; };
@@ -821,7 +822,6 @@
 		A7284A74225465DD000BAEC4 /* SwiftMoyaNetWorkServicePay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServicePay.swift; sourceTree = "<group>"; };
 		A7284A7622547333000BAEC4 /* AlipayResultModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlipayResultModel.swift; sourceTree = "<group>"; };
 		A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBoardCommentView.swift; sourceTree = "<group>"; };
-		A7297C6722D753C9001A7AE6 /* KeyBoardCommentTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyBoardCommentTextView.swift; sourceTree = "<group>"; };
 		A729B5A72266F2E0004AE098 /* AlertSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertSheetView.swift; sourceTree = "<group>"; };
 		A729B5A92266F6FD004AE098 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
 		A729B5AC2266FF45004AE098 /* BindPhoneNumberView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindPhoneNumberView.swift; sourceTree = "<group>"; };
@@ -2237,7 +2237,7 @@
 			isa = PBXGroup;
 			children = (
 				A7297C6522D72FA4001A7AE6 /* KeyBoardCommentView.swift */,
-				A7297C6722D753C9001A7AE6 /* KeyBoardCommentTextView.swift */,
+				A70DE55122E7E53F009E06BE /* KeyBoardInputView.swift */,
 			);
 			path = KeyBoardCommentView;
 			sourceTree = "<group>";
@@ -6153,6 +6153,7 @@
 				BD13B6E222BA03BC008BB323 /* PublishTopicTypeCell.swift in Sources */,
 				BDE376D822C22A260055E2EA /* NSString+AlivcHelper.m in Sources */,
 				A72A726822321DBD00B21995 /* UMManager.swift in Sources */,
+				A70DE55222E7E53F009E06BE /* KeyBoardInputView.swift in Sources */,
 				A78CEE0A22E0864100C512A4 /* BaseLottieAnimateContentView.swift in Sources */,
 				A70B2C042283D06B00B2449F /* ProductFloorFullLeftHeaderCollectionReusableView.swift in Sources */,
 				BD108C9322A60C2100837DAB /* HGImageCompleteButton.swift in Sources */,
@@ -6178,7 +6179,6 @@
 				A7DF50DF22A5590200998908 /* BrowsePicturesViewController.swift in Sources */,
 				BD61229E22C3629800D3F513 /* AlivcAppServer.m in Sources */,
 				A77F2CB92232010F001BD3F6 /* ShoppingCartViewController.swift in Sources */,
-				A7297C6822D753C9001A7AE6 /* KeyBoardCommentTextView.swift in Sources */,
 				BD13B6C122BA034D008BB323 /* PublishEditAddPicCell.swift in Sources */,
 				A72A72B822321DE000B21995 /* Extension+UserDefaults.swift in Sources */,
 				A719016B22757A5A00104A50 /* ProvinceCityAreaTableViewCell.swift in Sources */,

+ 1 - 0
RainbowPlanet/RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h

@@ -35,6 +35,7 @@
 #import "YYLabel.h"
 
 #import "FMDB.h"
+#import "POP.h"
 
 //友盟
 #import <UMCommon/UMCommon.h>

+ 1 - 1
RainbowPlanet/RainbowPlanet/Model/WVJBModel/WVJBModel.swift

@@ -120,7 +120,7 @@ class WVJBParamsModel:NSObject,Mappable {
         content <- map["content"]
         uid <- map["uid"]
         status <- map["status"]
-        list <- map["current"]
+        list <- map["list"]
         current <- map["current"]
     }
 

+ 7 - 6
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoCollectionViewLayout.swift

@@ -53,12 +53,13 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
         if cardContentPicVideoModel?.postType == .image || cardContentPicVideoModel?.postType == .html { //图片
             switch cardContentPicVideoModel?.number {
             case 1:
-                if cardContentPicVideoModel?.width ?? 0 < cardContentPicVideoModel?.height ?? 0 { //图片宽度小于图片高度
+                if cardContentPicVideoModel?.width ?? 0 < cardContentPicVideoModel?.height ?? 0 {
+                    let scale = (cardContentPicVideoModel?.width ?? 0) / (cardContentPicVideoModel?.height ?? 0)
+                    //图片宽度小于图片高度
                     if (cardContentPicVideoModel?.height ?? 0) / (cardContentPicVideoModel?.width ?? 0) > 2 {
-                        return CGRect(x: 0, y: 0, width: (cardContentPicVideoModel?.width ?? 0) * kScaleWidth, height: 347 * kScaleWidth)
-
+                        
+                        return CGRect(x: 0, y: 0, width: (347 * kScaleWidth) * scale, height: 347 * kScaleWidth)
                     }else {
-                        let scale = (cardContentPicVideoModel?.width ?? 0) / (cardContentPicVideoModel?.height ?? 0)
                         return CGRect(x: 0, y: 0, width: (280 * kScaleWidth) * scale, height: 280 * kScaleWidth)
                     }
                 }else if cardContentPicVideoModel?.width ?? 0 == cardContentPicVideoModel?.height ?? 0 { //图片宽度等于图片高度
@@ -77,7 +78,7 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
                     }
                 }
             case 2:
-                return CGRect(x: (CGFloat(indexPath.row) * 173.5 * kScaleWidth) + (CGFloat(indexPath.row) * spacing), y: 0, width: 173.5 * kScaleWidth, height: (kScreenWidth - 29) / 3)
+                return CGRect(x: (CGFloat(indexPath.row) * 173.5 * kScaleWidth) + (CGFloat(indexPath.row) * spacing), y: 0, width: 173.5 * kScaleWidth, height: 173.5 * kScaleWidth)
             case 3:
                 return CGRect(x: (CGFloat(indexPath.row) * (kScreenWidth-30)/3) + (CGFloat(indexPath.row) * spacing), y: 0, width: (kScreenWidth-30)/3, height: (kScreenWidth-30)/3)
             case 4:
@@ -89,7 +90,7 @@ class CardContentPicVideoCollectionViewLayout: UICollectionViewLayout {
                 }
             case 5:
                 if indexPath.row < 2 {
-                    return CGRect(x: (CGFloat(indexPath.row) * (kScreenWidth - 29) / 2) + (CGFloat(indexPath.row) * spacing), y: 0, width: (kScreenWidth - 29) / 2, height: 115 * kScaleWidth)
+                    return CGRect(x: (CGFloat(indexPath.row) * (kScreenWidth - 29) / 2) + (CGFloat(indexPath.row) * spacing), y: 0, width: (kScreenWidth - 29) / 2, height: (kScreenWidth - 29) / 2)
                 }else {
                     return CGRect(x: (CGFloat(indexPath.row-2) * (kScreenWidth-30)/3) + (CGFloat(indexPath.row-2) * spacing), y: 115 * kScaleWidth + 1, width: (kScreenWidth-30)/3, height: (kScreenWidth-30)/3)
 

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/PicVideo/CardContentPicVideoModel.swift

@@ -36,13 +36,13 @@ class CardContentPicVideoModel: NSObject {
                     }
                 }
             case 2:
-                return (kScreenWidth - 29) / 3
+                return 173.5 * kScaleWidth
             case 3:
                 return (kScreenWidth-30)/3
             case 4:
                 return (kScreenWidth - 30) / 3 + 195 * kScaleWidth + 1
             case 5:
-                return 115 * kScaleWidth + (kScreenWidth-30)/3 + 1
+                return 173.5 * kScaleWidth + (kScreenWidth-30)/3 + 1
             case 6:
                 return (kScreenWidth - 30) / 3 * 2 + 1
             case 7:

+ 9 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -163,6 +163,15 @@ class CommunityFollowViewController: UIViewController {
                 self?.keyBoardCommentView?.dismisskeyBoardCommentView()
             })
         })
+//        KeyBoardInputView.show(inputViewResultClosure: {
+//            [weak self] (text) in
+//            self?.communityPostCommentApi(text: text, complete: {
+//                self?.communityFollowDataModel = nil
+//            })
+//        }, dismissClosure: {
+//            [weak self] in
+//            self?.communityFollowDataModel = nil
+//        })
     }
     /// 隐藏键盘
     func hiddenKeyBoardCommentView() {
@@ -426,7 +435,6 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
                 [weak self] in
                 self?.communityFollowDataModel = communityFollowDataModel
                 self?.showKeyBoardCommentView()
-                self?.hiddenKeyBoardCommentView()
             }
             return cell
         default:

+ 38 - 26
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMusicAbout/PublishRecordMusicView.swift

@@ -11,6 +11,8 @@ import FWPopupView
 import RxSwift
 import SwiftyMediator
 import JXSegmentedView
+import pop
+
 
 class PublishRecordMusicView: FWPopupView {
     
@@ -53,7 +55,7 @@ class PublishRecordMusicView: FWPopupView {
     }
     
     func setupViews() {
-        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
+//        frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
         
         // 添加毛玻璃效果,需使用frame设置位置
         let blurEffect = UIBlurEffect(style: .dark)
@@ -61,7 +63,7 @@ class PublishRecordMusicView: FWPopupView {
         blurEffectView.frame = CGRect(x: CGFloat(0), y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
         addSubview(blurEffectView)
         
-        self.backgroundColor = UIColor.clear
+        self.backgroundColor = UIColor.white
         
         configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
         
@@ -178,32 +180,42 @@ class PublishRecordMusicView: FWPopupView {
     
     /// 初始化View    
     @objc class func publishRecordMusicView(attachedView:UIView, curMusicUrl:String) -> PublishRecordMusicView {
-        let view = PublishRecordMusicView()
-        view.attachedView = attachedView
-        view.curMusicUrl = curMusicUrl
-        let vProperty = FWPopupViewProperty()
-        vProperty.popupCustomAlignment = .bottomCenter
-        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
-        vProperty.popupAnimationType = .frame
-        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
-        // 用户点击外部遮罩层页面是否可以消失
-        vProperty.touchWildToHide = "0"
-        view.vProperty = vProperty
-        view.show()
         
-        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
-            view.hide()
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
-            
-            MusicPlayManager.shared().destroyPlayer()
-            MusicPlayManager.shared().curPlayingId = -1
-            
-        }).disposed(by: view.disposeBag)
+        let view = PublishRecordMusicView(frame:CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenHeight - kSafeTabBarHeight - kSafeStatusBarHeight - 22)
+)
+//        let base = POPBasicAnimation(propertyNamed: kPOPLayerPositionY)
+//        base?.toValue = 88
+//        base?.beginTime = CFTimeInterval() + 1.0
+//        view.pop_add(base, forKey: "position.y")
+        attachedView.addSubview(view)
+        
         
-        view.recommendButton.rx.tap.subscribe(onNext: { (data) in
-            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
-            
-        }).disposed(by: view.disposeBag)
+//        let view = PublishRecordMusicView()
+//        view.attachedView = attachedView
+//        view.curMusicUrl = curMusicUrl
+//        let vProperty = FWPopupViewProperty()
+//        vProperty.popupCustomAlignment = .bottomCenter
+//        vProperty.popupViewEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+//        vProperty.popupAnimationType = .frame
+//        vProperty.maskViewColor = UIColor(white: 0, alpha: 0.2)
+//        // 用户点击外部遮罩层页面是否可以消失
+//        vProperty.touchWildToHide = "0"
+//        view.vProperty = vProperty
+//        view.show()
+//
+//        view.cancelButton.rx.tap.subscribe(onNext: { (data) in
+//            view.hide()
+//            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "RecordCloseMusicChooseViewNoti"), object: nil)
+//
+//            MusicPlayManager.shared().destroyPlayer()
+//            MusicPlayManager.shared().curPlayingId = -1
+//
+//        }).disposed(by: view.disposeBag)
+//
+//        view.recommendButton.rx.tap.subscribe(onNext: { (data) in
+//            Mediator.push(PublishRouterModuleType.pushMucisChooseView)
+//
+//        }).disposed(by: view.disposeBag)
         
         return view
     }

+ 0 - 20
RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardCommentTextView.swift

@@ -1,20 +0,0 @@
-//
-//  KeyBoardCommentTextView.swift
-//  RainbowPlanet
-//
-//  Created by 南鑫林 on 2019/7/11.
-//  Copyright © 2019 RainbowPlanet. All rights reserved.
-//
-
-import UIKit
-import IQKeyboardManagerSwift
-
-
-class KeyBoardCommentTextView: IQTextView {
-    override func caretRect(for position: UITextPosition) -> CGRect {
-        var originalRect = super.caretRect(for: position)
-        originalRect.size.height = self.font?.lineHeight ?? 21 + 2
-        originalRect.size.width = 1
-        return originalRect;
-    }
-}

+ 261 - 0
RainbowPlanet/RainbowPlanet/Tools/KeyBoardCommentView/KeyBoardInputView.swift

@@ -0,0 +1,261 @@
+//
+//  KeyBoardInputView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/7/24.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import IQKeyboardManagerSwift
+
+typealias InputViewResultClosure = (_ contentStr: String) -> Void
+
+typealias DismissClosure = () -> Void
+
+typealias InputAccessoryConfigeClosure = (_ inputConfiger: InputConfiger) -> Void
+
+class KeyBoardInputView: NSObject {
+    
+    deinit {
+        NXLLog("deinit")
+    }
+    
+    private var inputViewResultClosure : InputViewResultClosure!
+    private var dismissClosure : DismissClosure!
+    
+    private var inputView : IQTextView!
+    private var btnSave : UIButton!
+    private var toolbar : UIView!
+    
+    private var assistDismissButton : UIButton!
+    private var assistInputView : UITextField!
+    
+    static let shared : KeyBoardInputView = KeyBoardInputView()
+    
+    class func dimiss() {
+        KeyBoardInputView.shared.dismiss()
+    }
+    
+    class func show(inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
+        KeyBoardInputView.shared.initInputView(inputConfiger: InputConfiger(), inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+    }
+    
+    class func show(KeyboardType:UIKeyboardType,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure)  {
+        let inputConfiger = InputConfiger()
+        inputConfiger.keyboardType = KeyboardType
+        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+
+    }
+    
+    class func show(KeyboardType:UIKeyboardType,content:String,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure)  {
+        let inputConfiger = InputConfiger()
+        inputConfiger.keyboardType = KeyboardType
+        inputConfiger.content = content
+        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+    }
+    
+    class func show(inputAccessoryConfigeClosure:@escaping InputAccessoryConfigeClosure,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
+
+        let inputConfiger = InputConfiger()
+        inputAccessoryConfigeClosure(inputConfiger)
+        KeyBoardInputView.shared.initInputView(inputConfiger: inputConfiger, inputViewResultClosure: inputViewResultClosure, dismissClosure: dismissClosure)
+    }
+    
+    private func initInputView(inputConfiger:InputConfiger,inputViewResultClosure:@escaping InputViewResultClosure,dismissClosure:@escaping DismissClosure) {
+        initView()
+        let window = kAppDelegate.window
+        self.assistDismissButton.frame = window!.bounds
+        self.assistDismissButton.autoresizingMask = UIView.AutoresizingMask(rawValue: UIView.AutoresizingMask.flexibleWidth.rawValue | UIView.AutoresizingMask.flexibleHeight.rawValue)
+        window?.addSubview(assistDismissButton)
+        
+        self.updateLayout(beigin: true)
+        
+        self.inputViewResultClosure = inputViewResultClosure
+        self.dismissClosure = dismissClosure
+        self.inputView.text = inputConfiger.content
+        self.assistInputView.text = inputConfiger.content
+        
+        self.inputView.keyboardType = inputConfiger.keyboardType;
+        self.inputView.placeholder = inputConfiger.placeholder
+        self.assistInputView.keyboardType = inputConfiger.keyboardType;
+        self.btnSave.isEnabled = false
+        self.assistDismissButton.isUserInteractionEnabled = inputConfiger.backgroundUserInterface
+        self.assistDismissButton.backgroundColor = inputConfiger.backgroundColor
+        
+        self.assistInputView.inputAccessoryView = toolbar
+        self.assistInputView.becomeFirstResponder()
+        
+        NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidShowNotification, object: nil, queue: nil) {[weak self] (notification) in
+            if ((self?.assistDismissButton?.window) != nil) && (self?.assistInputView.isFirstResponder)! {
+                self?.inputView.becomeFirstResponder()
+                self?.inputView.scrollRangeToVisible(NSRange(location: (self?.inputView.text.count)!, length: 1))
+            }
+        }
+        
+        //输入切换
+        NotificationCenter.default.addObserver(forName: UITextInputMode.currentInputModeDidChangeNotification, object: nil, queue: nil) {
+            [weak self] (notification) in
+            self?.assistInputView.resignFirstResponder()
+            self?.assistInputView.becomeFirstResponder()
+        }
+        
+        NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillHideNotification, object: nil, queue: nil) { [weak self] (notification) in
+            if (self?.inputView.isFirstResponder)! {
+                self?.dismiss()
+            }
+        }
+        
+        NotificationCenter.default.addObserver(forName: UIResponder.keyboardDidHideNotification, object: nil, queue: nil) { [weak self] (notification) in
+            self?.cleanInitView()
+        }
+        
+    }
+    
+    private func initView() {
+        
+        /// 背景button
+        let backgroundBtn = UIButton(type: UIButton.ButtonType.custom)
+        backgroundBtn.addTarget(self, action: #selector(dismiss), for: UIControl.Event.touchUpInside)
+
+        /// 工具bar
+        let toolbar = UIView()
+        toolbar.backgroundColor = UIColor.white
+        
+        
+        /// 输入框
+        let textView = IQTextView()
+        textView.returnKeyType = .done
+        textView.enablesReturnKeyAutomatically = true
+        textView.delegate = self
+        textView.font = kRegularFont14
+        textView.layer.borderColor = kf0f0f0Color.cgColor
+        textView.layer.borderWidth = 0.5/UIScreen.main.scale
+        textView.textContainerInset = UIEdgeInsets(top: 5.5, left: 15, bottom: 5.5, right: 15)
+//        textView.textContainer.lineFragmentPadding = 0
+        textView.cornerRadius = 14
+        textView.masksToBounds = true
+        textView.tintColor = kThemeColor
+        textView.backgroundColor = kfafafaColor
+        toolbar.addSubview(textView)
+        
+        let assistTxf = UITextField()
+        assistTxf.returnKeyType = .done
+        assistTxf.enablesReturnKeyAutomatically = true
+        backgroundBtn.addSubview(assistTxf)
+        
+        /// 确定
+        let saveBtn = UIButton(type: UIButton.ButtonType.custom)
+        saveBtn.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for: UIControl.State.normal)
+        saveBtn.setBackgroundImage(UIImage.imageWithColor(color: kd8d8d8Color), for: UIControl.State.disabled)
+        saveBtn.titleLabel?.font = kRegularFont14
+        saveBtn.setTitle("发布", for: UIControl.State.normal)
+        saveBtn.cornerRadius = 14
+        saveBtn.masksToBounds = true
+        saveBtn.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        saveBtn.addTarget(self, action: #selector(save), for: UIControl.Event.touchUpInside)
+        toolbar.addSubview(saveBtn)
+        
+        self.toolbar = toolbar
+        self.assistDismissButton = backgroundBtn
+        self.inputView = textView
+        self.assistInputView = assistTxf
+        self.btnSave = saveBtn
+        
+    }
+    
+    func updateLayout(beigin:Bool) {
+        let saveButtonWidth : CGFloat = 60
+        let edge : CGFloat = 10.0
+        
+        var height = max(48, inputView.contentSize.height + 17.5)
+        height = min(height, 100)
+        UIView.animate(withDuration: beigin ? 0 : 0.2) {
+            [weak self] in
+            self?.toolbar.frame = CGRect(x: 0, y: 48-height, width: kScreenWidth, height: height)
+            self?.toolbar.configRectCorner(corner: [.topLeft,.topRight], radii: CGSize(width: 8, height: 8))
+            self?.inputView.frame = CGRect(x: 14, y: edge, width: kScreenWidth - saveButtonWidth - 38.0, height: height - edge * 2)
+            self?.btnSave.frame = CGRect(x: kScreenWidth - saveButtonWidth - 14, y: height - 10 - 28 , width: saveButtonWidth, height: 28.0)
+            self?.assistInputView.inputAccessoryView = self?.toolbar
+        }
+    }
+    
+    @objc func dismiss() {
+        self.inputView.resignFirstResponder()
+        self.assistDismissButton.removeFromSuperview()
+        NotificationCenter.default.removeObserver(self)
+    }
+    
+    @objc func save() {
+        self.inputView.resignFirstResponder()
+        if self.btnSave.isEnabled {
+            if let inputViewResultClosure = self.inputViewResultClosure {
+                inputViewResultClosure(self.inputView.text ?? "")
+            }
+        }
+        self.dismiss()
+    }
+    
+    func cleanInitView() {
+        
+        if let dismissClosure = self.dismissClosure {
+            dismissClosure()
+        }
+        if self.toolbar != nil {
+            self.toolbar.removeFromSuperview()
+        }
+        if self.assistDismissButton != nil {
+            self.assistDismissButton.removeFromSuperview()
+        }
+        if self.inputView != nil {
+            self.inputView.removeFromSuperview()
+        }
+        if self.assistInputView != nil {
+            self.assistInputView.removeFromSuperview()
+        }
+        if self.btnSave != nil {
+            self.btnSave.removeFromSuperview()
+        }
+        self.toolbar = nil
+        self.assistDismissButton = nil
+        self.inputView = nil
+        self.assistInputView = nil
+        self.btnSave = nil
+        self.inputViewResultClosure = nil
+    }
+    
+}
+
+extension KeyBoardInputView : UITextViewDelegate {
+    func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
+        if text == "\n" {
+            self.save()
+            return false
+        }
+        return true
+    }
+    
+    func textViewDidChange(_ textView: UITextView) {
+        TextLimitTool.restrictionInputTextView(textView, maxNumber: 150)
+        self.updateLayout(beigin: false)
+        if textView.text.count > 0 {
+            self.btnSave.isEnabled = true
+        }else {
+            self.btnSave.isEnabled = false
+        }
+    }
+}
+
+class InputConfiger: NSObject {
+    
+    // default UIKeyboardTypeDefault
+    var keyboardType : UIKeyboardType = UIKeyboardType.default
+    // default nil
+    var content : String = ""
+    // default YES
+    var backgroundUserInterface : Bool = true
+    // default clearColor
+    var backgroundColor : UIColor = UIColor(white: 0, alpha: 0.5)
+    // default placeholder
+    var placeholder : String = "添加评论..."
+}

+ 1 - 1
RainbowPlanet/RainbowPlanet/ViewModel/Virus/VirusViewModel.swift

@@ -832,7 +832,7 @@ extension VirusViewModel {
         virueRecordAddParameterModel.postId = postId
         virueRecordAddParameterModel.actionId = "\(postId ?? 0)"
         if title == "" {
-            virueRecordAddParameterModel.postDesc = String(describing: content?.prefix(20))
+            virueRecordAddParameterModel.postDesc = "\(content?.prefix(20) ?? "")"
         }else {
             virueRecordAddParameterModel.postDesc = title
         }