Przeglądaj źródła

关注列表完善

南鑫林 5 lat temu
rodzic
commit
07e38bb529

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/View/Cell/FollowStatus/CommunityFollowStatusTableViewCell.swift

@@ -13,6 +13,9 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
     
     let disposeBag = DisposeBag()
     
+    typealias FollowClosure = () -> Void
+    var followClosure : FollowClosure?
+    
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> CommunityFollowStatusTableViewCell {
         let ID = "CommunityFollowStatusTableViewCell"
         tableView.register(CommunityFollowStatusTableViewCell.self, forCellReuseIdentifier: ID)
@@ -178,6 +181,7 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         oneCardView.cornerRadius = 4
         oneCardView.masksToBounds = true
         oneCardView.isHidden = true
+        oneCardView.addTapGesture(1, target: self, action: #selector(contentDetail))
         return oneCardView
     }()
     
@@ -223,6 +227,8 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         twoCardView.isHidden = true
         twoCardView.cornerRadius = 4
         twoCardView.masksToBounds = true
+        twoCardView.addTapGesture(1, target: self, action: #selector(contentDetail))
+
         return twoCardView
     }()
     
@@ -254,6 +260,7 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         threeCardView.isHidden = true
         threeCardView.cornerRadius = 4
         threeCardView.masksToBounds = true
+        threeCardView.addTapGesture(1, target: self, action: #selector(contentDetail))
         return threeCardView
     }()
     
@@ -407,4 +414,10 @@ class CommunityFollowStatusTableViewCell: UITableViewCell {
         }
     }
     
+    
+    /// 内容详情页面
+    @objc func contentDetail() {
+        NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CommunityContentDetailClosure"), object: nil)
+    }
+    
 }

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

@@ -133,7 +133,7 @@ class CommunityRecommendFollowCollectionViewCell: UICollectionViewCell {
             case .futureFollow?:
                 followButton.setTitle("关注", for: UIControl.State.normal)
                 followButton.setTitleColor(kThemeColor, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "shopping_cart_trade_finish"), for: UIControl.State.normal)
+                followButton.setImage(kImage(name: "my_arrows_unfold"), 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)
@@ -142,7 +142,7 @@ class CommunityRecommendFollowCollectionViewCell: UICollectionViewCell {
             case .alreadyFollow?:
                 followButton.setTitle("关注", for: UIControl.State.normal)
                 followButton.setTitleColor(k333333Color, for: UIControl.State.normal)
-                followButton.setImage(kImage(name: "shopping_cart_trade_finish"), for: UIControl.State.normal)
+                followButton.setImage(kImage(name: "my_arrows_unfold"), 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)

+ 19 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/CommunityListViewController.swift

@@ -76,6 +76,10 @@ class CommunityListViewController: UIViewController {
         return followTableHeaderView
     }()
     
+    /// 关注接口
+    func followData(indexPath: IndexPath) {
+        tableView.reloadRows(at: [indexPath], with: UITableView.RowAnimation.none)
+    }
 
 }
 
@@ -114,16 +118,31 @@ extension CommunityListViewController : UITableViewDelegate,UITableViewDataSourc
                 let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.followUserStatus = .follow
                 cell.followType = .futureFollow
+                //关注状态
+                cell.followClosure = {
+                    [weak self] in
+                    self?.followData(indexPath: indexPath)
+                }
                 return cell
             case 2:
                 let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.followUserStatus = .follow
                 cell.followType = .alreadyFollow
+                //关注状态
+                cell.followClosure = {
+                    [weak self] in
+                    self?.followData(indexPath: indexPath)
+                }
                 return cell
             case 3:
                 let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
                 cell.followUserStatus = .follow
                 cell.followType = .mutualFollow
+                //关注状态
+                cell.followClosure = {
+                    [weak self] in
+                    self?.followData(indexPath: indexPath)
+                }
                 return cell
             case 4:
                 let cell = CommunityFollowStatusTableViewCell.cellWith(tableView: tableView, indexPath: indexPath)

+ 5 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/Community/ViewController/CommunityViewController.swift

@@ -83,6 +83,11 @@ class CommunityViewController: BaseViewController {
             
         }
         
+        // 内容详情页面
+        observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("CommunityContentDetailClosure"), object: nil, queue: OperationQueue.main) {(notification) in
+            
+        }
+        
         
     }