Bladeren bron

添加话题 -- to be continued

Chris 5 jaren geleden
bovenliggende
commit
aeb722b213

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

@@ -440,6 +440,10 @@
 		BD28078222B727BD002AB976 /* PublishEditAddPicCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28078122B727BD002AB976 /* PublishEditAddPicCell.swift */; };
 		BD28078422B76568002AB976 /* PublishEditDefaultCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28078322B76568002AB976 /* PublishEditDefaultCollectionCell.swift */; };
 		BD28078622B765E6002AB976 /* PublishEditAddImgCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28078522B765E6002AB976 /* PublishEditAddImgCollectionCell.swift */; };
+		BD28078D22B76A8C002AB976 /* PublishAddAddressController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28078C22B76A8C002AB976 /* PublishAddAddressController.swift */; };
+		BD28078F22B76A9F002AB976 /* PublishAddTopicController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28078E22B76A9F002AB976 /* PublishAddTopicController.swift */; };
+		BD28079122B770C9002AB976 /* PublishTopicTypeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28079022B770C9002AB976 /* PublishTopicTypeCell.swift */; };
+		BD28079522B7713C002AB976 /* PublishTopicTypeItemCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD28079422B7713C002AB976 /* PublishTopicTypeItemCollectionCell.swift */; };
 		BD29A92E228F99780018CFC3 /* OrderCommentParameterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD29A92D228F99780018CFC3 /* OrderCommentParameterModel.swift */; };
 		BD2FCBE222B21CF70006D974 /* CommunityRecommendController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD2FCBE122B21CF70006D974 /* CommunityRecommendController.swift */; };
 		BD2FCBE422B244250006D974 /* RecommendDetailContentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD2FCBE322B244250006D974 /* RecommendDetailContentCell.swift */; };
@@ -975,6 +979,10 @@
 		BD28078122B727BD002AB976 /* PublishEditAddPicCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishEditAddPicCell.swift; sourceTree = "<group>"; };
 		BD28078322B76568002AB976 /* PublishEditDefaultCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishEditDefaultCollectionCell.swift; sourceTree = "<group>"; };
 		BD28078522B765E6002AB976 /* PublishEditAddImgCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishEditAddImgCollectionCell.swift; sourceTree = "<group>"; };
+		BD28078C22B76A8C002AB976 /* PublishAddAddressController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishAddAddressController.swift; sourceTree = "<group>"; };
+		BD28078E22B76A9F002AB976 /* PublishAddTopicController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishAddTopicController.swift; sourceTree = "<group>"; };
+		BD28079022B770C9002AB976 /* PublishTopicTypeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishTopicTypeCell.swift; sourceTree = "<group>"; };
+		BD28079422B7713C002AB976 /* PublishTopicTypeItemCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PublishTopicTypeItemCollectionCell.swift; sourceTree = "<group>"; };
 		BD29A92D228F99780018CFC3 /* OrderCommentParameterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCommentParameterModel.swift; sourceTree = "<group>"; };
 		BD2FCBE122B21CF70006D974 /* CommunityRecommendController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityRecommendController.swift; sourceTree = "<group>"; };
 		BD2FCBE322B244250006D974 /* RecommendDetailContentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendDetailContentCell.swift; sourceTree = "<group>"; };
@@ -3472,6 +3480,8 @@
 			children = (
 				BD12B67222B4E99800AEB10B /* PublishMediaPicker */,
 				BD28077422B72175002AB976 /* PublishEditController */,
+				BD28078722B769E8002AB976 /* PublishAddTopic */,
+				BD28078922B76A30002AB976 /* PublishAddAddress */,
 			);
 			path = PublishModule;
 			sourceTree = "<group>";
@@ -3658,6 +3668,40 @@
 			path = View;
 			sourceTree = "<group>";
 		};
+		BD28078722B769E8002AB976 /* PublishAddTopic */ = {
+			isa = PBXGroup;
+			children = (
+				BD28078B22B76A5D002AB976 /* View */,
+				BD28078A22B76A55002AB976 /* Controller */,
+			);
+			path = PublishAddTopic;
+			sourceTree = "<group>";
+		};
+		BD28078922B76A30002AB976 /* PublishAddAddress */ = {
+			isa = PBXGroup;
+			children = (
+				BD28078C22B76A8C002AB976 /* PublishAddAddressController.swift */,
+			);
+			path = PublishAddAddress;
+			sourceTree = "<group>";
+		};
+		BD28078A22B76A55002AB976 /* Controller */ = {
+			isa = PBXGroup;
+			children = (
+				BD28078E22B76A9F002AB976 /* PublishAddTopicController.swift */,
+			);
+			path = Controller;
+			sourceTree = "<group>";
+		};
+		BD28078B22B76A5D002AB976 /* View */ = {
+			isa = PBXGroup;
+			children = (
+				BD28079022B770C9002AB976 /* PublishTopicTypeCell.swift */,
+				BD28079422B7713C002AB976 /* PublishTopicTypeItemCollectionCell.swift */,
+			);
+			path = View;
+			sourceTree = "<group>";
+		};
 		BD2FCBDE22B21BE00006D974 /* CommunityRecommendDetail */ = {
 			isa = PBXGroup;
 			children = (
@@ -4259,6 +4303,7 @@
 				A71AF0AE226EF0A3001730FE /* SearchHeaderCollectionReusableView.swift in Sources */,
 				A7636AC52268139C00374F9E /* LocationViewController.swift in Sources */,
 				A7D46090227617D200A5A54E /* SQLModel.swift in Sources */,
+				BD28079522B7713C002AB976 /* PublishTopicTypeItemCollectionCell.swift in Sources */,
 				A72C01222275404A0065E0C3 /* ProvinceCityAreaModel.swift in Sources */,
 				A7FF1579228C82CE00A85748 /* OrderDetailViewController.swift in Sources */,
 				A7FF159C228D9E3D00A85748 /* OrderRefundDetailModel.swift in Sources */,
@@ -4266,6 +4311,8 @@
 				BDF862A2228E41CC000DEF84 /* OrderLogisticsInfoCell.swift in Sources */,
 				A739121D229F75F50033177E /* JXPagingListContainerView.swift in Sources */,
 				A72A7386223396CB00B21995 /* SwiftMoyaNetWorkManager.swift in Sources */,
+				BD28078F22B76A9F002AB976 /* PublishAddTopicController.swift in Sources */,
+				BD28079122B770C9002AB976 /* PublishTopicTypeCell.swift in Sources */,
 				A70B2C252286C03800B2449F /* NXLPageControl.swift in Sources */,
 				A7F2D6C122B0D1CB0093000B /* CommunityFollowTableHeaderView.swift in Sources */,
 				A7C0FE0022B66E5A00BC1E86 /* CommunityFeaturedTopicsViewController.swift in Sources */,
@@ -4591,6 +4638,7 @@
 				BD29A92E228F99780018CFC3 /* OrderCommentParameterModel.swift in Sources */,
 				A7284440224DFACD00F82F30 /* InfoModel.swift in Sources */,
 				A72A72B522321DE000B21995 /* Extension+UITextView.swift in Sources */,
+				BD28078D22B76A8C002AB976 /* PublishAddAddressController.swift in Sources */,
 				BDF47D822282B3D100941AB9 /* ShoppingCartHotSaleTableViewCell.swift in Sources */,
 				BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */,
 				A7B4E756228281620012914A /* ShoppingMallSlidingLeftRightBgCollectionViewCell.swift in Sources */,

+ 9 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddAddress/PublishAddAddressController.swift

@@ -0,0 +1,9 @@
+//
+//  PublishAddAddressController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation

+ 115 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/Controller/PublishAddTopicController.swift

@@ -0,0 +1,115 @@
+//
+//  PublishAddTopicController.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import UIKit
+import RxSwift
+import SwiftyJSON
+import Photos
+
+class PublishAddTopicController: BaseViewController {
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        setupViews()
+        setupData()
+    }
+    
+    override func setupViews() {
+        self.view.backgroundColor = kffffffColor
+        
+        navigationBar.title = ""
+        navigationBar.wr_setRightButton(title: "完成(x/5)", titleColor: k333333Color)
+        navigationBar.onClickRightButton = {
+            [weak self] in
+            print("----点击了完成")
+        }
+        
+        view.addSubview(tableView)
+        tableView.snp.makeConstraints { (make) in
+            make.top.equalToSuperview().offset(kNavBarTotalHeight)
+            make.left.right.bottom.equalToSuperview()
+        }
+    }
+    
+    override func setupData() {
+        
+    }
+    
+    lazy var tableView: UITableView = {
+        let tableView = UITableView(frame: CGRect.zero, style: UITableView.Style.grouped)
+        tableView.separatorStyle = .none
+        tableView.backgroundColor = kffffffColor
+        tableView.dataSource = self
+        tableView.delegate = self
+        tableView.estimatedRowHeight = 0.000001
+        tableView.estimatedSectionFooterHeight = 0.000001
+        tableView.estimatedSectionHeaderHeight = 0.000001
+        return tableView
+    }()
+    
+}
+
+// MARK: - tableView dataSource && delegate
+extension PublishAddTopicController : UITableViewDelegate, UITableViewDataSource {
+    
+    func numberOfSections(in tableView: UITableView) -> Int {
+        return 2
+    }
+    
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        switch section {
+        case 0:
+            return 1
+        case 1:
+            return 6
+        default:
+            return 1
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        switch indexPath.section {
+        case 0:
+            let picCell = PublishEditAddPicCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return picCell
+        case 1:
+            let titleCell = PublishEditTitleCell.cellWith(tableView: tableView, indexPath: indexPath)
+            return titleCell
+        default:
+            return UITableViewCell()
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+        switch indexPath.section {
+        case 0:
+            return 90
+        case 1:
+            return 50
+        default:
+            return 50
+        }
+    }
+    
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
+        return 0
+    }
+    
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
+        return 0.000001
+    }
+    
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
+        return nil
+    }
+    
+}

+ 109 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/View/PublishTopicTypeCell.swift

@@ -0,0 +1,109 @@
+//
+//  PublishTopicTypeCell.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  添加话题--话题类型のCell
+
+import UIKit
+
+class PublishTopicTypeCell: UITableViewCell {
+    
+    typealias ChoosePicBlock = () -> Void
+    var choosePicBlock : ChoosePicBlock?
+    
+    var imgCount: Int = 0
+    var goodsImageArr: Array<UIImage>? {
+        didSet {
+            imgCount = self.goodsImageArr?.count ?? 0
+        }
+    }
+    
+    class func cellWith(tableView:UITableView,indexPath:IndexPath) -> PublishTopicTypeCell {
+        let ID = "PublishTopicTypeCell"
+        tableView.register(PublishTopicTypeCell.self, forCellReuseIdentifier: ID)
+        let cell : PublishTopicTypeCell = tableView.dequeueReusableCell(withIdentifier: ID, for: indexPath) as! PublishTopicTypeCell
+        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
+        
+        addSubview(collectionView)
+    }
+    
+    private func setupLayouts() {
+        collectionView.snp.remakeConstraints { (make) in
+            make.top.equalTo(15)
+            make.bottom.equalTo(-15)
+            make.left.right.equalToSuperview()
+        }
+    }
+    
+    private lazy var collectionView: UICollectionView = {
+        let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: collectionViewLayout)
+        collectionView.backgroundColor = kffffffColor
+        collectionView.delegate = self;
+        collectionView.dataSource = self;
+        collectionView.showsVerticalScrollIndicator = false
+        collectionView.showsHorizontalScrollIndicator = false
+        return collectionView
+    }()
+    
+    private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
+        let collectionViewLayout = UICollectionViewFlowLayout.init()
+        collectionViewLayout.minimumInteritemSpacing = 10
+        collectionViewLayout.scrollDirection = .horizontal
+        return collectionViewLayout
+    }()
+    
+}
+
+extension PublishTopicTypeCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,UICollectionViewDelegate {
+    func numberOfSections(in collectionView: UICollectionView) -> Int {
+        return 1
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+        return 6
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        let cell = PublishTopicTypeItemCollectionCell.cellWith(collectionView: collectionView, indexPath: indexPath)
+        return cell
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
+        return CGSize(width:70, height: 70)
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
+        return UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
+    }
+    
+    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+        if let choosePicBlock = self.choosePicBlock {
+            choosePicBlock()
+        }
+    }
+    
+}

+ 107 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddTopic/View/PublishTopicTypeItemCollectionCell.swift

@@ -0,0 +1,107 @@
+//
+//  PublishTopicTypeItemCollectionCell.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/6/17.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//  编辑发布--添加照片のCell(有图)
+
+import UIKit
+import RxSwift
+
+class PublishTopicTypeItemCollectionCell: UICollectionViewCell {
+    
+    let disposeBag = DisposeBag()
+    
+    var showImage: UIImage? {
+        didSet {
+            if self.showImage != nil {
+                picImageView.image = self.showImage
+            }
+        }
+    }
+    
+    var productSearchModel: ProductSearchModel? {
+        didSet {
+            picImageView.kf.setImage(with: kURLImage(name: productSearchModel?.img ?? "pic_preload"), placeholder: kImage(name: "pic_preload"))
+        }
+    }
+    
+    typealias DelPicBlock = (_ idxRow:Int?) -> Void
+    var delPicBlock : DelPicBlock?
+    
+    class func cellWith(collectionView:UICollectionView,indexPath:IndexPath) -> PublishTopicTypeItemCollectionCell {
+        let ID = "PublishTopicTypeItemCollectionCell"
+        collectionView.register(PublishTopicTypeItemCollectionCell.self, forCellWithReuseIdentifier: ID)
+        let cell : PublishTopicTypeItemCollectionCell = collectionView.dequeueReusableCell(withReuseIdentifier: ID, for: indexPath) as! PublishTopicTypeItemCollectionCell
+        cell.indexPath = indexPath
+        return cell
+    }
+    //MARK: - indexPath
+    var indexPath: IndexPath?{
+        didSet {
+            
+        }
+    }
+    //MARK: - 初始化
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        cornerRadius = 2
+        masksToBounds = true
+        setupViews()
+        setupLayouts()
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    //MRAK: - 设置View
+    private func setupViews() {
+        addSubview(picImageView)
+        addSubview(titleLabel)
+        addSubview(focusView)
+        
+        backgroundColor = UIColor.green
+    }
+    
+    private func setupLayouts() {
+        picImageView.snp.makeConstraints { (make) in
+            make.edges.equalToSuperview()
+        }
+        titleLabel.snp.makeConstraints { (make) in
+            make.top.equalTo(39)
+            make.height.equalTo(20)
+            make.centerX.equalToSuperview()
+        }
+        focusView.snp.makeConstraints { (make) in
+            make.top.equalTo(titleLabel.snp_bottom).offset(3)
+            make.width.equalTo(20)
+            make.height.equalTo(3)
+            make.centerX.equalToSuperview()
+        }
+    }
+    
+    private lazy var picImageView: UIImageView = {
+        let picImageView = UIImageView()
+        return picImageView
+    }()
+    
+    private lazy var titleLabel: UILabel = {
+        let titleLabel = UILabel()
+        titleLabel.textColor = kffffffColor
+        titleLabel.font = kMediumFont14
+        titleLabel.textAlignment = .center
+        titleLabel.numberOfLines = 1
+        return titleLabel
+    }()
+    
+    private lazy var focusView: UIView = {
+        let focusView = UIView()
+        focusView.backgroundColor = kffffffColor
+        focusView.cornerRadius = 2
+        focusView.masksToBounds = true
+        return focusView
+    }()
+    
+}

+ 27 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEditController/Controller/PublishEditController.swift

@@ -92,6 +92,33 @@ extension PublishEditController : UITableViewDelegate, UITableViewDataSource {
         }
     }
     
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        switch indexPath.row {
+//        case 0:
+//            let picCell = PublishEditAddPicCell.cellWith(tableView: tableView, indexPath: indexPath)
+//            return picCell
+//        case 1:
+//            let titleCell = PublishEditTitleCell.cellWith(tableView: tableView, indexPath: indexPath)
+//            return titleCell
+//        case 2:
+//            let desCell = PublishEditDescribeCell.cellWith(tableView: tableView, indexPath: indexPath)
+//            //            actCell.allSelectBlock = {
+//            //                [weak self] (isAllSel) in
+//            //                self?.isAllSelected = isAllSel
+//            //                self?.allSelectedAction(isAllSel)
+//            //            }
+//            return desCell
+        case 3:
+            let vc = PublishAddTopicController()
+            self.navigationController?.pushViewController(vc, animated: true)
+//        case 4:
+//            let addrCell = PublishEditAddAddressCell.cellWith(tableView: tableView, indexPath: indexPath)
+//            return addrCell
+        default:
+            print("----点击了-\(indexPath.row)")
+        }
+    }
+    
     func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
         switch indexPath.row {
         case 0:

+ 3 - 15
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEditController/View/PublishEditAddPicCell.swift

@@ -77,22 +77,10 @@ class PublishEditAddPicCell: UITableViewCell {
     private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
         let collectionViewLayout = UICollectionViewFlowLayout.init()
         collectionViewLayout.minimumInteritemSpacing = 10
+        collectionViewLayout.scrollDirection = .horizontal
         return collectionViewLayout
     }()
     
-    //加载数据
-    func reloadData() {
-        //collectionView重新加载数据
-        self.collectionView.reloadData()
-        //更新collectionView的高度约束
-        let contentSize = self.collectionView.collectionViewLayout.collectionViewContentSize
-        collectionView.snp.remakeConstraints { (make) in
-            make.top.equalTo(15)
-            make.bottom.equalTo(-15)
-            make.left.right.equalToSuperview()
-        }
-        self.collectionView.collectionViewLayout.invalidateLayout()
-    }
 }
 
 extension PublishEditAddPicCell: UICollectionViewDelegateFlowLayout,UICollectionViewDataSource,UICollectionViewDelegate {
@@ -105,7 +93,7 @@ extension PublishEditAddPicCell: UICollectionViewDelegateFlowLayout,UICollection
             return imgCount+1
         } else {
             return maxImageCount
-        }
+        }        
     }
     
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
@@ -139,7 +127,7 @@ extension PublishEditAddPicCell: UICollectionViewDelegateFlowLayout,UICollection
     }
     
     func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
-        return UIEdgeInsets(top: 0, left: 14, bottom: 0, right: -14)
+        return UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)
     }
     
     func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {