南鑫林 5 роки тому
батько
коміт
ebf2b92ca3
14 змінених файлів з 1517 додано та 5 видалено
  1. 8 0
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 1 0
      RainbowPlanet/RainbowPlanet/Macro/FontMacro.swift
  3. 2 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift
  4. 14 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Header/CommunityCommonSectionHeaderView.swift
  5. 12 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/CommunityViewController.swift
  6. 91 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsHeaderView.swift
  7. 101 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsNavigationBarView.swift
  8. 1244 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  9. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_attention_white.imageset/Contents.json
  10. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_attention_white.imageset/center_attention_white@2x.png
  11. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_attention_white.imageset/center_attention_white@3x.png
  12. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_followed_white.imageset/Contents.json
  13. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_followed_white.imageset/center_followed_white@2x.png
  14. BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/CommunityModule.xcassets/center_followed_white.imageset/center_followed_white@3x.png

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

@@ -285,6 +285,8 @@
 		A7C0FDF822B6671C00BC1E86 /* PopularVideoCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FDF722B6671C00BC1E86 /* PopularVideoCollectionViewCell.swift */; };
 		A7C0FDFB22B6672F00BC1E86 /* PopularVideoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FDFA22B6672F00BC1E86 /* PopularVideoTableViewCell.swift */; };
 		A7C0FE0022B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FDFF22B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift */; };
+		A7C0FE0222B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */; };
+		A7C0FE0422B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */; };
 		A7C3DD1A226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C3DD19226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift */; };
 		A7C3DD1C226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7C3DD1B226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift */; };
 		A7CC74D4226FF1AA003C4F38 /* MineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7CC74D3226FF1AA003C4F38 /* MineView.swift */; };
@@ -774,6 +776,8 @@
 		A7C0FDF722B6671C00BC1E86 /* PopularVideoCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularVideoCollectionViewCell.swift; sourceTree = "<group>"; };
 		A7C0FDFA22B6672F00BC1E86 /* PopularVideoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopularVideoTableViewCell.swift; sourceTree = "<group>"; };
 		A7C0FDFF22B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsViewController.swift; sourceTree = "<group>"; };
+		A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsHeaderView.swift; sourceTree = "<group>"; };
+		A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityFeaturedTopicsNavigationBarView.swift; sourceTree = "<group>"; };
 		A7C3DD19226422BF00FA262E /* SwiftMoyaServiceSMSApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaServiceSMSApi.swift; sourceTree = "<group>"; };
 		A7C3DD1B226422D200FA262E /* SwiftMoyaNetWorkServiceSMS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMoyaNetWorkServiceSMS.swift; sourceTree = "<group>"; };
 		A7CC74D3226FF1AA003C4F38 /* MineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MineView.swift; sourceTree = "<group>"; };
@@ -2848,6 +2852,8 @@
 		A7C0FDFE22B66C8E00BC1E86 /* View */ = {
 			isa = PBXGroup;
 			children = (
+				A7C0FE0122B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift */,
+				A7C0FE0322B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -4221,6 +4227,7 @@
 				A7778CB32244D73400C7C47A /* RegisterLoginViewController.swift in Sources */,
 				BD7AB8432284390B0030646A /* OrderPaySelfPickInfoCell.swift in Sources */,
 				BD1FC18622B09F9800D55081 /* CommunitySubCommentController.swift in Sources */,
+				A7C0FE0222B682DB00BC1E86 /* CommunityFeaturedTopicsHeaderView.swift in Sources */,
 				A7274C5F228EE636000E3A07 /* LBXScanWrapper.swift in Sources */,
 				A7CC752F2271A1F2003C4F38 /* SetPasswordView.swift in Sources */,
 				A7A98E09227EB8DD005306E9 /* CategoryView.swift in Sources */,
@@ -4299,6 +4306,7 @@
 				A72A72D022321E2700B21995 /* FontMacro.swift in Sources */,
 				BD2FCBE622B2586C0006D974 /* CommunityTagCollectionCell.swift in Sources */,
 				BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */,
+				A7C0FE0422B68E7500BC1E86 /* CommunityFeaturedTopicsNavigationBarView.swift in Sources */,
 				A7BF203422B47E8600396DB3 /* CardContentActionTableViewCell.swift in Sources */,
 				A71AA52622732068008FF1A5 /* SwiftMoyaServiceConfigApi.swift in Sources */,
 				A77F2C982231FD25001BD3F6 /* BaseNavigationViewController.swift in Sources */,

+ 1 - 0
RainbowPlanet/RainbowPlanet/Macro/FontMacro.swift

@@ -35,6 +35,7 @@ let kMediumFont16 = UIFont(name: "PingFang-SC-Medium", size: 16)
 let kMediumFont17 = UIFont(name: "PingFang-SC-Medium", size: 17)
 let kMediumFont18 = UIFont(name: "PingFang-SC-Medium", size: 18)
 let kMediumFont21 = UIFont(name: "PingFang-SC-Medium", size: 21)
+let kMediumFont23 = UIFont(name: "PingFang-SC-Medium", size: 23)
 let kMediumFont24 = UIFont(name: "PingFang-SC-Medium", size: 24)
 let kMediumFont25 = UIFont(name: "PingFang-SC-Medium", size: 25)
 let kMediumFont27 = UIFont(name: "PingFang-SC-Medium", size: 27)

+ 2 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift

@@ -82,7 +82,8 @@ extension FeaturedTopicsTableViewCell: UICollectionViewDelegateFlowLayout,UIColl
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-        
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityFeaturedTopics"), object: nil)
+
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {

+ 14 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Header/CommunityCommonSectionHeaderView.swift

@@ -54,7 +54,20 @@ class CommunityCommonSectionHeaderView: BaseView {
         lookAllButton.isHidden = true
         lookAllButton.rx.tap.subscribe(onNext: {
             [weak self] (data) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityLookAll"), object: nil)
+            switch self?.communityCommonSectionHeaderViewType {
+            case .recommendFollow?:
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: ""), object: nil)
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityRecommendFollow"), object: nil)
+                break
+            case .featuredTopics?:
+
+                break
+            case .popularVideo?:
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityPopularVideo"), object: nil)
+                break
+            default:
+                break
+            }
         }).disposed(by: disposeBag)
         return lookAllButton
     }()

+ 12 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/CommunityViewController.swift

@@ -73,8 +73,12 @@ class CommunityViewController: BaseViewController {
            
         }
         
-        // 查看全部
-        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityLookAll"), object: nil, queue: OperationQueue.main) {(notification) in
+        // 查看全部推荐关注
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityRecommendFollow"), object: nil, queue: OperationQueue.main) {(notification) in
+            
+        }
+        // 查看全部热门视频
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityPopularVideo"), object: nil, queue: OperationQueue.main) {(notification) in
             
         }
         
@@ -88,6 +92,12 @@ class CommunityViewController: BaseViewController {
             
         }
         
+        // 精选话题
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityFeaturedTopics"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let vc = CommunityFeaturedTopicsViewController()
+            self?.navigationController?.pushViewController(vc, animated: true)
+        }
+        
     }
     
     

+ 91 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsHeaderView.swift

@@ -0,0 +1,91 @@
+//
+//  CommunityFeaturedTopicsHeaderView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/6/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class CommunityFeaturedTopicsHeaderView: BaseView {
+    
+    override func setupViews() {
+        self.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        addSubview(numberPeopleLabel)
+        addSubview(topicLabel)
+        addSubview(followButton)
+        addSubview(bottomView)
+    }
+    
+    override func setupLayouts() {
+        numberPeopleLabel.snp_makeConstraints { (make) in
+            make.top.equalTo(92+kSafeStatusBarHeight)
+            make.left.equalTo(14)
+            make.height.equalTo(19)
+            make.right.equalTo(-14)
+        }
+        topicLabel.snp_makeConstraints { (make) in
+            make.top.equalTo(numberPeopleLabel.snp_bottom).offset(8)
+            make.left.equalTo(14)
+            make.right.lessThanOrEqualTo(followButton.snp_left).offset(5)
+            make.height.equalTo(33)
+        }
+        followButton.snp_makeConstraints { (make) in
+            make.centerY.equalTo(topicLabel)
+            make.right.equalTo(-14)
+            make.height.equalTo(26)
+            make.width.equalTo(80)
+        }
+        followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
+    }
+    
+    private lazy var numberPeopleLabel: UILabel = {
+        let numberPeopleLabel = UILabel()
+        numberPeopleLabel.text = "8888位彩虹居民参与此话题"
+        numberPeopleLabel.textColor = kffffffColor
+        numberPeopleLabel.font = kRegularFont13
+        return numberPeopleLabel
+    }()
+    
+    private lazy var topicLabel: UILabel = {
+        let topicLabel = UILabel()
+        topicLabel.text = "运动健身"
+        topicLabel.textColor = kffffffColor
+        topicLabel.font = kMediumFont24
+        return topicLabel
+    }()
+    
+    typealias FollowClosureName = (UIButton) -> Bool
+    var followClosureName : FollowClosureName?
+    private lazy var followButton: UIButton = {
+        let followButton = UIButton(type: UIButton.ButtonType.custom)
+        followButton.setTitle("关注话题", for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_attention_white"), for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_followed_white"), for: UIControl.State.selected)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for:  UIControl.State.normal)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: UIColor.clear), for: UIControl.State.selected)
+        followButton.titleLabel?.font = kMediumFont13
+        followButton.cornerRadius = 13
+        followButton.masksToBounds = true
+        followButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            if let followClosureName = self?.followClosureName {
+                followButton.isSelected = followClosureName(followButton)
+            }
+        }).disposed(by: disposeBag)
+        return followButton
+    }()
+    
+    private lazy var bottomView: UIView = {
+        let bottomView = UIView(frame: CGRect(x: 0, y: 180+kSafeStatusBarHeight, width: kScreenWidth, height: 20))
+        bottomView.backgroundColor = .white
+        let shapeLayer = CAShapeLayer()
+        bottomView.layer.mask = nil
+        let bezierPath = UIBezierPath(roundedRect: bottomView.bounds,byRoundingCorners: [.topLeft,.topRight],cornerRadii: CGSize(width: 8,height: 8))
+        shapeLayer.path = bezierPath.cgPath
+        bottomView.layer.mask = shapeLayer
+        return bottomView
+    }()
+
+}

+ 101 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsNavigationBarView.swift

@@ -0,0 +1,101 @@
+//
+//  CommunityFeaturedTopicsNavigationBarView.swift
+//  RainbowPlanet
+//
+//  Created by 南鑫林 on 2019/6/16.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class CommunityFeaturedTopicsNavigationBarView: BaseView {
+    
+    override func setupViews() {
+        self.clipsToBounds = true
+        self.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        addSubview(bgImageView)
+        addSubview(backButton)
+        addSubview(topicLable)
+        addSubview(topicButton)
+        addSubview(followButton)
+        
+    }
+    
+    override func setupLayouts() {
+        bgImageView.snp_makeConstraints { (make) in
+            make.top.right.left.equalToSuperview()
+            make.height.equalTo(kScreenWidth)
+        }
+        backButton.snp_makeConstraints { (make) in
+            make.bottom.equalTo(-11)
+            make.size.equalTo(22)
+            make.left.equalTo(14)
+        }
+        topicLable.snp_makeConstraints { (make) in
+            make.centerY.equalTo(backButton)
+            make.left.equalTo(backButton.snp_right).offset(10)
+        }
+        topicButton.snp_makeConstraints { (make) in
+            make.right.equalTo(-14)
+            make.centerY.equalTo(backButton)
+        }
+        followButton.snp_makeConstraints { (make) in
+            make.centerY.equalTo(backButton)
+            make.height.equalTo(24)
+            make.width.equalTo(60)
+            make.right.equalTo(-14)
+        }
+    }
+    
+    private lazy var bgImageView: UIImageView = {
+        let bgImageView = UIImageView()
+        bgImageView.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        bgImageView.image = kImage(name: "pic_preload")
+        bgImageView.masksToBounds = true
+        return bgImageView
+    }()
+    
+    private lazy var backButton: UIButton = {
+        let backButton = UIButton(type: UIButton.ButtonType.custom)
+        backButton.setImage(kImage(name: "navbar_back_white"), for: UIControl.State.normal)
+        return backButton
+    }()
+    
+    private lazy var topicLable: UILabel = {
+        let topicLable = UILabel()
+        topicLable.textColor = kffffffColor
+        topicLable.font = kRegularFont14
+        return topicLable
+    }()
+    
+    private lazy var topicButton: UIButton = {
+        let topicButton = UIButton(type: UIButton.ButtonType.custom)
+        topicButton.setTitle("我的话题", for: UIControl.State.normal)
+        topicButton.setTitleColor(kffffffColor, for: UIControl.State.normal)
+        topicButton.titleLabel?.font = kMediumFont14
+        return topicButton
+    }()
+    
+    typealias FollowClosureName = (UIButton) -> Bool
+    var followClosureName : FollowClosureName?
+    private lazy var followButton: UIButton = {
+        let followButton = UIButton(type: UIButton.ButtonType.custom)
+        followButton.setTitle("关注", for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_attention_white"), for: UIControl.State.normal)
+        followButton.setImage(kImage(name: "center_followed_white"), for: UIControl.State.selected)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: kThemeColor), for:  UIControl.State.normal)
+        followButton.setBackgroundImage(UIImage.imageWithColor(color: UIColor.clear), for: UIControl.State.selected)
+        followButton.titleLabel?.font = kMediumFont13
+        followButton.cornerRadius = 12
+        followButton.masksToBounds = true
+        followButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            if let followClosureName = self?.followClosureName {
+                followButton.isSelected = followClosureName(followButton)
+            }
+        }).disposed(by: disposeBag)
+        return followButton
+    }()
+    
+
+}

Різницю між файлами не показано, бо вона завелика
+ 1244 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift


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

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

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


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


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

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

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


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