Bläddra i källkod

Merge branch 'feature/dev_Chris' into develop

Chris 5 år sedan
förälder
incheckning
1db922da4a

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

@@ -652,6 +652,7 @@
 		BDF47D872282C92200941AB9 /* ShoppingCartListTableViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF47D862282C92200941AB9 /* ShoppingCartListTableViewHeader.swift */; };
 		BDF7C5D922D70B6E007F3B79 /* CommunityVideoMajorCommentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF7C5D822D70B6E007F3B79 /* CommunityVideoMajorCommentCell.swift */; };
 		BDF7C5DB22D72405007F3B79 /* CommunityVideoSubCommentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF7C5DA22D72405007F3B79 /* CommunityVideoSubCommentController.swift */; };
+		BDF7CAD022DC920A007CD5F4 /* SwiftLocationPOIModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF7CACF22DC920A007CD5F4 /* SwiftLocationPOIModel.swift */; };
 		BDF8629C228E4125000DEF84 /* OrderCommentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF8629B228E4125000DEF84 /* OrderCommentController.swift */; };
 		BDF862A1228E41CC000DEF84 /* OrderLogisticsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF8629E228E41CC000DEF84 /* OrderLogisticsController.swift */; };
 		BDF862A2228E41CC000DEF84 /* OrderLogisticsInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDF862A0228E41CC000DEF84 /* OrderLogisticsInfoCell.swift */; };
@@ -1432,6 +1433,7 @@
 		BDF47D862282C92200941AB9 /* ShoppingCartListTableViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShoppingCartListTableViewHeader.swift; sourceTree = "<group>"; };
 		BDF7C5D822D70B6E007F3B79 /* CommunityVideoMajorCommentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityVideoMajorCommentCell.swift; sourceTree = "<group>"; };
 		BDF7C5DA22D72405007F3B79 /* CommunityVideoSubCommentController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommunityVideoSubCommentController.swift; sourceTree = "<group>"; };
+		BDF7CACF22DC920A007CD5F4 /* SwiftLocationPOIModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLocationPOIModel.swift; sourceTree = "<group>"; };
 		BDF8629B228E4125000DEF84 /* OrderCommentController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrderCommentController.swift; sourceTree = "<group>"; };
 		BDF8629E228E41CC000DEF84 /* OrderLogisticsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderLogisticsController.swift; sourceTree = "<group>"; };
 		BDF862A0228E41CC000DEF84 /* OrderLogisticsInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderLogisticsInfoCell.swift; sourceTree = "<group>"; };
@@ -3214,6 +3216,7 @@
 				A79057052276EA3D0037F823 /* OpenCityListModel.swift */,
 				A757C92F2274839900226355 /* SelfMentionAddressListModel.swift */,
 				BDD22F0A228FAA5B00D43BFB /* ImageUrlModel.swift */,
+				BDF7CACF22DC920A007CD5F4 /* SwiftLocationPOIModel.swift */,
 			);
 			path = ConfigModel;
 			sourceTree = "<group>";
@@ -6333,6 +6336,7 @@
 				BD6122FD22C36B0F00D3F513 /* AlivcBaseViewController.m in Sources */,
 				BD0FAA6522C4C35E00DDFB37 /* AliyunCycleProgressView.m in Sources */,
 				A7AA9F6322C62B270086498B /* CommunityRecommnendViewController.swift in Sources */,
+				BDF7CAD022DC920A007CD5F4 /* SwiftLocationPOIModel.swift in Sources */,
 				BDF47D822282B3D100941AB9 /* ShoppingCartHotSaleTableViewCell.swift in Sources */,
 				A7D5F22922BB686200F8E9AF /* BaseJSWebBaseViewController.swift in Sources */,
 				BD20F1CB2283C12000677D8E /* ShoppingCartListNoneItemCell.swift in Sources */,

+ 14 - 3
RainbowPlanet/RainbowPlanet/Manager/MapManager/BaiduMapManager/BaiduMapManager.swift

@@ -33,7 +33,6 @@ public class BaiduMapManager: NSObject {
     public func initBaiduMap() -> Void {
         BMKLocationAuth.sharedInstance()?.checkPermision(withKey: kBaiduMapAppKey, authDelegate: self)
         BMKMapManager().start(kBaiduMapAppKey, generalDelegate: self)
-        startLocation()
     }
     
 // ====================================定位========================================
@@ -94,9 +93,21 @@ public class BaiduMapManager: NSObject {
                         self?.locationModel.district = rgcData.district ?? ""
                         self?.locationModel.street = rgcData.street ?? ""
                         self?.locationModel.locationdescribe = rgcData.locationDescribe ?? ""
+                        
+                        // 存放BMKLocationPoi的Array不可直接转换为Json(暂不知具体原因),建立一个Swift对应的Model
+                        var poiList: Array<SwiftLocationPOIModel> = []
+                        let oriPoiList = rgcData.poiList ?? []
+                        for (_, locationPoi) in oriPoiList.enumerated()  {
+                            let poiMdl: SwiftLocationPOIModel = SwiftLocationPOIModel()
+                            poiMdl.name = locationPoi.name
+                            poiMdl.uid  = locationPoi.uid
+                            poiList.append(poiMdl)
+                        }
+                        self?.locationModel.poiList = poiList
                     }
-                    LocationModel.shared().setLocationModel(locationModel:  (self?.locationModel)!)
-                    NXLLog(LocationModel.shared().getLocationModel())
+                    
+                    LocationModel.shared().saveObject(locationModel: self?.locationModel ?? LocationModel())
+                    NXLLog(LocationModel.shared().object())
                     locationSuccessBlock()
                 }
             }

+ 40 - 57
RainbowPlanet/RainbowPlanet/Manager/MapManager/BaiduMapManager/LocationModel.swift

@@ -7,15 +7,15 @@
 //
 
 import UIKit
+import ObjectMapper
+import SwiftyJSON
 
 /// 百度定位
 let kLocationModelCache = "LocationModel"
 
-class LocationModel: NSObject,NSCoding {
+class LocationModel: NSObject,Mappable {
 
-    private static let _sharedInstance = LocationModel()
-
-    override init() {} // 私有化init方法
+    static let _sharedInstance = LocationModel()
 
     class func shared() -> LocationModel {
         return _sharedInstance
@@ -45,71 +45,54 @@ class LocationModel: NSObject,NSCoding {
     var adCode = "610113"
     ///位置语义化结果的定位点在什么地方周围的描述信息
     var locationdescribe = "在西安北大科技园曲江创客大街园区附近"
+    ///位置语义化结果的属性,该定位点周围的poi列表信息
+    var poiList: Array<SwiftLocationPOIModel> = []
     
-    /// 反归档
-    ///
-    /// - Parameter decoder: 反编码值
-    required init?(coder aDecoder: NSCoder) {
-        self.latitude = aDecoder.decodeObject(forKey: "latitude") as? String ?? ""
-        self.longitude = aDecoder.decodeObject(forKey: "longitude") as? String ?? ""
-        self.country = aDecoder.decodeObject(forKey: "country") as? String ?? ""
-        self.countryCode = aDecoder.decodeObject(forKey: "countryCode") as? String ?? ""
-        self.province = aDecoder.decodeObject(forKey: "province") as? String ?? ""
-        self.city = aDecoder.decodeObject(forKey: "city") as? String ?? ""
-        self.district = aDecoder.decodeObject(forKey: "district") as? String ?? ""
-        self.street = aDecoder.decodeObject(forKey: "street") as? String ?? ""
-        self.streetNumber = aDecoder.decodeObject(forKey: "streetNumber") as? String ?? ""
-        self.cityCode = aDecoder.decodeObject(forKey: "cityCode") as? String ?? ""
-        self.adCode = aDecoder.decodeObject(forKey: "adCode") as? String ?? ""
-        self.locationdescribe = aDecoder.decodeObject(forKey: "locationdescribe") as? String ?? ""
-
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return LocationModel()
     }
-
-    /// 归档
-    ///
-    /// - Parameter aCoder: 归档值
-    func encode(with aCoder: NSCoder) {
-        aCoder.encode(self.latitude, forKey:"latitude")
-        aCoder.encode(self.longitude, forKey:"longitude")
-        aCoder.encode(self.country, forKey:"country")
-        aCoder.encode(self.countryCode, forKey:"countryCode")
-        aCoder.encode(self.province, forKey:"province")
-        aCoder.encode(self.city, forKey:"city")
-        aCoder.encode(self.district, forKey:"district")
-        aCoder.encode(self.street, forKey:"locationDescribe")
-        aCoder.encode(self.streetNumber, forKey:"streetNumber")
-        aCoder.encode(self.cityCode, forKey:"cityCode")
-        aCoder.encode(self.adCode, forKey:"adCode")
-        aCoder.encode(self.locationdescribe, forKey:"locationdescribe")
-
+    required init?(map: Map){}
+    override init(){}
+    
+    func mapping(map: Map)
+    {
+        latitude <- map["latitude"]
+        longitude <- map["longitude"]
+        country <- map["country"]
+        countryCode <- map["countryCode"]
+        province <- map["province"]
+        city <- map["city"]
+        district <- map["district"]
+        street <- map["street"]
+        streetNumber <- map["streetNumber"]
+        cityCode <- map["cityCode"]
+        adCode <- map["adCode"]
+        locationdescribe <- map["locationdescribe"]
+        poiList <- map["poiList"]
     }
+    
 
     /// 存储定位信息
-    ///
-    /// - Parameter locationModel: 定位模型
-    func setLocationModel(locationModel:LocationModel) -> Void {
-        //实例对象转换成Data
-        let modelData = NSKeyedArchiver.archivedData(withRootObject: locationModel)
-        //存储Data对象
-        UserDefaults.standard.set(modelData, forKey: kLocationModelCache)
+    func saveObject(locationModel: LocationModel) {
+        var model = CacheModel()
+        model.data = jsonToData(jsonDic: locationModel.toJSON())
+        CacheManager.default.setObjectSync(model, forKey: "LocationModel")
+    }
+    
+    func object() -> LocationModel? {
+        let model = CacheManager.default.objectSync(forKey: "LocationModel")
+        let json = try? JSON(data: model?.data ?? Data())
+        return LocationModel(JSONString: json?.description ?? "")
     }
 
-
+    
     /// 获取定位信息
     ///
     /// - Returns: 定位模型
     func getLocationModel() -> LocationModel? {
-        //自定义对象读取
-        let modelData = UserDefaults.standard.data(forKey: kLocationModelCache)
-        var locationModel = LocationModel()
-        if modelData != nil {
-            locationModel = NSKeyedUnarchiver.unarchiveObject(with: modelData!) as! LocationModel
-        }
-        _ = toString()
-        return locationModel
+        return object()
     }
-    
-    
 
     func toString() -> String {
         let str = self.country +

+ 34 - 0
RainbowPlanet/RainbowPlanet/Model/ConfigModel/SwiftLocationPOIModel.swift

@@ -0,0 +1,34 @@
+//
+//  SwiftLocationPOIModel.swift
+//  RainbowPlanet
+//
+//  Created by Christopher on 2019/7/15.
+//  Copyright © 2019 RainbowPlanet. All rights reserved.
+//
+
+import Foundation
+import ObjectMapper
+
+
+class SwiftLocationPOIModel : NSObject, Mappable{
+    
+    ///BMKLocationPoi的id属性
+    var uid : String?
+    
+    ///BMKLocationPoi的名字属性
+    var name : String?
+    
+    class func newInstance(map: Map) -> Mappable?{
+        return SwiftLocationPOIModel()
+    }
+    required init?(map: Map){}
+    override init(){}
+    
+    func mapping(map: Map)
+    {
+        uid <- map["uid"]
+        name <- map["name"]
+    }
+    
+}
+

+ 44 - 8
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/View/CommunityVideoCoverCollectionCell.swift

@@ -697,7 +697,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
     
     // MARK: - 播放动作
     func play() {
-        playStatusImageView.isHidden = true
+        playStatusImageView.isHidden = true        
         videoPlayView.play()
     }
     
@@ -722,7 +722,6 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
             
             beanLabel.text = "\(self.videoItemMdl?.willCollectBean ?? 0)彩虹豆待收获"
             
-            
             avatarButton.kf.setImage(with: kURLImage(name: self.videoItemMdl?.avatar ?? ""), for: .normal, placeholder: kImage(name: "default_avatar"))
             personLabel.text = self.videoItemMdl?.username
             
@@ -764,7 +763,7 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
             topicView.topicArray = self.videoItemMdl?.topic
             topicView.reloadData()
             
-//            contentLabel.text = self.videoItemMdl?.content
+            self.remakePlayViewConstrains()
             
             self.addSeeMoreButton(contentLabel, textStr: self.videoItemMdl?.content)
             
@@ -774,10 +773,50 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
         }
     }
     
-    func remakeBottomConstrains() {
+    // 根据返回url中包含的size,重新计算约束播放视图高度
+    func remakePlayViewConstrains() {
+        let imgUrlStr: String = self.videoItemMdl?.img ?? ""
+        
+        var leadingIdx = imgUrlStr.firstIndex(of: "*") ?? imgUrlStr.endIndex
+        leadingIdx = imgUrlStr.index(leadingIdx, offsetBy: 1)
+        let cutLeadUrl = imgUrlStr.suffix(from: leadingIdx)
+        
+        let trailingIdx = cutLeadUrl.firstIndex(of: ".") ?? cutLeadUrl.endIndex
+        let sizeStr = cutLeadUrl.prefix(upTo: trailingIdx)
         
+        let arraySubstrings: [Substring] = sizeStr.split(separator: "_")
+        let widthStr  = arraySubstrings[0]
+        let heightStr = arraySubstrings[1]
+        
+        let doubleWidth = Double(widthStr)
+        let fWidth = CGFloat(doubleWidth ?? 0)
+        
+        let doubleHeight = Double(heightStr)
+        let fHeight = CGFloat(doubleHeight ?? 0)
+        
+        let videoRatio : CGFloat = fHeight/fWidth
+        let screenRatio: CGFloat = kScreenHeight/kScreenWidth
+        if videoRatio > screenRatio {
+            let vWidth = kScreenHeight/fHeight*fWidth
+            self.videoPlayView.snp.remakeConstraints { (make) in
+                make.top.bottom.equalToSuperview()
+                make.centerX.equalToSuperview()
+                make.width.equalTo(vWidth)
+            }
+        } else{
+            let vHeight = kScreenWidth/fWidth*fHeight
+            self.videoPlayView.snp.remakeConstraints { (make) in
+                make.left.right.equalToSuperview()
+                make.centerY.equalToSuperview()
+                make.height.equalTo(vHeight)
+            }
+        }
+    }
+    
+    func remakeBottomConstrains() {
         let size: CGSize = contentLabel.sizeThatFits(CGSize(width: kScreenWidth-28, height: CGFloat(MAXFLOAT)))
-        print("------size == \(size)")
+        contentScrollView.contentSize = CGSize.init(width: kScreenWidth-28.0, height: size.height)
+        print("------bottomSize == \(size)")
         
         if size.height > 40 {
             // 超过2行
@@ -799,9 +838,6 @@ class CommunityVideoCoverCollectionCell: UICollectionViewCell {
             }
         }
         
-        
-        
-        
     }
     
 }

+ 9 - 7
RainbowPlanet/RainbowPlanet/Modules/CommunityModule/CommunityVideoContent/ViewController/CommunityVideoListController.swift

@@ -256,7 +256,7 @@ extension CommunityVideoListController: UICollectionViewDelegateFlowLayout,UICol
 // MARK: -
 extension CommunityVideoListController {
     
-    func startPlay(_ cell: CommunityVideoCoverCollectionCell?) {
+    func startPlay(_ cell: CommunityVideoCoverCollectionCell?) {        
         cell?.play()
     }
     
@@ -267,12 +267,14 @@ extension CommunityVideoListController {
     }
     
     func playFirstVideoWhenViewDidAppeared() {
-        let showCells = collectionView.visibleCells
-        for tmpCell in showCells {
-            let videoCell = tmpCell as? CommunityVideoCoverCollectionCell
-            startPlay(videoCell)
-            prePlayCell = videoCell
-            break
+        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(0.2 * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)) { () -> Void in
+            let showCells = self.collectionView.visibleCells
+            for tmpCell in showCells {
+                let videoCell = tmpCell as? CommunityVideoCoverCollectionCell
+                self.startPlay(videoCell)
+                self.prePlayCell = videoCell
+                break
+            }
         }
     }
     

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

@@ -18,12 +18,25 @@ class PublishAddAddressController: BaseViewController {
     var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
     /// 经度
     var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
+    /// poiList
+    var poiList: Array<SwiftLocationPOIModel> = LocationModel.shared().object()?.poiList ?? []
     
     override func viewDidLoad() {
         super.viewDidLoad()
         setupViews()
         setupLayouts()
         
+        BaiduMapManager.shared.startLocation()
+        BaiduMapManager.shared.locationSuccessBlock =  {
+            [weak self] in
+            print("----定位成功")
+            self?.poiList = LocationModel.shared().object()?.poiList ?? []
+            self?.addressPOIView.poiList = self?.poiList
+        }
+        BaiduMapManager.shared.locationFalseBlock =  {
+            [weak self] in
+            SwiftProgressHUD.shared().showText("定位失败")
+        }
     }
     
     override func setupViews() {

+ 12 - 35
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddAddress/PublishAddressPOICell.swift

@@ -11,10 +11,7 @@ import RxSwift
 import RxCocoa
 
 class PublishAddressPOICell: UITableViewCell {
-    
-    
-    typealias RefreshButtonBlock = () -> Void
-    var refreshButtonBlock : RefreshButtonBlock?
+        
     let disposeBag = DisposeBag()
     
     class func cellWith(tableView:UITableView,indexPath:IndexPath) -> PublishAddressPOICell {
@@ -37,21 +34,27 @@ class PublishAddressPOICell: UITableViewCell {
     
     //MARK: - indexPath
     var indexPath: IndexPath?{
+        didSet {
+            
+        }
+    }
+    
+    var suggestionInfo: BMKSuggestionInfo? {
         didSet {
             switch indexPath?.section {
-            case 0:
-                self.refreshButton.isHidden = false
+            case 1:
+                titleLabel.text = self.suggestionInfo!.district + self.suggestionInfo!.key
             default:
-                self.refreshButton.isHidden = true
+                break
             }
         }
     }
     
-    var suggestionInfo: BMKSuggestionInfo? {
+    var poiInfo: SwiftLocationPOIModel? {
         didSet {
             switch indexPath?.section {
             case 1:
-                titleLabel.text = self.suggestionInfo!.district + self.suggestionInfo!.key
+                titleLabel.text = self.poiInfo?.name
             default:
                 break
             }
@@ -73,7 +76,6 @@ class PublishAddressPOICell: UITableViewCell {
     private func setupViews() {
         self.selectionStyle = .none
         addSubview(titleLabel)
-        addSubview(refreshButton)
         addSubview(bottomLineLabel)
     }
     
@@ -84,13 +86,6 @@ class PublishAddressPOICell: UITableViewCell {
             make.right.equalTo(-14)
             make.height.equalTo(21)
         }
-        refreshButton.snp.makeConstraints { (make) in
-            make.top.equalTo(titleLabel)
-            make.right.equalToSuperview().offset(kScaleValue(value: -14))
-            make.width.equalTo(kScaleValue(value: 46))
-            
-        }
-        refreshButton.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 2)
         
         bottomLineLabel.snp.makeConstraints { (make) in
             make.bottom.equalToSuperview()
@@ -110,24 +105,6 @@ class PublishAddressPOICell: UITableViewCell {
         return titleLabel
     }()
     
-    private lazy var refreshButton : UIButton = {
-        let refreshButton = UIButton()
-        refreshButton.setImage(kImage(name: "navbar_refresh"), for: UIControl.State.normal)
-        refreshButton.setTitle("刷新", for: UIControl.State.normal)
-        refreshButton.setTitleColor(kFFA42FColor, for: UIControl.State.normal)
-        refreshButton.titleLabel?.font = kRegularFont14
-        refreshButton.isHidden = true
-        refreshButton.rx.tap.subscribe(onNext: { [weak self] (data) in
-            if self?.indexPath?.section == 0 {
-                if let refreshButtonBlock = self?.refreshButtonBlock {
-                    refreshButtonBlock()
-                }
-            }
-            
-        }).disposed(by: disposeBag)
-        return refreshButton
-    }()
-    
     private lazy var bottomLineLabel: UILabel = {
         let bottomLineLabel = UILabel()
         bottomLineLabel.backgroundColor = kf5f5f5Color

+ 27 - 24
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishAddAddress/PublishAddressPOIView.swift

@@ -26,7 +26,12 @@ class PublishAddressPOIView: BaseView {
     var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
     /// 经度
     var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
-    
+    /// poiList
+    var poiList: Array<SwiftLocationPOIModel>? {
+        didSet {
+            self.tableView.reloadData()
+        }
+    }
     
     
     override func setupViews() {
@@ -144,7 +149,7 @@ extension PublishAddressPOIView:UITableViewDataSource,UITableViewDelegate {
             if self.suggestionList != nil {
                 return self.suggestionList!.count
             }else {
-                return 0
+                return self.poiList?.count ?? 0
             }
         default:
             return 1
@@ -156,20 +161,13 @@ extension PublishAddressPOIView:UITableViewDataSource,UITableViewDelegate {
         switch indexPath.section {
         case 0:
             cell.locationAddress = locationAddress
-            cell.refreshButtonBlock = {
-                BaiduMapManager.shared.startLocation()
-                BaiduMapManager.shared.locationSuccessBlock = {
-                    [weak self] in
-                    let locationModel = LocationModel.shared().getLocationModel()
-                    self?.locationAddress = locationModel?.toString()
-                }
-                BaiduMapManager.shared.locationFalseBlock = {
-                    SwiftProgressHUD.shared().showText("定位失败\n重新定位", textAlignment: NSTextAlignment.center)
-                }
-            }
             break
         default:
-            cell.suggestionInfo = self.suggestionList?[indexPath.row]
+            if self.suggestionList != nil {
+                cell.suggestionInfo = self.suggestionList?[indexPath.row]
+            }else {
+                cell.poiInfo = self.poiList?[indexPath.row]
+            }
             break
         }
         return cell
@@ -180,18 +178,23 @@ extension PublishAddressPOIView:UITableViewDataSource,UITableViewDelegate {
         if let didSelectBlock = self.didSelectBlock {
             switch indexPath.section {
             case 0:
-                didSelectBlock(self.latitude,self.longitude,self.locationAddress ?? "")
                 break
             default:
-                let locationModel = LocationModel.shared().getLocationModel()
-                let suggestionList = self.suggestionList?[indexPath.row]
-                let city = suggestionList?.city ?? ""
-                let district = suggestionList?.district ?? ""
-                let key = suggestionList?.key ?? ""
-                let latitude = "\(suggestionList?.location.latitude ?? 0)"
-                let longitude = "\(suggestionList?.location.longitude ?? 0)"
-                let toString = locationModel!.province  + city + district  + key
-                didSelectBlock(latitude,longitude,toString)
+                if self.suggestionList != nil {
+                    let locationModel = LocationModel.shared().getLocationModel()
+                    let suggestionList = self.suggestionList?[indexPath.row]
+                    let city = suggestionList?.city ?? ""
+                    let district = suggestionList?.district ?? ""
+                    let key = suggestionList?.key ?? ""
+                    let latitude = "\(suggestionList?.location.latitude ?? 0)"
+                    let longitude = "\(suggestionList?.location.longitude ?? 0)"
+                    let toString = locationModel!.province  + city + district  + key
+                    didSelectBlock(latitude,longitude,toString)
+                }else {
+                    let selPoiName = self.poiList?[indexPath.row].name
+                    let locationModel = LocationModel.shared().getLocationModel()
+                    didSelectBlock(locationModel!.latitude, locationModel!.longitude, selPoiName ?? "")
+                }
                 break
             }
         }

+ 17 - 1
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEditController/View/PublishEditAddAddressCell.swift

@@ -13,11 +13,19 @@ class PublishEditAddAddressCell: UITableViewCell {
     var location: String? {
         didSet {
             if self.location != "" {
+                titleLabel.text = ""
                 subLabel.text = self.location
                 iconImageView.image = kImage(name: "edit_ico_address_pre")
+                subLabel.textColor = k333333Color
+                subLabel.font = kRegularFont14
+                remakeSubLabelWithLeading(36)
             } else {
+                titleLabel.text = "添加地点"
                 subLabel.text = "(打卡地点,结识附近的彩虹居民)"
                 iconImageView.image = kImage(name: "edit_ico_address")
+                subLabel.textColor = kDDDDDDColor
+                subLabel.font = kRegularFont12
+                remakeSubLabelWithLeading(102)
             }
         }
     }
@@ -91,7 +99,6 @@ class PublishEditAddAddressCell: UITableViewCell {
     
     private lazy var titleLabel: UILabel = {
         let titleLabel = UILabel()
-        titleLabel.text = "添加地点"
         titleLabel.textColor = k333333Color
         titleLabel.font = kMediumFont14
         titleLabel.textAlignment = .left
@@ -113,4 +120,13 @@ class PublishEditAddAddressCell: UITableViewCell {
         return iconImageView
     }()
     
+    func remakeSubLabelWithLeading(_ leading: UInt) {
+        subLabel.snp.remakeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.left.equalToSuperview().offset(leading)
+            make.right.equalTo(arrowImageView.snp_left).offset(-10)
+            make.height.equalTo(17)
+        }
+    }
+    
 }

+ 13 - 0
RainbowPlanet/RainbowPlanet/Modules/PublishModule/PublishEditController/View/PublishEditAddTopicCell.swift

@@ -22,6 +22,10 @@ class PublishEditAddTopicCell: UITableViewCell {
         didSet {
             if self.selTopicName != "" {
                 subLabel.text = self.selTopicName
+                subLabel.textColor = k333333Color
+                subLabel.font = kRegularFont14
+                remakeSubLabelWithLeading(36)
+                titleLabel.text = ""
             }
         }
     }
@@ -117,4 +121,13 @@ class PublishEditAddTopicCell: UITableViewCell {
         return iconImageView
     }()
     
+    func remakeSubLabelWithLeading(_ leading: UInt) {
+        subLabel.snp.remakeConstraints { (make) in
+            make.centerY.equalToSuperview()
+            make.left.equalToSuperview().offset(leading)
+            make.right.equalTo(arrowImageView.snp_left).offset(-10)
+            make.height.equalTo(17)
+        }
+    }
+    
 }