|
@@ -17,6 +17,18 @@ class AddressPOIView: BaseView {
|
|
|
|
|
|
var suggestionList : Array<BMKSuggestionInfo>?
|
|
|
|
|
|
+ var locationAddress: String? {
|
|
|
+ didSet {
|
|
|
+ tableView.reloadSections([0], with: UITableView.RowAnimation.fade)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// 纬度
|
|
|
+ var latitude : String = LocationModel.shared().getLocationModel()?.latitude ?? "34.20840377740726"
|
|
|
+ /// 经度
|
|
|
+ var longitude : String = LocationModel.shared().getLocationModel()?.longitude ?? "108.96265686107972"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
override func setupViews() {
|
|
|
|
|
|
addSubview(searchBgView)
|
|
@@ -177,10 +189,13 @@ extension AddressPOIView:UITableViewDataSource,UITableViewDelegate {
|
|
|
let cell = AddressPOITableViewCell.cellWith(tableView: tableView, indexPath: indexPath)
|
|
|
switch indexPath.section {
|
|
|
case 0:
|
|
|
+ cell.locationAddress = locationAddress
|
|
|
cell.refreshButtonBlock = {
|
|
|
BaiduMapManager.shared.startLocation()
|
|
|
BaiduMapManager.shared.locationSuccessBlock = {
|
|
|
- tableView.reloadSections([0], with: UITableView.RowAnimation.fade)
|
|
|
+ [weak self] in
|
|
|
+ let locationModel = LocationModel.shared().getLocationModel()
|
|
|
+ self?.locationAddress = locationModel?.toString()
|
|
|
}
|
|
|
BaiduMapManager.shared.locationFalseBlock = {
|
|
|
SwiftProgressHUD.shared().showText("定位失败\n重新定位", textAlignment: NSTextAlignment.center)
|
|
@@ -195,14 +210,14 @@ extension AddressPOIView:UITableViewDataSource,UITableViewDelegate {
|
|
|
}
|
|
|
|
|
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
- let locationModel = LocationModel.shared().getLocationModel()
|
|
|
|
|
|
if let didSelectBlock = self.didSelectBlock {
|
|
|
switch indexPath.section {
|
|
|
case 0:
|
|
|
- didSelectBlock(locationModel?.latitude ?? "",locationModel?.longitude ?? "",locationModel?.toString() ?? "")
|
|
|
+ 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 ?? ""
|