南鑫林 %!s(int64=5) %!d(string=hai) anos
pai
achega
67dd68c75a
Modificáronse 32 ficheiros con 505 adicións e 181 borrados
  1. 1 1
      RainbowPlanet/RainbowPlanet.xcodeproj/project.pbxproj
  2. 16 5
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift
  3. 1 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FeaturedTopics/FeaturedTopicsTableViewCell.swift
  4. 4 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowCollectionViewCell.swift
  5. 5 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowTableViewCell.swift
  6. 1 2
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Header/CommunityCommonSectionHeaderView.swift
  7. 49 4
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift
  8. 21 14
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Main/CommunityViewController.swift
  9. 44 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Recommend/CommunityRecommnendViewController.swift
  10. 39 54
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsHeaderView.swift
  11. 152 63
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift
  12. 5 1
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/View/CommunityFindFriendsView.swift
  13. 10 0
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift
  14. 28 7
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/View/CommunityMyFollowTopicCell.swift
  15. 6 4
      RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/ViewController/CommunityMyFollowTopicController.swift
  16. 1 1
      RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetActivity/Controller/MessagePlanetActivityController.swift
  17. 1 1
      RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/View/RainbowBeanPhysical/RainbowBeanPhysicalView.swift
  18. 2 2
      RainbowPlanet/RainbowPlanet/Modules/MineModule/Set/ViewController/SetViewController.swift
  19. 3 2
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchCollectionViewCell.swift
  20. 12 0
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchHeaderCollectionReusableView.swift
  21. 3 1
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchNavigationbarView.swift
  22. 6 0
      RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchView.swift
  23. 2 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift
  24. 3 3
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift
  25. 2 2
      RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift
  26. 30 0
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift
  27. 33 5
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift
  28. 2 2
      RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift
  29. 22 0
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/Contents.json
  30. BIN=BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/nav_search_black44px@2x.png
  31. BIN=BIN
      RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/nav_search_black44px@3x.png
  32. 1 2
      RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m

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

@@ -1795,9 +1795,9 @@
 			children = (
 				A719EE6722AF438E001AAC98 /* Community */,
 				A74322A522B8FE5F0017C367 /* CommunityFindFriends */,
-				A7C0FDFC22B66B3C00BC1E86 /* CommunityFeaturedTopics */,
 				BD1FC18222B09F4700D55081 /* CommunitySubComment */,
 				BD2FCBDE22B21BE00006D974 /* CommunityRecommendDetail */,
+				A7C0FDFC22B66B3C00BC1E86 /* CommunityFeaturedTopics */,
 				BD1FC17D22B08CEB00D55081 /* CommunityMyFollowTopic */,
 			);
 			path = CommunityModule;

+ 16 - 5
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/CardContent/User/CardContentUserTableViewCell.swift

@@ -85,9 +85,9 @@ class CardContentUserTableViewCell: UITableViewCell {
         avatarButton.imageView?.contentMode = .scaleAspectFit
         avatarButton.cornerRadius = 20
         avatarButton.masksToBounds = true
-        avatarButton.rx.tap.subscribe(onNext: { (data) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
-            
+        avatarButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            self?.pushCommunityUser()
         }).disposed(by: disposeBag)
         return avatarButton
     }()
@@ -97,8 +97,9 @@ class CardContentUserTableViewCell: UITableViewCell {
         titleButton.setTitle("用户昵称", for: UIControl.State.normal)
         titleButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         titleButton.titleLabel?.font = kMediumFont14
-        titleButton.rx.tap.subscribe(onNext: { (data) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
+        titleButton.rx.tap.subscribe(onNext: {
+            [weak self] (data) in
+            self?.pushCommunityUser()
         }).disposed(by: disposeBag)
         return titleButton
     }()
@@ -187,5 +188,15 @@ class CardContentUserTableViewCell: UITableViewCell {
             }
         }
     }
+    
+    func pushCommunityUser() {
+        if communityRecommendDataModel != nil {
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: communityRecommendDataModel?.uid)
+        }
+        if communityFollowDataModel != nil {
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: communityFollowDataModel?.relateData?.uid)
+            
+        }
+    }
 
 }

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

@@ -90,7 +90,7 @@ extension FeaturedTopicsTableViewCell: UICollectionViewDelegateFlowLayout,UIColl
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
-        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityFeaturedTopics"), object: nil)
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityFeaturedTopics"), object: communityRecommendTypeDataModels?[indexPath.row])
 
     }
     

+ 4 - 2
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowCollectionViewCell.swift

@@ -86,8 +86,9 @@ class CommunityRecommendFollowCollectionViewCell: UICollectionViewCell {
         avatarButton.imageView?.contentMode = .scaleAspectFit
         avatarButton.cornerRadius = 30
         avatarButton.masksToBounds = true
+        avatarButton.isUserInteractionEnabled = false
         avatarButton.rx.tap.subscribe(onNext: { (data) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
+//            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
 
         }).disposed(by: disposeBag)
         return avatarButton
@@ -98,8 +99,9 @@ class CommunityRecommendFollowCollectionViewCell: UICollectionViewCell {
         titleButton.setTitle("用户昵称", for: UIControl.State.normal)
         titleButton.setTitleColor(k333333Color, for: UIControl.State.normal)
         titleButton.titleLabel?.font = kBoldFont16
+        titleButton.isUserInteractionEnabled = false
         titleButton.rx.tap.subscribe(onNext: { (data) in
-            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
+//            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: nil)
         }).disposed(by: disposeBag)
         return titleButton
     }()

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/RecommendFollow/CommunityRecommendFollowTableViewCell.swift

@@ -122,7 +122,12 @@ extension CommunityRecommendFollowTableViewCell: UICollectionViewDelegateFlowLay
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        if type == .recommend {
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: communityRecommendTypeDataModels?[indexPath.row].id)
 
+        }else {
+            NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityUser"), object: cmsMemberModels?[indexPath.row].uid)
+        }
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {

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

@@ -56,8 +56,7 @@ class CommunityCommonSectionHeaderView: BaseView {
             [weak self] (data) in
             switch self?.communityCommonSectionHeaderViewType {
             case .recommendFollow?:
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: ""), object: nil)
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityRecommendFollow"), object: nil)
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityFindFriends"), object: nil)
                 break
             case .featuredTopics?:
 

+ 49 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/Follow/CommunityFollowViewController.swift

@@ -62,10 +62,7 @@ class CommunityFollowViewController: UIViewController {
         }
     }
     
-    /// 关注接口
-    func followData(indexPath: IndexPath) {
-        tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
-    }
+    
     
 }
 
@@ -128,6 +125,46 @@ extension CommunityFollowViewController {
         }
     }
     
+    /// 关注
+    func userFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userFollowApi(followUid: followUid) { (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+    
+    /// 取消关注
+    func userCancelFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userCancelFollowApi(followUid: followUid) {
+            (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+    
+    func follow(communityFollowDataModel:CommunityFollowDataModel?) {
+        if communityFollowDataModel?.relateData?.isFollow == 0 {//加关注
+            self.userFollow(followUid:  communityFollowDataModel?.relateData?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                for (_,model) in (self?.communityFollowDataModels.enumerated())! {
+                    if model.relateData?.uid == communityFollowDataModel?.relateData?.uid {
+                        model.relateData?.isFollow = isFollow
+                        self?.tableView.reloadData()
+                    }
+                }
+            })
+        }else {//取消关注
+            self.userCancelFollow(followUid: communityFollowDataModel?.relateData?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                
+                for (_,model) in (self?.communityFollowDataModels.enumerated())! {
+                    if model.relateData?.uid == communityFollowDataModel?.relateData?.uid {
+                        model.relateData?.isFollow = isFollow
+                        self?.tableView.reloadData()
+                    }
+                }
+            })
+        }
+    }
+    
 
     
 }
@@ -203,6 +240,10 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
                 }else {
                     let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                     cell.communityFollowDataModel = communityFollowDataModel
+                    cell.followClosure = {
+                        [weak self] in
+                        self?.follow(communityFollowDataModel: communityFollowDataModel)
+                    }
                     return cell
                 }
             }
@@ -215,6 +256,10 @@ extension CommunityFollowViewController : UITableViewDelegate,UITableViewDataSou
         case 0:
             let cell = CardContentUserTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             cell.communityFollowDataModel = communityFollowDataModel
+            cell.followClosure = {
+                [weak self] in
+                self?.follow(communityFollowDataModel: communityFollowDataModel)
+            }
             return cell
         //图片视频
         case 1:

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

@@ -64,8 +64,8 @@ class CommunityViewController: BaseViewController {
             [weak self] in
             let vc = SearchViewController()
             vc.searchType = .content
-            let nav = BaseNavigationViewController.init(rootViewController: vc)
-            self?.present(nav, animated: true, completion: {
+            let nav = BaseNavigationViewController(rootViewController: vc)
+            self?.navigationController?.present(nav, animated: true, completion: {
                 
             })
         }
@@ -74,28 +74,33 @@ class CommunityViewController: BaseViewController {
             
         }).disposed(by: disposeBag)
         
-        // 找朋友
-        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityFindFriends"), object: nil, queue: OperationQueue.main) {(notification) in
-           
+        // 找朋友 查看全部推荐关注
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityFindFriends"), object: nil, queue: OperationQueue.main) { [weak self] (notification) in
+            let vc = CommunityFindFriendsViewController()
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         
-        // 查看全部推荐关注
-        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
             
         }
         
         // 查看其他用户中心
-        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityUser"), object: nil, queue: OperationQueue.main) {(notification) in
-            
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityUser"), object: nil, queue: OperationQueue.main) {
+            [weak self] (notification) in
+            let uid = notification.object as? Int
+            if uid != UserModel.shared().getModel()?.uid {
+                let vc = OtherPersonalCenterViewController()
+                vc.uid = uid ?? 0
+                self?.navigationController?.pushViewController(vc, animated: true)
+            }
         }
         
         // 内容详情页面
-        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityContentDetailClosure"), object: nil, queue: OperationQueue.main) {(notification) in
-            
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityContentDetailClosure"), object: nil, queue: OperationQueue.main) {
+            [weak self] (notification) in
+            let vc = CommunityRecommendController()
+            self?.navigationController?.pushViewController(vc, animated: true)
         }
         
         // banner跳转
@@ -132,7 +137,7 @@ class CommunityViewController: BaseViewController {
                 break
             case .activity?: //活动
                 let url = kH5ActivityUrl + "id=\(communityRecommendTypeDataModel?.linkContentId ?? 0)"
-                let vc = BaseWebViewController()
+                let vc = H5CommonViewController()
                 vc.URLString = url
                 self?.navigationController?.pushViewController(vc, animated: true)
                 break
@@ -149,7 +154,9 @@ class CommunityViewController: BaseViewController {
         
         // 精选话题
         observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityFeaturedTopics"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
+            let communityRecommendTypeDataModel = notification.object as? CommunityRecommendTypeDataModel
             let vc = CommunityFeaturedTopicsViewController()
+            vc.id = communityRecommendTypeDataModel?.id ?? 0
             self?.navigationController?.pushViewController(vc, animated: true)
         }
         

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

@@ -93,6 +93,24 @@ extension CommunityRecommnendViewController {
             }
         }
     }
+    
+    /// 关注
+    func userFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userFollowApi(followUid: followUid) { (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+    
+    /// 取消关注
+    func userCancelFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userCancelFollowApi(followUid: followUid) {
+            (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+
 }
 
 extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDataSource {
@@ -146,6 +164,32 @@ extension CommunityRecommnendViewController : UITableViewDelegate,UITableViewDat
             case 0:
                 let cell = CardContentUserTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.communityRecommendDataModel = communityRecommendDataModel
+                cell.followClosure = {
+                    if communityRecommendDataModel.isFollow == 0 {//加关注
+                        self.userFollow(followUid:  cell.communityRecommendDataModel?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                            for (index,communityRecommendDataModel) in (self?.communityRecommendDataModels.enumerated())! {
+                                if communityRecommendDataModel.uid == cell.communityRecommendDataModel?.uid {
+                                    communityRecommendDataModel.isFollow = isFollow
+                                    self?.tableView.reloadData()
+//                                    let indexPath1 = IndexPath(row: 0, section: index)
+//                                    self?.tableView.reloadRows(at: [indexPath1], with: UITableView.RowAnimation.none)
+                                }
+                            }
+                        })
+                    }else {//取消关注
+                        self.userCancelFollow(followUid:  cell.communityRecommendDataModel?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                            
+                            for (index,communityRecommendDataModel) in (self?.communityRecommendDataModels.enumerated())! {
+                                if communityRecommendDataModel.uid == cell.communityRecommendDataModel?.uid {
+                                    communityRecommendDataModel.isFollow = isFollow
+                                    self?.tableView.reloadData()
+//                                    let indexPath1 = IndexPath(row: 0, section: index)
+//                                    self?.tableView.reloadRows(at: [indexPath1], with: UITableView.RowAnimation.none)
+                                }
+                            }
+                        })
+                    }
+                }
                 return cell
             //图片视频
             case 1:

+ 39 - 54
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/View/CommunityFeaturedTopicsHeaderView.swift

@@ -11,10 +11,11 @@ import UIKit
 class CommunityFeaturedTopicsHeaderView: BaseView {
     
     override func setupViews() {
-        self.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        self.backgroundColor = UIColor.clear
+        
         addSubview(numberPeopleLabel)
         addSubview(topicLabel)
-        addSubview(followButton)
+        addSubview(focusButton)
         addSubview(bottomView)
     }
     
@@ -28,16 +29,16 @@ class CommunityFeaturedTopicsHeaderView: BaseView {
         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.right.lessThanOrEqualTo(focusButton.snp_left).offset(5)
             make.height.equalTo(33)
         }
-        followButton.snp_makeConstraints { (make) in
+        focusButton.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)
+        focusButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
     }
     
     private lazy var numberPeopleLabel: UILabel = {
@@ -56,23 +57,30 @@ class CommunityFeaturedTopicsHeaderView: BaseView {
         return topicLabel
     }()
     
-    typealias FollowClosureName = (UIButton) -> Bool
+    typealias FollowClosureName = () -> Void
     var followClosureName : FollowClosureName?
-    private lazy var followButton: UIButton = {
-        let followButton = UIButton(type: UIButton.ButtonType.custom)
-        followButton.setTitle("关注话题", for: UIControl.State.normal)
-        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
+    
+    private lazy var focusButton: UIButton = {
+        let focusButton = UIButton(type: UIButton.ButtonType.custom)
+        focusButton.setImage(kImage(name: "star_attention"), for: UIControl.State.normal)
+        focusButton.setImage(kImage(name: "star_followed"), for: UIControl.State.selected)
+        focusButton.setTitleColor(k666666Color, for: UIControl.State.selected)
+        focusButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
+        focusButton.setTitle("关注话题", for: UIControl.State.normal)
+        focusButton.setTitle("关注话题", for: UIControl.State.selected)
+        focusButton.titleLabel?.font = kMediumFont13
+        focusButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
+        focusButton.setBackgroundImage(UIImage.imageWithColor(color: kf7f8faColor), for: UIControl.State.selected)
+        focusButton.layer.borderWidth = 1
+        focusButton.cornerRadius = 13
+        focusButton.masksToBounds = true
+        focusButton.rx.tap.subscribe(onNext: { [weak self] (data) in
             if let followClosureName = self?.followClosureName {
-                followButton.isSelected = followClosureName(followButton)
+                followClosureName()
             }
         }).disposed(by: disposeBag)
-        return followButton
+        
+        return focusButton
     }()
     
     private lazy var bottomView: UIView = {
@@ -90,44 +98,21 @@ class CommunityFeaturedTopicsHeaderView: BaseView {
         didSet {
             numberPeopleLabel.text = "\(communityTopicDetailModel?.followCount ?? 0)位彩虹居民参与此话题"
             topicLabel.text = communityTopicDetailModel?.name
-            followType = FollowType(rawValue: communityTopicDetailModel?.isFollow ?? 0)
+            isFollow()
         }
     }
-    
-    
-    var followType: FollowType! {
-        didSet {
-            switch followType {
-            case .futureFollow?:
-                followButton.setTitle("关注话题", for: UIControl.State.normal)
-                followButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "star_attention"), for: UIControl.State.normal)
-                followButton.layer.borderColor = kThemeColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
-                
-                break
-            case .alreadyFollow?:
-                followButton.setTitle("关注话题", for: UIControl.State.normal)
-                followButton.setTitleColor(k333333Color, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "star_followed"), for: UIControl.State.normal)
-                followButton.layer.borderColor = kf7f8faColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kf7f8faColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
-                break
-            case .mutualFollow?:
-                followButton.setTitle("互相关注", for: UIControl.State.normal)
-                followButton.setTitleColor(k333333Color, for: UIControl.State.normal)
-                followButton.setImage(nil, for: UIControl.State.normal)
-                followButton.layer.borderColor = kCCCCCCColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 0)
-                
-                break
-            default:
-                break
-            }
+
+}
+
+extension CommunityFeaturedTopicsHeaderView {
+    func isFollow() {
+        if communityTopicDetailModel?.isFollow == 1 {
+            focusButton.isSelected = true
+            focusButton.layer.borderColor = kf7f8faColor.cgColor
+        }else {
+            focusButton.isSelected = false
+            focusButton.layer.borderColor = kThemeColor.cgColor
         }
     }
-
+    
 }

+ 152 - 63
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFeaturedTopics/ViewController/CommunityFeaturedTopicsViewController.swift

@@ -13,17 +13,24 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     var cellHeightsDictionary = Dictionary<IndexPath, Any>()
     var id : Int = 0
     var communityRecommendDataModels = Array<CommunityRecommendDataModel>()
-
+    var communityTopicDetailModel : CommunityTopicDetailModel?
     
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
-        setupLayouts()
         setupData()
+        setupLayouts()
+
+    }
+    
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        communityTopicDetailApi()
     }
     
     override func setupViews() {
         view.addSubview(bgImageView)
+        view.addSubview(bgView)
         view.addSubview(tableView)
         view.insertSubview(navigationBar, aboveSubview: tableView)
         setnavigationBar()
@@ -34,14 +41,12 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     func setnavigationBar() {
         navigationBar.addSubview(navigationBgView)
         navigationBar.addSubview(topicLable)
-        navigationBar.addSubview(followButton)
+        navigationBar.addSubview(focusButton)
         navigationBar.insertSubview(navigationBgView, aboveSubview: navigationBar.backgroundImageView)
         navigationBar.backgroundImageView.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: kScreenWidth)
         navigationBar.clipsToBounds = true
         navigationBar.wr_setLeftButton(image: kImage(name: "navbar_back_white")!)
         navigationBar.wr_setRightButton(title: "我的话题", titleColor: .white)
-        // 设置导航栏显示图片
-        navigationBar.barBackgroundImage = UIImage(named: "pic_example_12")
         // 设置初始导航栏透明度
         navigationBar.wr_setBackgroundAlpha(alpha: 0)
         // 设置状态栏style
@@ -53,6 +58,9 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             make.top.left.right.equalToSuperview()
             make.height.equalTo(kScreenWidth)
         }
+        bgView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
         tableView.snp.makeConstraints { (make) in
             make.top.left.right.bottom.equalToSuperview()
         }
@@ -63,7 +71,7 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
             make.centerY.equalTo(navigationBar.leftButton)
             make.left.equalTo(navigationBar.leftButton.snp_right)
         }
-        followButton.snp_makeConstraints { (make) in
+        focusButton.snp_makeConstraints { (make) in
             make.right.equalTo(-14)
             make.centerY.equalTo(navigationBar.leftButton)
             make.width.equalTo(60)
@@ -85,10 +93,15 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     
     private lazy var bgImageView: UIImageView = {
         let bgImageView = UIImageView()
-        bgImageView.image = kImage(name: "pic_example_12")
         return bgImageView
     }()
     
+    private lazy var bgView: UIView = {
+        let bgView = UIView()
+        bgView.backgroundColor = UIColor(hexString: "000000", alpha: 0.4)
+        return bgView
+    }()
+    
     private lazy var communityFeaturedTopicsHeaderView: CommunityFeaturedTopicsHeaderView = {
         let communityFeaturedTopicsHeaderView = CommunityFeaturedTopicsHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWidth, height: 200 + kSafeStatusBarHeight))
         return communityFeaturedTopicsHeaderView
@@ -103,17 +116,30 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
         return topicLable
     }()
     
-    private lazy var followButton: UIButton = {
-        let followButton = UIButton(type: UIButton.ButtonType.custom)
-        followButton.titleLabel?.font = kMediumFont13
-        followButton.alpha = 0
-        followButton.cornerRadius = 12
-        followButton.masksToBounds = true
-        followButton.rx.tap.subscribe(onNext: {
-            [weak self] (data) in
-            followButton.isSelected = !followButton.isSelected
+    private lazy var focusButton: UIButton = {
+        let focusButton = UIButton(type: UIButton.ButtonType.custom)
+        focusButton.setImage(kImage(name: "star_attention"), for: UIControl.State.normal)
+        focusButton.setImage(kImage(name: "star_followed"), for: UIControl.State.selected)
+        focusButton.setTitleColor(k666666Color, for: UIControl.State.selected)
+        focusButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
+        focusButton.setTitle("关注", for: UIControl.State.normal)
+        focusButton.setTitle("关注", for: UIControl.State.selected)
+        focusButton.titleLabel?.font = kMediumFont13
+        focusButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
+        focusButton.setBackgroundImage(UIImage.imageWithColor(color: kf7f8faColor), for: UIControl.State.selected)
+        focusButton.alpha = 0
+        focusButton.layer.borderWidth = 1
+        focusButton.cornerRadius = 12
+        focusButton.masksToBounds = true
+        focusButton.rx.tap.subscribe(onNext: { [weak self] (data) in
+            if self?.communityTopicDetailModel?.isFollow == 1 {
+                self?.communityMemberFollowTopicCancelFollowApi()
+            }else {
+                self?.communityMemberFollowTopicFollowApi()
+            }
         }).disposed(by: disposeBag)
-        return followButton
+        
+        return focusButton
     }()
     
     private lazy var navigationBgView: UIView = {
@@ -125,20 +151,25 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
     
     
     override func setupData() {
+        communityPostTopicApi(page: 1)
         //下拉刷新
-        tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) {
+        tableView.addHeaderWithHeader(withBeginRefresh: false, animation: false) {
             [weak self] (page) in
-            self?.communityTopicDetailApi()
             self?.communityPostTopicApi(page: page)
+            self?.communityTopicDetailApi()
+
         }
         tableView.addFooterWithWithHeader(withAutomaticallyRefresh: false) {
             [weak self] (page) in
             self?.communityPostTopicApi(page: page)
         }
-        tableView.tableHeaderView = communityFeaturedTopicsHeaderView
         communityFeaturedTopicsHeaderView.followClosureName = {
-            (button:UIButton) -> Bool in
-            return !button.isSelected
+            [weak self] in
+            if self?.communityTopicDetailModel?.isFollow == 1 {
+                self?.communityMemberFollowTopicCancelFollowApi()
+            }else {
+                self?.communityMemberFollowTopicFollowApi()
+            }
         }
         navigationBar.onClickRightButton = {
             [weak self] in
@@ -152,42 +183,11 @@ class CommunityFeaturedTopicsViewController: BaseViewController {
         tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
     }
     
-    var followType: FollowType! {
-        didSet {
-            switch followType {
-            case .futureFollow?:
-                followButton.setTitle("关注", for: UIControl.State.normal)
-                followButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "star_attention"), for: UIControl.State.normal)
-                followButton.layer.borderColor = kThemeColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
-                
-                break
-            case .alreadyFollow?:
-                followButton.setTitle("关注", for: UIControl.State.normal)
-                followButton.setTitleColor(k333333Color, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "star_followed"), for: UIControl.State.normal)
-                followButton.layer.borderColor = kf7f8faColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kf7f8faColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
-                break
-            case .mutualFollow?:
-                followButton.setTitle("互相关注", for: UIControl.State.normal)
-                followButton.setTitleColor(k333333Color, for: UIControl.State.normal)
-                followButton.setImage(nil, for: UIControl.State.normal)
-                followButton.layer.borderColor = kCCCCCCColor.cgColor
-                followButton.setBackgroundImage(UIImage.imageWithColor(color: kffffffColor), for: UIControl.State.normal)
-                followButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 0)
-                
-                break
-            default:
-                break
-            }
-        }
-    }
+    
 }
 
+
+
 extension CommunityFeaturedTopicsViewController {
     func scrollViewDidScroll(_ scrollView: UIScrollView)
     {
@@ -196,7 +196,7 @@ extension CommunityFeaturedTopicsViewController {
         {
             let alpha = (offsetY - kSafeStatusBarHeight) / CGFloat(kNavBarTotalHeight)
             navigationBar.wr_setBackgroundAlpha(alpha: alpha)
-            followButton.alpha = alpha
+            focusButton.alpha = alpha
             topicLable.alpha = alpha
             navigationBgView.alpha = alpha
             navigationBar.rightButton.alpha = 1 - alpha
@@ -204,7 +204,7 @@ extension CommunityFeaturedTopicsViewController {
         else
         {
             navigationBar.wr_setBackgroundAlpha(alpha: 0)
-            followButton.alpha = 0
+            focusButton.alpha = 0
             topicLable.alpha = 0
             navigationBgView.alpha = 0
             navigationBar.rightButton.alpha = 1
@@ -213,18 +213,34 @@ extension CommunityFeaturedTopicsViewController {
 }
 
 extension CommunityFeaturedTopicsViewController {
+    func isFollow() {
+        if communityTopicDetailModel?.isFollow == 1 {
+            focusButton.isSelected = true
+            focusButton.layer.borderColor = kf7f8faColor.cgColor
+        }else {
+            focusButton.isSelected = false
+            focusButton.layer.borderColor = kThemeColor.cgColor
+        }
+    }
+}
+
+extension CommunityFeaturedTopicsViewController {
+    
+    /// 话题详情页面
     func communityTopicDetailApi() {
         SwiftMoyaNetWorkServiceCommunity.shared().communityTopicDetailApi(id: id) {
             [weak self] (communityTopicDetailModel) -> (Void) in
-            let communityTopicDetailModel = communityTopicDetailModel as? CommunityTopicDetailModel
-            self?.topicLable.text = communityTopicDetailModel?.name
-            self?.followType = FollowType(rawValue: communityTopicDetailModel?.isFollow ?? 0)
-            self?.bgImageView.kf.setImage(with: kURLImage(name: communityTopicDetailModel?.img ?? ""), placeholder: kImage(name: "pic_example_12"))
+            self?.communityTopicDetailModel = communityTopicDetailModel as? CommunityTopicDetailModel
+            self?.topicLable.text = self?.communityTopicDetailModel?.name
+            self?.isFollow()
+            self?.bgImageView.kf.setImage(with: kURLImage(name: self?.communityTopicDetailModel?.img ?? ""), placeholder: kImage(name: "pic_example_12"))
             self?.navigationBar.barBackgroundImage = self?.bgImageView.image
-            self?.communityFeaturedTopicsHeaderView.communityTopicDetailModel = communityTopicDetailModel
+            self?.communityFeaturedTopicsHeaderView.communityTopicDetailModel = self?.communityTopicDetailModel
+            self?.tableView.tableHeaderView = self?.communityFeaturedTopicsHeaderView
         }
     }
     
+    /// 话题帖子
     func communityPostTopicApi(page:Int) {
         SwiftMoyaNetWorkServiceCommunity.shared().communityPostTopicApi(id: id, page: page) {
             [weak self] (communityRecommendFeedModel) -> (Void) in
@@ -243,8 +259,55 @@ extension CommunityFeaturedTopicsViewController {
             }
         }
     }
+    
+    /// 关注话题(单个)
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicFollowApi() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityMemberFollowTopicFollowApi(topicId: id) {
+            [weak self] (data) -> (Void) in
+            self?.communityTopicDetailModel?.isFollow = 1
+            self?.communityFeaturedTopicsHeaderView.communityTopicDetailModel = self?.communityTopicDetailModel
+            self?.isFollow()
+        }
+    }
+    
+    /// 取消关注话题
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicCancelFollowApi() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityMemberFollowTopicCancelFollowApi(topicId:id) {
+            [weak self] (data) -> (Void) in
+            self?.communityTopicDetailModel?.isFollow = 0
+            self?.communityFeaturedTopicsHeaderView.communityTopicDetailModel = self?.communityTopicDetailModel
+            self?.isFollow()
+        }
+    }
+    
+    /// 关注
+    func userFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userFollowApi(followUid: followUid) { (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+    
+    /// 取消关注
+    func userCancelFollow(followUid:Int,completion: @escaping (Int) -> Void) {
+        SwiftMoyaNetWorkServiceUser.shared().userCancelFollowApi(followUid: followUid) {
+            (followStatusModel) -> (Void) in
+            let followStatusModel = followStatusModel as? FollowStatusModel
+            completion(followStatusModel?.isFollowStatus ?? 0)
+        }
+    }
+    
 }
 
+
 extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableViewDataSource {
     
     func numberOfSections(in tableView: UITableView) -> Int {
@@ -262,6 +325,32 @@ extension CommunityFeaturedTopicsViewController : UITableViewDelegate,UITableVie
         case 0:
             let cell = CardContentUserTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
             cell.communityRecommendDataModel = communityRecommendDataModel
+            cell.followClosure = {
+                if communityRecommendDataModel.isFollow == 0 {//加关注
+                    self.userFollow(followUid:  cell.communityRecommendDataModel?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                        for (_,communityRecommendDataModel) in (self?.communityRecommendDataModels.enumerated())! {
+                            if communityRecommendDataModel.uid == cell.communityRecommendDataModel?.uid {
+                                communityRecommendDataModel.isFollow = isFollow
+                                self?.tableView.reloadData()
+//                                let indexPath1 = IndexPath(row: 0, section: index)
+//                                self?.tableView.reloadRows(at: [indexPath1], with: UITableView.RowAnimation.none)
+                            }
+                        }
+                    })
+                }else {//取消关注
+                    self.userCancelFollow(followUid:  cell.communityRecommendDataModel?.uid ?? 0, completion: { [weak self] (isFollow) -> Void in
+                        
+                        for (_,communityRecommendDataModel) in (self?.communityRecommendDataModels.enumerated())! {
+                            if communityRecommendDataModel.uid == cell.communityRecommendDataModel?.uid {
+                                communityRecommendDataModel.isFollow = isFollow
+                                self?.tableView.reloadData()
+//                                let indexPath1 = IndexPath(row: 0, section: index)
+//                                self?.tableView.reloadRows(at: [indexPath1], with: UITableView.RowAnimation.none)
+                            }
+                        }
+                    })
+                }
+            }
             return cell
         //图片视频
         case 1:

+ 5 - 1
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/View/CommunityFindFriendsView.swift

@@ -44,9 +44,13 @@ class CommunityFindFriendsView: BaseView {
     
     lazy var picButton: UIButton = {
         let picButton = UIButton(type: UIButton.ButtonType.custom)
-        picButton.setBackgroundImage(kImage(name: "pic_preload"), for: UIControl.State.normal)
+        let configModel = ConfigModel.shared.object()
+        picButton.kf.setBackgroundImage(with: kURLImage(name: configModel?.findFriendImg ?? ""), for: UIControl.State.normal, placeholder: kImage(name: "pic_preload"))
         picButton.cornerRadius = 5
         picButton.masksToBounds = true
+        picButton.rx.tap.subscribe(onNext: { _ in
+            
+        }).disposed(by: disposeBag)
         return picButton
     }()
     

+ 10 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityFindFriends/ViewController/CommunityFindFriendsViewController.swift

@@ -22,6 +22,7 @@ class CommunityFindFriendsViewController: BaseViewController {
     
     override func setupViews() {
         navigationBar.title = "找朋友"
+        navigationBar.wr_setRightButton(image: kImage(name: "nav_search_black44px")!)
         view.backgroundColor = kf7f8faColor
         view.addSubview(tableView)
     }
@@ -34,6 +35,15 @@ class CommunityFindFriendsViewController: BaseViewController {
     }
     
     override func setupData() {
+        navigationBar.onClickRightButton = {
+            [weak self] in
+            let vc = SearchViewController()
+            vc.searchType = .user
+            let nav = BaseNavigationViewController(rootViewController: vc)
+            self?.navigationController?.present(nav, animated: true, completion: {
+                
+            })
+        }
         tableView.tableHeaderView = communityFindFriendsView
         tableView.addHeaderWithHeader(withBeginRefresh: true, animation: false) { [weak self] (page) in
             self?.cmsMemberListApi()

+ 28 - 7
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/View/CommunityMyFollowTopicCell.swift

@@ -14,9 +14,6 @@ class CommunityMyFollowTopicCell: UITableViewCell {
     
     let disposeBag = DisposeBag()
     
-    typealias FocusClickClosure = (_ isFocusSelected: Int) -> Void
-    var focusClickClosure : FocusClickClosure?
-    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommunityMyFollowTopicCell {
         let ID = "CommunityMyFollowTopicCell"
         tableView.register(CommunityMyFollowTopicCell.self, forCellReuseIdentifier: ID)
@@ -97,10 +94,10 @@ class CommunityMyFollowTopicCell: UITableViewCell {
         focusButton.cornerRadius = 13
         focusButton.masksToBounds = true
         focusButton.rx.tap.subscribe(onNext: { [weak self] (data) in
-            focusButton.isSelected = !focusButton.isSelected
-            if let focusClickClosure = self?.focusClickClosure {
-                let isSel: Int = focusButton.isSelected == true ? 1 : 0
-                focusClickClosure(isSel)
+            if self?.communityMemberFollowTopicListDataModel?.isFollow == 1 {
+               self?.communityMemberFollowTopicCancelFollowApi()
+            }else {
+                self?.communityMemberFollowTopicFollowApi()
             }
         }).disposed(by: disposeBag)
         
@@ -138,5 +135,29 @@ extension CommunityMyFollowTopicCell {
 }
 
 extension CommunityMyFollowTopicCell {
+    /// 关注话题(单个)
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicFollowApi() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityMemberFollowTopicFollowApi(topicId: communityMemberFollowTopicListDataModel?.topicId ?? 0) {
+            [weak self] (data) -> (Void) in
+            self?.communityMemberFollowTopicListDataModel?.isFollow = 1
+            self?.isFollow()
+        }
+    }
     
+    /// 取消关注话题
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicCancelFollowApi() {
+        SwiftMoyaNetWorkServiceCommunity.shared().communityMemberFollowTopicCancelFollowApi(topicId: communityMemberFollowTopicListDataModel?.topicId ?? 0) {
+            [weak self] (data) -> (Void) in
+            self?.communityMemberFollowTopicListDataModel?.isFollow = 0
+            self?.isFollow()
+        }
+    }
 }

+ 6 - 4
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/ViewController/CommunityMyFollowTopicController.swift

@@ -9,7 +9,7 @@
 import UIKit
 
 class CommunityMyFollowTopicController: BaseViewController {
-    
+        
     var communityMemberFollowTopicListDataModels = Array<CommunityMemberFollowTopicListDataModel>()
     
     override func viewDidLoad() {
@@ -29,8 +29,7 @@ class CommunityMyFollowTopicController: BaseViewController {
     override func setupLayouts() {
         tableView.snp.makeConstraints { (make) in
             make.top.equalToSuperview().offset(kNavBarTotalHeight)
-            make.left.right.equalTo(0)
-            make.height.equalTo(kScreenHeight-kNavBarTotalHeight-kSafeTabBarHeight)
+            make.left.right.bottom.equalTo(0)
         }
         
         if #available(iOS 11.0, *) {
@@ -43,7 +42,7 @@ class CommunityMyFollowTopicController: BaseViewController {
         let emptyView = DIYEmptyView.emptyActionView(withImageStr: "default_page_topic", titleStr: nil, detailStr: "暂无关注,去发现好玩的话题吧", btnTitleStr: "去首页") {
             [weak self] in
             self?.tabBarController?.selectedIndex = 0
-            self?.navigationController?.popToRootViewController(animated: false)
+            self?.navigationController?.popToClass(type: CommunityViewController.self)
         }
         emptyView?.actionBtnHorizontalMargin = 58
         emptyView?.contentViewY = kScaleValue(value: 164)
@@ -118,6 +117,9 @@ extension CommunityMyFollowTopicController: UITableViewDataSource, UITableViewDe
     
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
         tableView.deselectRow(at: indexPath, animated: true)
+        let vc = CommunityFeaturedTopicsViewController()
+        vc.id = communityMemberFollowTopicListDataModels[indexPath.row].topicId ?? 0
+        self.navigationController?.pushViewController(vc, animated: true)
     }
     
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/MessageModule/MessagePlanetActivity/Controller/MessagePlanetActivityController.swift

@@ -97,7 +97,7 @@ extension MessagePlanetActivityController: UITableViewDataSource, UITableViewDel
     func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          let messageDataModel = messageDataModels[indexPath.row]
         let url = kH5ActivityUrl + "id=\(messageDataModel.param?.activityUrl ?? "")" + "time=\(messageDataModel.param?.activityTime ?? "")"
-        let vc = BaseWebViewController()
+        let vc = H5CommonViewController()
         vc.URLString = url
         self.navigationController?.pushViewController(vc, animated: true)
     }

+ 1 - 1
RainbowPlanet/RainbowPlanet/Modules/MineModule/PersonalCenter/UserPersonalCenter/View/RainbowBeanPhysical/RainbowBeanPhysicalView.swift

@@ -64,7 +64,7 @@ extension RainbowBeanPhysicalView: UICollectionViewDelegateFlowLayout,UICollecti
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
         collectionView.deselectItem(at: indexPath, animated: true)
-        let vc = BaseWebViewController()
+        let vc = H5CommonViewController()
         if indexPath.row == 0 {
             vc.URLString = kH5ContentId2Url
         }else  if indexPath.row == 1 {

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/MineModule/Set/ViewController/SetViewController.swift

@@ -50,7 +50,7 @@ class SetViewController: BaseViewController {
                 switch indexPath.row {
                 // 用户协议
                 case 0:
-                    let vc = BaseWebViewController()
+                    let vc = H5CommonViewController()
                     vc.URLString = kH5ContentId6Url
                     self?.navigationController?.pushViewController(vc, animated: true)
                     break
@@ -60,7 +60,7 @@ class SetViewController: BaseViewController {
                     break
                 // 分享彩虹星球app
                 case 3:
-                    let vc = BaseWebViewController()
+                    let vc = H5CommonViewController()
                     vc.URLString = "https://www.baidu.com"
                     self?.navigationController?.pushViewController(vc, animated: true)
                     break

+ 3 - 2
RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchCollectionViewCell.swift

@@ -43,8 +43,9 @@ class SearchCollectionViewCell: UICollectionViewCell {
     
     private func setupLayouts() {
         titleLabel.snp.makeConstraints { (make) in
-            make.top.equalToSuperview().offset(8)
-            make.bottom.equalToSuperview().offset(-8)
+            make.top.equalToSuperview()
+            make.height.equalTo(28)
+            make.bottom.equalToSuperview()
             make.left.equalToSuperview().offset(15)
             make.right.equalToSuperview().offset(-15)
         }

+ 12 - 0
RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchHeaderCollectionReusableView.swift

@@ -7,9 +7,13 @@
 //
 
 import UIKit
+import RxSwift
 
 class SearchHeaderCollectionReusableView: UICollectionReusableView {
     
+    let disposeBag = DisposeBag()
+    
+    
     typealias RightButtonBlock = (_ indexPath: IndexPath) -> Void
     var rightButtonBlock : RightButtonBlock?
     
@@ -68,12 +72,20 @@ class SearchHeaderCollectionReusableView: UICollectionReusableView {
         return titleLabel
     }()
     
+    typealias DeleteButtonBlock  = () -> Void
+    var deleteButtonBlock : DeleteButtonBlock?
+    
     private lazy var deleteButton: UIButton = {
         let deleteButton = UIButton(type: UIButton.ButtonType.custom)
         deleteButton.setImage(kImage(name: "search_ico_delete"), for: UIControl.State.normal)
         deleteButton.setTitle("清除记录", for: UIControl.State.normal)
         deleteButton.setTitleColor(kCCCCCCColor, for: UIControl.State.normal)
         deleteButton.titleLabel?.font = kRegularFont12
+        deleteButton.rx.tap.subscribe(onNext: { [weak self] in
+            if let deleteButtonBlock = self?.deleteButtonBlock {
+                deleteButtonBlock()
+            }
+        }).disposed(by: disposeBag)
         return deleteButton
     }()
 }

+ 3 - 1
RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchNavigationbarView.swift

@@ -87,7 +87,9 @@ class SearchNavigationbarView: BaseView {
                     searchHistoryArray.append(searchTextField.text ?? "")
                 } else {
                     searchHistoryArray = UserDefaults.standard.array(forKey: "SearchHistoryArray") as! [String]
-                    searchHistoryArray.append(searchTextField.text ?? "")
+                    if !(searchHistoryArray.contains(searchTextField.text ?? "")) {
+                        searchHistoryArray.append(searchTextField.text ?? "")
+                    }
                 }
                 UserDefaults.standard.set(searchHistoryArray, forKey: "SearchHistoryArray")
 

+ 6 - 0
RainbowPlanet/RainbowPlanet/Modules/SearchModule/Search/View/SearchView.swift

@@ -90,6 +90,12 @@ extension SearchView : UICollectionViewDelegateFlowLayout ,UICollectionViewDataS
         if kind == UICollectionView.elementKindSectionHeader
         {
             let searchHeaderCollectionReusableView = SearchHeaderCollectionReusableView.headerWith(collectionView: collectionView, kind: UICollectionView.elementKindSectionHeader, indexPath: indexPath)
+            searchHeaderCollectionReusableView.deleteButtonBlock = {
+                 [weak self] in
+                UserDefaults.standard.removeObject(forKey: "SearchHistoryArray")
+                self?.searchHistoryArray.removeAll()
+                collectionView.reloadData()
+            }
             return searchHeaderCollectionReusableView
         }else {
             return UICollectionReusableView()

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Category/ViewController/CategoryViewController.swift

@@ -51,8 +51,8 @@ class CategoryViewController: BaseViewController {
             [weak self] in
             let vc = SearchViewController()
             vc.searchType = .product
-            let nav = BaseNavigationViewController.init(rootViewController: vc)
-            self?.present(nav, animated: true, completion: {
+            let nav = BaseNavigationViewController(rootViewController: vc)
+            self?.navigationController?.present(nav, animated: true, completion: {
                 
             })
         }).disposed(by: disposeBag)

+ 3 - 3
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/ShoppingMall/ViewController/ShoppingMallViewController.swift

@@ -73,8 +73,8 @@ class ShoppingMallViewController: BaseViewController {
             [weak self] in
             let vc = SearchViewController()
             vc.searchType = .product
-            let nav = BaseNavigationViewController.init(rootViewController: vc)
-            self?.present(nav, animated: true, completion: {
+            let nav = BaseNavigationViewController(rootViewController: vc)
+            self?.navigationController?.present(nav, animated: true, completion: {
                 
             })
         }
@@ -97,7 +97,7 @@ class ShoppingMallViewController: BaseViewController {
             self.navigationController?.pushViewController(vc, animated: true)
             break
         case 2:
-            let vc = BaseWebViewController()
+            let vc = H5CommonViewController()
             vc.URLString = cmsRuleModel?.linkUrl
             self.navigationController?.pushViewController(vc, animated: true)
             break

+ 2 - 2
RainbowPlanet/RainbowPlanet/Modules/ShoppingMallModule/Special/ViewController/SpecialViewController.swift

@@ -57,8 +57,8 @@ class SpecialViewController: BaseViewController {
             [weak self] in
             let vc = SearchViewController()
             vc.searchType = .product
-            let nav = BaseNavigationViewController.init(rootViewController: vc)
-            self?.present(nav, animated: true, completion: {
+            let nav = BaseNavigationViewController(rootViewController: vc)
+            self?.navigationController?.present(nav, animated: true, completion: {
                 
             })
         }).disposed(by: disposeBag)

+ 30 - 0
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaNetWorkServiceCommunity.swift

@@ -230,5 +230,35 @@ public class SwiftMoyaNetWorkServiceCommunity: NSObject {
             completion(communityMemberFollowTopicListModel)
         }
     }
+    
+    /// 关注话题(单个)
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicFollowApi(topicId:Int,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(topicId, forKey: "topic_id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared.requestAny(target: MultiTarget(SwiftMoyaServiceCommunityApi.communityMemberFollowTopicFollow(parameters: parameters))) {  (data) in
+            SwiftProgressHUD.shared().hide()
+            completion(data)
+        }
+    }
+    
+    /// 取消关注话题
+    ///
+    /// - Parameters:
+    ///   - topicId: 话题Id
+    ///   - completion: 回调
+    func communityMemberFollowTopicCancelFollowApi(topicId:Int,completion: @escaping apiCallBack) {
+        var parameters = Dictionary<String,Any>()
+        parameters.updateValue(topicId, forKey: "topic_id")
+        SwiftProgressHUD.shared().showWait()
+        SwiftMoyaNetWorkManager.shared.requestAny(target: MultiTarget(SwiftMoyaServiceCommunityApi.communityMemberFollowTopicCancelFollow(parameters: parameters))) {  (data) in
+            SwiftProgressHUD.shared().hide()
+            completion(data)
+        }
+    }
         
 }

+ 33 - 5
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceCommunity/SwiftMoyaServiceCommunityApi.swift

@@ -53,6 +53,14 @@ public let kCommunityPostTopicApi = "/community/post/topic"
 /// 我关注的话题列表
 public let kCommunityMemberFollowTopicListApi = "/community/memberFollowTopic"
 
+// MARK: - 关注话题(单个)
+/// 关注话题(单个)
+public let kCommunityMemberFollowTopicFollowApi = "/community/memberFollowTopic/follow"
+
+// MARK: - 取消关注话题
+/// 取消关注话题
+public let kCommunityMemberFollowTopicCancelFollowApi = "/community/memberFollowTopic/cancel"
+
 /// 社区
 ///
 /// - communityTopicCategory: 话题组列表
@@ -65,7 +73,10 @@ public let kCommunityMemberFollowTopicListApi = "/community/memberFollowTopic"
 /// - communityPostSuggest: 关注页面feed流
 /// - communityTopicDetail: 话题详情
 /// - communityPostTopic: 话题内容列表
-/// - communityMemberFollowTopicList: 话题内容列表
+/// - communityMemberFollowTopicList: 我关注的话题列表
+/// - communityMemberFollowTopicFollow: 关注话题(单个)
+/// - communityMemberFollowTopicCancelFollow: 取消关注话题
+
 public enum SwiftMoyaServiceCommunityApi {
     case communityTopicCategory(parameters:Dictionary<String, Any>)
     case communityMemberFollowTopic(parameters:Dictionary<String, Any>)
@@ -78,6 +89,8 @@ public enum SwiftMoyaServiceCommunityApi {
     case communityTopicDetail(parameters:Dictionary<String, Any>)
     case communityPostTopic(parameters:Dictionary<String, Any>)
     case communityMemberFollowTopicList(parameters:Dictionary<String, Any>)
+    case communityMemberFollowTopicFollow(parameters:Dictionary<String, Any>)
+    case communityMemberFollowTopicCancelFollow(parameters:Dictionary<String, Any>)
 }
 
 extension SwiftMoyaServiceCommunityApi: TargetType {
@@ -94,7 +107,9 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostSuggest,
              .communityTopicDetail,
              .communityPostTopic,
-             .communityMemberFollowTopicList
+             .communityMemberFollowTopicList,
+             .communityMemberFollowTopicFollow,
+             .communityMemberFollowTopicCancelFollow
             :
             return URL(string: kApiDataPrefix())!
         }
@@ -124,13 +139,18 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
             return kCommunityPostTopicApi
         case .communityMemberFollowTopicList:
             return kCommunityMemberFollowTopicListApi
+        case .communityMemberFollowTopicFollow:
+            return kCommunityMemberFollowTopicFollowApi
+        case .communityMemberFollowTopicCancelFollow:
+            return kCommunityMemberFollowTopicCancelFollowApi
         }
     }
     
     public var method: Moya.Method {
         switch self {
         case .communityMemberFollowTopic,
-             .communityPublish
+             .communityPublish,
+             .communityMemberFollowTopicFollow
             :
             return .post
         case .communityTopicCategory,
@@ -144,6 +164,10 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityMemberFollowTopicList
             :
             return .get
+        case .communityMemberFollowTopicCancelFollow
+            :
+            return .delete
+
         }
     }
     
@@ -160,7 +184,9 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostSuggest(var parameters),
              .communityTopicDetail(var parameters),
              .communityPostTopic(var parameters),
-             .communityMemberFollowTopicList(var parameters)
+             .communityMemberFollowTopicList(var parameters),
+             .communityMemberFollowTopicFollow(var parameters),
+             .communityMemberFollowTopicCancelFollow(var parameters)
             :
             let sign = SwiftSign.shared().sign(signType:.AccessToken, parameters: parameters)
             parameters.updateValue(sign, forKey: "sign")
@@ -193,7 +219,9 @@ extension SwiftMoyaServiceCommunityApi: TargetType {
              .communityPostSuggest,
              .communityTopicDetail,
              .communityPostTopic,
-             .communityMemberFollowTopicList
+             .communityMemberFollowTopicList,
+             .communityMemberFollowTopicFollow,
+             .communityMemberFollowTopicCancelFollow
             :
             return (headerParameters(headerType: .tokenHeader) as! [String : String])
         }

+ 2 - 2
RainbowPlanet/RainbowPlanet/Service/SwiftMoyaService/SwiftMoyaServiceApi/SwiftMoyaServiceConfig/SwiftMoyaNetWorkServiceConfig.swift

@@ -27,9 +27,9 @@ class SwiftMoyaNetWorkServiceConfig: NSObject {
     /// - Parameter completion: 回调
     func configApi(completion: @escaping apiCallBack) {
         let parameters = Dictionary<String,Any>()
-        SwiftProgressHUD.shared().showWait()
+//        SwiftProgressHUD.shared().showWait()
         SwiftMoyaNetWorkManager.shared.requestObject(ConfigModel.self,target: MultiTarget(SwiftMoyaServiceConfigApi.configConfig(parameters: parameters))) {(configModel) in
-            SwiftProgressHUD.shared().hide()
+//            SwiftProgressHUD.shared().hide()
             ConfigModel.shared.saveObject(configModel: configModel as! ConfigModel)
             completion(configModel)
         }

+ 22 - 0
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/Contents.json

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

BIN=BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/nav_search_black44px@2x.png


BIN=BIN
RainbowPlanet/RainbowPlanet/Supporting Files/Assets.xcassets/NavigationBarIcons/nav_search_black44px.imageset/nav_search_black44px@3x.png


+ 1 - 2
RainbowPlanet/RainbowPlanet/Tools/MJRefreshEX/UIScrollView+MJRefreshEX.m

@@ -38,8 +38,7 @@ typedef void(^LoadMoreBlock)(NSInteger pageIndex);
             weakSelf.refreshBlock(weakSelf.pageIndex);
         }
         [weakSelf endHeaderRefresh];
-    }];
-    
+    }];    
     
     if (beginRefresh && animation) {
         //有动画的刷新