瀏覽代碼

首页的优化

南鑫林 5 年之前
父節點
當前提交
35817550a9

+ 1 - 0
RainbowPlanet/Podfile

@@ -43,6 +43,7 @@ target 'RainbowPlanet' do
   pod 'FSPagerView'
   # 小红点
   pod 'PPBadgeViewSwift'
+  pod 'Bugly'
   # 动画效果
 #  pod 'pop'
   # pop动画

+ 5 - 1
RainbowPlanet/Podfile.lock

@@ -22,6 +22,7 @@ PODS:
   - AliyunVideoSDKPro (3.11.0)
   - BaiduMapKit (4.4.2)
   - BMKLocationKit (1.5.0)
+  - Bugly (2.5.0)
   - Cache (5.2.0)
   - DeviceKit (2.0.0)
   - DPScrollNumberLabel (0.0.2)
@@ -101,6 +102,7 @@ DEPENDENCIES:
   - AliyunVideoSDKPro
   - BaiduMapKit
   - BMKLocationKit (= 1.5.0)
+  - Bugly
   - Cache
   - DeviceKit
   - DPScrollNumberLabel
@@ -152,6 +154,7 @@ SPEC REPOS:
     - AliyunVideoSDKPro
     - BaiduMapKit
     - BMKLocationKit
+    - Bugly
     - Cache
     - DeviceKit
     - DPScrollNumberLabel
@@ -201,6 +204,7 @@ SPEC CHECKSUMS:
   AliyunVideoSDKPro: da710c1e7fb93b1e9a741b3619814c6608780b4b
   BaiduMapKit: 11acde2e7c06e31b7de60b323880a5eb7c4dccb6
   BMKLocationKit: 40d267478acd8704ddebd0e9deaddc727b13df9f
+  Bugly: 3ca9f255c01025582df26f9222893b383c7e4b4e
   Cache: 807c5d86d01a177f06ede9865add3aea269bbfd4
   DeviceKit: 72d36709552d4b3582abd76a53949148acad9811
   DPScrollNumberLabel: 5124eaccf3029bb84116de391e1273cba676f4f5
@@ -242,6 +246,6 @@ SPEC CHECKSUMS:
   YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
   ZipArchive: e25a4373192673e3229ac8d6e9f64a3e5713c966
 
-PODFILE CHECKSUM: 303e37a0f5325e4ee6f3473649c4d5da0f394ed9
+PODFILE CHECKSUM: fb8d10d0b68567b1425cddc55970c1cb93733003
 
 COCOAPODS: 1.7.4

+ 1 - 1
RainbowPlanet/RainbowPlanet/AppDelegate/AppDelegate+Window.swift

@@ -33,7 +33,7 @@ extension AppDelegate {
             /// 设置全局的TableView
             self?.setTableViewAppearance()
             /// 城市转换
-            self?.setBaiduToCityFactory()
+//            self?.setBaiduToCityFactory()
             /// 设置默认为快递
             let deliveryMethodTypeModel = DeliveryMethodTypeModel.shared()
             deliveryMethodTypeModel.deliveryMethodType = "2"

+ 2 - 0
RainbowPlanet/RainbowPlanet/Base/RootViewController/RootViewController.swift

@@ -50,6 +50,8 @@ class RootViewController: BaseViewController {
             BaiduMapManager.shared.startLocation()
             //初始化友盟
             UMManager.shared.initUM(launchOptions: self?.launchOptions)
+            // Bugly
+            Bugly.start(withAppId: "4e2f8cf865")
             //设置Tabbar
             kAppDelegate.setTabbarController()
             /// 引导页

+ 9 - 3
RainbowPlanet/RainbowPlanet/Macro/RainbowPlanet-Bridging-Header.h

@@ -63,6 +63,14 @@
 //只引入所需的单个头文件
 #import <BaiduMapAPI_Map/BMKMapView.h>
 
+// 阿里云短视频
+#import <AliyunVideoSDKPro/AliyunVideoSDKPro.h>
+// 阿里云一建登录
+#import "ATAuthSDK/ATAuthSDK.h"
+
+// bugly
+#import <Bugly/Bugly.h>
+
 
 //  KSMediaPicker所依靠的OC文件
 #import "KSMediaPickerCollectionView.h"
@@ -78,10 +86,8 @@
 #import "AVAsset+VideoInfo.h"
 #import "AliyunPathManager.h"
 
-#import <AliyunVideoSDKPro/AliyunVideoSDKPro.h>
 
-// 阿里云一建登录
-#import "ATAuthSDK/ATAuthSDK.h"
+
 
 
 #endif /* RainbowPlanet_Bridging_Header_h */

+ 39 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -24,6 +24,10 @@ class CommunityFollowViewController: BaseViewController {
     }
     weak var observe : NSObjectProtocol?
     
+    var lastContentOffset : CGFloat = 0
+    
+    var navigationBarIsHidden: Bool = false
+    
     var communityFollowDataModels : Array<CommunityFollowDataModel>?
     var communityFollowDataModel : CommunityFollowDataModel?
     /// 关注数组
@@ -722,6 +726,41 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
     }
 }
 
+extension CommunityFollowViewController {
+    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        //全局变量记录滑动前的contentOffset
+        lastContentOffset = scrollView.contentOffset.y;//判断上下滑动时
+    }
+    
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        
+        if scrollView.contentOffset.y > lastContentOffset {
+            //向上
+            if communityNavigationBarIsHidden == false && communityIndex != 2 {
+                NotificationCenter.default.post(name: NSNotification.Name("CommunityViewControllerScrollView"), object: true)
+
+                tableView.snp.updateConstraints { (make) in
+                    make.height.equalTo(kScreenHeight-48-kSafeStatusBarHeight-kTabBarTotalHeight)
+                }
+                self.view.layoutIfNeeded()
+                self.navigationBarIsHidden = true
+            }
+        } else if scrollView.contentOffset.y < lastContentOffset && communityIndex != 2 {
+            //向下
+            
+            if communityNavigationBarIsHidden {
+                NotificationCenter.default.post(name: NSNotification.Name("CommunityViewControllerScrollView"), object: false)
+                tableView.snp.updateConstraints { (make) in
+                    make.height.equalTo(kScreenHeight-48-kNavBarTotalHeight-kTabBarTotalHeight)
+                }
+                self.view.layoutIfNeeded()
+                communityNavigationBarIsHidden = false
+
+            }
+        }
+    }
+}
+
 extension CommunityFollowViewController : JXSegmentedListContainerViewListDelegate {
     func listView() -> UIView {
         return view

+ 57 - 14
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift

@@ -11,6 +11,10 @@ import JXSegmentedView
 import SwiftyMediator
 import Kingfisher
 
+var communityNavigationBarIsHidden: Bool = false
+
+var communityIndex: Int = 1
+
 enum CommunityModuleTopType : String {
     case communityModuleFollowTop = "CommunityModuleFollowTop"
     case communityModuleRecommendTop = "CommunityModuleRecommendTop"
@@ -51,35 +55,35 @@ class CommunityViewController: BaseViewController {
     }
     
     override func setupLayouts() {
-        
-        navigationBarbgView.snp.makeConstraints { (make) in
-            make.top.equalTo(kNavBarTotalHeight+48)
-            make.left.right.equalToSuperview()
-            make.height.equalTo(62)
-        }
-        
+
         communityNavigationBarView.snp.makeConstraints { (make) in
             make.top.equalTo(kSafeStatusBarHeight)
             make.left.right.equalToSuperview()
             make.height.equalTo(kNavBarHeight)
         }
-        
         segmentedView.snp.makeConstraints { (make) in
             make.left.equalToSuperview()
             make.right.equalToSuperview()
             make.height.equalTo(48)
             make.top.equalTo(kNavBarTotalHeight)
         }
-        
+
         listContainerView.snp.makeConstraints { (make) in
             make.top.equalTo(segmentedView.snp.bottom)
             make.left.right.bottom.equalToSuperview()
         }
+        
+        navigationBarbgView.snp.makeConstraints { (make) in
+            make.top.equalTo(segmentedView.snp.bottom)
+            make.left.right.equalToSuperview()
+            make.height.equalTo(62)
+        }
         linebgImageView.snp.makeConstraints { (make) in
             make.top.equalTo(segmentedView.snp.bottom)
             make.left.right.equalToSuperview()
             make.height.equalTo(20)
         }
+
     }
     
     override func setupData() {
@@ -199,6 +203,36 @@ class CommunityViewController: BaseViewController {
             
         }
         
+        // 滚动
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityViewControllerScrollView"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let navigationBarIsHidden = notification.object as? Bool
+            
+            if communityNavigationBarIsHidden { //隐藏
+                if !(navigationBarIsHidden!) {
+                    self?.communityNavigationBarView.snp.updateConstraints { (make) in
+                        make.top.equalTo(kSafeStatusBarHeight)
+                    }
+                    self?.segmentedView.snp.updateConstraints { (make) in
+                        make.top.equalTo(kNavBarTotalHeight)
+                    }
+                }
+            }else {
+                if (navigationBarIsHidden!) {
+                    self?.communityNavigationBarView.snp.updateConstraints { (make) in
+                        make.top.equalTo(-kNavBarTotalHeight)
+                    }
+                    self?.segmentedView.snp.updateConstraints { (make) in
+                        make.top.equalTo(kSafeStatusBarHeight)
+                    }
+                }
+            }
+            communityNavigationBarIsHidden = navigationBarIsHidden!
+            UIView.animate(withDuration: 0.5, animations: { [weak self] in
+                self?.view.layoutIfNeeded()
+                self?.listContainerView.layoutSubviews()
+            }) { (complete) in}
+        }
+        
     }
     
     // 分享
@@ -359,10 +393,6 @@ class CommunityViewController: BaseViewController {
     
     var index : Int?
     
-//    override func didReceiveMemoryWarning() {
-//        super.didReceiveMemoryWarning()
-//    }
-    
 }
 
 extension CommunityViewController : JXSegmentedViewDelegate {
@@ -373,11 +403,24 @@ extension CommunityViewController : JXSegmentedViewDelegate {
         }
         if index == 1 {
             communityModuleTopType = .communityModuleRecommendTop
-
         }
         if index == 2 {
             communityModuleTopType = .communityModulePlanetTop
+            if (communityNavigationBarIsHidden) {
+                self.communityNavigationBarView.snp.updateConstraints { (make) in
+                    make.top.equalTo(kSafeStatusBarHeight)
+                }
+                self.segmentedView.snp.updateConstraints { (make) in
+                     make.top.equalTo(kNavBarTotalHeight)
+                }
+                communityNavigationBarIsHidden = false
+                UIView.animate(withDuration: 0.5, animations: { [weak self] in
+                    self?.view.layoutIfNeeded()
+                    self?.listContainerView.layoutSubviews()
+                }) { (complete) in}
+            }
         }
+        communityIndex = index
         listContainerView.didClickSelectedItem(at: index)
 
         self.index = index

+ 39 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift

@@ -24,6 +24,10 @@ class CommunityRecommnendViewController: UIViewController {
     /// 评论需要的模型
     var communityRecommendDataModel : CommunityRecommendDataModel?
     
+    var lastContentOffset : CGFloat = 0
+    
+    var navigationBarIsHidden: Bool = false
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
@@ -630,6 +634,41 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
     }
 }
 
+extension CommunityRecommnendViewController {
+    func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
+        //全局变量记录滑动前的contentOffset
+        lastContentOffset = scrollView.contentOffset.y;//判断上下滑动时
+    }
+    
+    func scrollViewDidScroll(_ scrollView: UIScrollView) {
+        if scrollView.contentOffset.y > lastContentOffset && communityIndex != 2 {
+            //向上
+            if communityNavigationBarIsHidden == false {
+                NotificationCenter.default.post(name: NSNotification.Name("CommunityViewControllerScrollView"), object: true)
+                tableView.snp.updateConstraints { (make) in
+                    make.height.equalTo(kScreenHeight-48-kSafeStatusBarHeight-kTabBarTotalHeight)
+                }
+//                self.view.layoutIfNeeded()
+                communityNavigationBarIsHidden = true
+
+            }
+        } else if scrollView.contentOffset.y < lastContentOffset && communityIndex != 2 {
+            //向下
+            
+            if communityNavigationBarIsHidden {
+                NotificationCenter.default.post(name: NSNotification.Name("CommunityViewControllerScrollView"), object: false)
+                tableView.snp.updateConstraints { (make) in
+                    make.height.equalTo(kScreenHeight-48-kNavBarTotalHeight-kTabBarTotalHeight)
+                }
+//                self.view.layoutIfNeeded()
+                communityNavigationBarIsHidden = false
+            }
+        }
+    }
+}
+
+
+
 extension CommunityRecommnendViewController : JXSegmentedListContainerViewListDelegate {
     func listView() -> UIView {
         return view

+ 11 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/View/PublishTopicTypeItemCollectionCell.swift

@@ -52,10 +52,10 @@ class PublishTopicTypeItemCollectionCell: UICollectionViewCell {
     //MRAK: - 设置View
     private func setupViews() {
         addSubview(picImageView)
+        addSubview(gradientView)
         addSubview(titleLabel)
         addSubview(focusView)
         
-        backgroundColor = UIColor.green
     }
     
     private func setupLayouts() {
@@ -80,6 +80,16 @@ class PublishTopicTypeItemCollectionCell: UICollectionViewCell {
         return picImageView
     }()
     
+    private lazy var gradientView : UIView = {
+        let gradientView = UIView(frame: self.bounds)
+        let bgLayer1 = CAGradientLayer()
+        bgLayer1.frame = gradientView.bounds
+        bgLayer1.rainbowLayer(gradientColors: [UIColor(hexString: "000000", alpha: 0).cgColor,UIColor(hexString: "000000", alpha:0.5).cgColor], gradientLocations: [0,1], gradientDisplayType: .vertical, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 1, y: 1))
+        gradientView.layer.addSublayer(bgLayer1)
+        gradientView.isUserInteractionEnabled = true
+        return gradientView
+    }()
+    
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
         titleLabel.textColor = kffffffColor

+ 9 - 3
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishMediaPicker/Controller/KSMediaPickerController.swift

@@ -202,10 +202,16 @@ open class KSMediaPickerController: UIViewController, UICollectionViewDelegate,
                 let itemModel = selItem as! KSMediaPickerItemModel
                 // 添加选中image
                 let asset = itemModel.asset
-                let pixelWidth = CGFloat(asset.pixelWidth)
-                let pixelHeight = CGFloat(asset.pixelHeight)
+                var pixelWidth = CGFloat(asset.pixelWidth)
+                var pixelHeight = CGFloat(asset.pixelHeight)
+                if pixelWidth > 1080 {
+                    pixelWidth = 1080
+                    pixelHeight = 1080 * pixelHeight / pixelWidth
+                }
                 PHImageManager.default().requestImage(for: asset, targetSize: CGSize(width: pixelWidth, height: pixelHeight), contentMode: .aspectFit, options: KSMediaPickerItemModel.pictureOptions) { (image, info) in
-                    imageArray.append(image!)
+                    image?.pngData()
+                    let image1 = UIImage(data: (image?.pngData())!, scale: 0.6)
+                    imageArray.append(image1!)
                 }
                 
                 if index == self._selectedAssetArray.count-1 {

+ 11 - 4
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceManger/SwiftMoyaNetWorkManager/ApiMacro.swift

@@ -8,11 +8,18 @@
 
 import Foundation
 
+/// Service
 let kPersonalService = false
 let kDevelopSever = false
 let kBetaSever = false
 let kProductSever = true
 
+/// h5Service
+let kH5PersonalService = false
+let kH5DevelopSever = false
+let kH5BetaSever = false
+let kH5ProductSever = true
+
 // MARK: - 数据服务器
 public func kApiDataPrefix() -> String {
     if kPersonalService /** 接口前缀-个人服务器*/ {
@@ -49,13 +56,13 @@ public func kApiVirusPrefix() -> String {
 
 // MARK: - H5
 public func kApiH5Prefix() -> String {
-    if kPersonalService /** 接口前缀-个人服务器*/ {
+    if kH5PersonalService /** 接口前缀-个人服务器*/ {
         return "http://192.168.23.238:8820"
-    }else if kDevelopSever /** 接口前缀-开发服务器*/ {
+    }else if kH5DevelopSever /** 接口前缀-开发服务器*/ {
         return "http://h5.dev.caihongxingqiu.com"
-    } else if kBetaSever /** 接口前缀-测试服务器*/{
+    } else if kH5BetaSever /** 接口前缀-测试服务器*/{
         return "http://h5.beta.caihongxingqiu.com"
-    }else if kProductSever /** 接口前缀-生产服务器*/ {
+    }else if kH5ProductSever /** 接口前缀-生产服务器*/ {
         return "http://h5.uptoyo.com"
     }else {
         return ""

二進制
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/posters_pic_text.imageset/posters_pic_text@2x.png


二進制
RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/posters_pic_text.imageset/posters_pic_text@3x.png