Procházet zdrojové kódy

我的关注话题

Chris před 5 roky
rodič
revize
c8a6385b63

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

@@ -364,6 +364,8 @@
 		BD1DC6C9228D005000B89C57 /* OrderCreateParameterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */; };
 		BD1DC6CB228D157000B89C57 /* OrderCreateBackModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6CA228D157000B89C57 /* OrderCreateBackModel.swift */; };
 		BD1DC6CD228D160D00B89C57 /* OrderPurchaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1DC6CC228D160D00B89C57 /* OrderPurchaseModel.swift */; };
+		BD1FC17F22B08D3C00D55081 /* CommunityMyFollowTopicController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1FC17E22B08D3C00D55081 /* CommunityMyFollowTopicController.swift */; };
+		BD1FC18122B08D7A00D55081 /* CommunityMyFollowTopicCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1FC18022B08D7A00D55081 /* CommunityMyFollowTopicCell.swift */; };
 		BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */; };
 		BD20F1CD2283C51300677D8E /* OrderFinishPayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CC2283C51300677D8E /* OrderFinishPayController.swift */; };
 		BD20F1CF2283CE2300677D8E /* OrderFinishPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD20F1CE2283CE2300677D8E /* OrderFinishPayView.swift */; };
@@ -806,6 +808,8 @@
 		BD1DC6C8228D005000B89C57 /* OrderCreateParameterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCreateParameterModel.swift; sourceTree = "<group>"; };
 		BD1DC6CA228D157000B89C57 /* OrderCreateBackModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCreateBackModel.swift; sourceTree = "<group>"; };
 		BD1DC6CC228D160D00B89C57 /* OrderPurchaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderPurchaseModel.swift; sourceTree = "<group>"; };
+		BD1FC17E22B08D3C00D55081 /* CommunityMyFollowTopicController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityMyFollowTopicController.swift; sourceTree = "<group>"; };
+		BD1FC18022B08D7A00D55081 /* CommunityMyFollowTopicCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityMyFollowTopicCell.swift; sourceTree = "<group>"; };
 		BD20F1CA2283C12000677D8E /* ShoppingCartListNoneItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartListNoneItemCell.swift; sourceTree = "<group>"; };
 		BD20F1CC2283C51300677D8E /* OrderFinishPayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderFinishPayController.swift; sourceTree = "<group>"; };
 		BD20F1CE2283CE2300677D8E /* OrderFinishPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderFinishPayView.swift; sourceTree = "<group>"; };
@@ -1252,6 +1256,7 @@
 			isa = PBXGroup;
 			children = (
 				A719EE6722AF438E001AAC98 /* Community */,
+				BD1FC17D22B08CEB00D55081 /* CommunityMyFollowTopic */,
 			);
 			path = CommunityModule;
 			sourceTree = "<group>";
@@ -3147,6 +3152,15 @@
 			path = OrderModel;
 			sourceTree = "<group>";
 		};
+		BD1FC17D22B08CEB00D55081 /* CommunityMyFollowTopic */ = {
+			isa = PBXGroup;
+			children = (
+				BD1FC17E22B08D3C00D55081 /* CommunityMyFollowTopicController.swift */,
+				BD1FC18022B08D7A00D55081 /* CommunityMyFollowTopicCell.swift */,
+			);
+			path = CommunityMyFollowTopic;
+			sourceTree = "<group>";
+		};
 		BD3474F722859788000908C5 /* OrderPayOrder */ = {
 			isa = PBXGroup;
 			children = (
@@ -3948,6 +3962,7 @@
 				BD7AB8452284398A0030646A /* OrderPaySelfPickAddInfoCell.swift in Sources */,
 				A72A72D222321E2700B21995 /* Common.swift in Sources */,
 				A70B2C64228875DE00B2449F /* ShopViewShopInfoTableViewCell.swift in Sources */,
+				BD1FC17F22B08D3C00D55081 /* CommunityMyFollowTopicController.swift in Sources */,
 				BDEF7791228571DC00ED0AC0 /* CommonPayView.swift in Sources */,
 				A71AF0A6226EDDC8001730FE /* SearchViewController.swift in Sources */,
 				BD20F1CF2283CE2300677D8E /* OrderFinishPayView.swift in Sources */,
@@ -3964,6 +3979,7 @@
 				BDF47D822282B3D100941AB9 /* ShoppingCartHotSaleTableViewCell.swift in Sources */,
 				BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */,
 				A7B4E756228281620012914A /* ShoppingMallSlidingLeftRightBgCollectionViewCell.swift in Sources */,
+				BD1FC18122B08D7A00D55081 /* CommunityMyFollowTopicCell.swift in Sources */,
 				A757C92E22744ACE00226355 /* AddressManagerListModel.swift in Sources */,
 				BDAA40F9228E9ADA00CF841D /* OrderApplyRefundReasonCell.swift in Sources */,
 				A7274C59228EE636000E3A07 /* LBXScanNetAnimation.swift in Sources */,

+ 105 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/CommunityMyFollowTopicCell.swift

@@ -0,0 +1,105 @@
+//
+//  CommunityMyFollowTopicCell.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/12.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import RxSwift
+import RxCocoa
+
+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)
+        let cell : CommunityMyFollowTopicCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! CommunityMyFollowTopicCell
+        cell.indexPath = indexPath
+        return cell
+    }
+    
+    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+        super.init(style: style, reuseIdentifier: reuseIdentifier)
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    var indexPath: IndexPath? {
+        didSet {
+            
+        }
+    }
+    
+    //MRAK: - 设置View
+    private func setupViews() {
+        self.selectionStyle = .none
+        backgroundColor = kffffffColor
+        
+        addSubview(titleLabel)
+        addSubview(focusButton)
+        addSubview(sepView)
+    }
+    
+    private func setupLayouts() {
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(20)
+            make.left.equalTo(14)
+            make.right.equalToSuperview().offset(-92)
+            make.height.equalTo(21)
+        }
+        focusButton.snp.makeConstraints { (make) in
+            make.top.equalTo(18)
+            make.right.equalToSuperview().offset(-14)
+            make.width.equalTo(64)
+            make.height.equalTo(26)
+        }
+        sepView.snp.makeConstraints { (make) in
+            make.left.equalTo(titleLabel.snp_left)
+            make.right.equalTo(focusButton.snp_right)
+            make.bottom.equalToSuperview()
+            make.height.equalTo(1)
+        }        
+    }
+    
+    private lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.text = "空瓶好物合集"
+        titleLabel.textColor = k333333Color
+        titleLabel.font = kRegularFont15
+        titleLabel.textAlignment = .left
+        return titleLabel
+    }()
+    
+    private lazy var focusButton: UIButton = {
+        let focusButton = UIButton(type: UIButton.ButtonType.custom)
+        focusButton.setImage(kImage(name: "common_uncheck_icon"), for: UIControl.State.normal)
+        focusButton.setImage(kImage(name: "common_check_icon"), for: UIControl.State.selected)
+        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)
+            }
+        }).disposed(by: disposeBag)
+        
+        return focusButton
+    }()
+    
+    private lazy var sepView: UIView = {
+        let sepView = UIView()
+        sepView.backgroundColor = kf5f5f5Color
+        return sepView
+    }()
+    
+}

+ 75 - 0
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityMyFollowTopic/CommunityMyFollowTopicController.swift

@@ -0,0 +1,75 @@
+//
+//  CommunityMyFollowTopicController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/12.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+
+class CommunityMyFollowTopicController: BaseViewController {
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        setupViews()
+        setupLayouts()
+        
+    }
+    
+    override func setupViews() {
+        navigationBar.title = "我的关注话题"
+        view.backgroundColor = kf7f8faColor
+        
+        view.addSubview(tableView)
+    }
+    
+    override func setupLayouts() {
+        tableView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview().offset(kNavBarTotalHeight)
+            make.left.right.bottom.equalTo(0)
+        }
+    }
+    
+    override func setupData() {
+        
+    }
+    
+    lazy var tableView: UITableView = {
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
+        tableView.separatorStyle = .none
+        tableView.backgroundColor = kf7f8faColor
+        tableView.dataSource = self
+        tableView.delegate = self
+        tableView.estimatedRowHeight = 60
+        tableView.estimatedSectionFooterHeight = 0.000001
+        tableView.estimatedSectionHeaderHeight = 0.000001
+        return tableView
+    }()
+}
+
+// MARK: - tableView dataSource && delegate
+extension CommunityMyFollowTopicController: UITableViewDataSource, UITableViewDelegate {
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 3
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let cell = CommunityMyFollowTopicCell.cellWith(tableView: tableView, indexPath: indexPath)
+        cell.focusClickClosure = {
+            [weak self] (isSelected) in
+            print("当前item选中状态为\(isSelected)")
+        }
+        return cell
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        return 60
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 10
+    }
+    
+}