Commit f1875c7f authored by lujunye's avatar lujunye

调整地图

parent 8beca19e
......@@ -284,6 +284,8 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
var carModel:cityCartDataModel?
fileprivate func extractedFunc() {
HUD.flash(.progress)
cityCart(["user_token":UserToken as Any,"nonce_str":String.randomStr(len:30) as Any,"city_id":city_id as Any], success: { (data) in
......@@ -296,8 +298,13 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
if self.carTypesArr.count == 0 {
HUD.flash(.label("暂无车型可供选择"), delay: 1.2)
return
}
let cell = self.hListView.cellForRow(at: IndexPath(row: 0, section: 0)) as! HLLTopCell
cell.idx = 0
cell.scrollView?.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
cell.tjLbl.text = "--"
cell.sizeLbl.text = "--"
cell.weightLbl.text = "--"
let view = self.hListView.footerView(forSection: 0)
view?.layoutIfNeeded()
self.setBtnUI(carTypesArr: self.carTypesArr,view: self.topCarBtnSelectView)
......@@ -422,10 +429,9 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
make.height.equalTo(30)
make.width.equalTo(self.locBtn.bounds.size.width)
})
print("abc == ",adrArr.count)
if adrArr.count == 0 {
city_id = loc.city_id!
print("abc == ")
extractedFunc()
return
}
......@@ -734,7 +740,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
let model = data as! cityListModel
self.adrDatas.removeAll()
for item in model.data! {
if self.selectLoc.contains("\(item.name!)") || self.selectLoc.localizedLowercase.contains("\(item.name_en!)") {
if self.setCityId(name1: item.name!, name2: item.name_en!) {
self.loc = item
}
self.adrDatas.append(item)
......@@ -764,7 +770,13 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
}
}
func setCityId(name1:String,name2:String)->Bool{
if selectLoc.contains(name1) || selectLoc.localizedLowercase.contains(name2){
return true
}else{
return false
}
}
func getUICarList(){
rightBtn.isSelected = true
leftBtn.isSelected = false
......@@ -773,7 +785,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
locBtn.isUserInteractionEnabled = true
for item in adrDatas {
if selectLoc.contains("\(item.name!)") || selectLoc.localizedLowercase.contains("\(item.name_en!)"){
if setCityId(name1: item.name!, name2: item.name_en!){
city_id = item.city_id!
}
}
......@@ -803,7 +815,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
self.adrDatas.removeAll()
for item in model.data! {
if self.selectLoc.contains("\(item.name!)") || self.selectLoc.localizedLowercase.contains("\(item.name_en!)") {
if self.setCityId(name1: item.name!, name2: item.name_en!){
self.loc = item
}
self.adrDatas.append(item)
......@@ -1199,7 +1211,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
self.adrDatas.removeAll()
for item in model.data! {
if self.selectLoc.contains("\(item.name!)") || self.selectLoc.localizedLowercase.contains("\(item.name_en!)") {
if self.setCityId(name1: item.name!, name2: item.name_en!) {
self.loc = item
}
self.adrDatas.append(item)
......@@ -1368,7 +1380,7 @@ class XiaYunDanViewController: BaseViewController,UITableViewDelegate,UITableVie
self.adrDatas.removeAll()
for item in model.data! {
if self.selectLoc.contains("\(item.name!)") || self.selectLoc.localizedLowercase.contains("\(item.name_en!)") {
if self.setCityId(name1: item.name!, name2: item.name_en!) {
self.loc = item
}
self.adrDatas.append(item)
......
......@@ -13,6 +13,8 @@ import MAMapKit
import AMapSearchKit
import LGButton
import IQKeyboardManagerSwift
protocol SJMapViewControllerDelegate {
func SJMapViewControllerSelectArd(adr:String)
}
......@@ -47,7 +49,10 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
let location = locations.last
lat = location?.coordinate.latitude as! CLLocationDegrees
lng = location?.coordinate.longitude as! CLLocationDegrees
initMapView(lat: lat, lng: lng)
let coo = JZLocationConverter.wgs84(toGcj02: CLLocationCoordinate2D(latitude: lat, longitude: lng))
initMapView(lat: coo.latitude, lng: coo.longitude)
initSearch()
initUI()
}
......@@ -277,7 +282,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
searchBr.delegate = self
searchBr.delegateL = self
}
let locationM = AMapLocationManager()
func initMapView(lat:CLLocationDegrees,lng:CLLocationDegrees) {
let btmView = UIView()
self.view.addSubview(btmView)
......@@ -287,6 +292,11 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
}
initBtmView(view: btmView)
// locationM.desiredAccuracy = kCLLocationAccuracyBest
// locationM.locationTimeout = 2
// locationM.reGeocodeTimeout = 2
AMapServices.shared().enableHTTPS = true
mapView = MAMapView()
mapView.delegate = self
......@@ -311,7 +321,9 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
make.bottom.equalTo(btmView.snp_top).offset(-13.5)
}
}
// deinit {
// locationM.stopUpdatingLocation()
// }
func initSearch() {
search = AMapSearchAPI()
search.delegate = self
......
......@@ -337,13 +337,15 @@ class ToAndFormSelectViewController: BaseViewController, MAMapViewDelegate, CLLo
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
manger.stopUpdatingLocation()
let location = locations.last
let coo = JZLocationConverter.wgs84(toGcj02: CLLocationCoordinate2D(latitude: (location?.coordinate.latitude)!, longitude: (location?.coordinate.longitude)!))
if lat == 0 && lng == 0 {
lat = location?.coordinate.latitude as! CLLocationDegrees
lng = location?.coordinate.longitude as! CLLocationDegrees
mapView.centerCoordinate = CLLocationCoordinate2DMake((lat),(lng))
lat = coo.latitude
lng = coo.longitude
mapView.centerCoordinate = CLLocationCoordinate2DMake(lat,lng)
}
tempLat = location?.coordinate.latitude as! CLLocationDegrees
tempLng = location?.coordinate.longitude as! CLLocationDegrees
tempLat = coo.latitude
tempLng = coo.longitude
}
func setMapCenter(lat:CLLocationDegrees,lng:CLLocationDegrees) {
......
......@@ -59,7 +59,7 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
@objc func otherClick(_ sender: UIButton) {
print("abc")
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
leftBtn.isHidden = false
......@@ -142,7 +142,10 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
let view = UIView(frame: CGRect(x: CGFloat(i) * (scViewBg.bounds.size.width), y:0, width: scViewBg.bounds.size.width, height: scViewBg.bounds.size.height))
let model = datas[i]
let imgV = UIImageView()
// imgV.image =
view.addSubview(imgV)
SDWebImageDownloader.shared.downloadImage(with: URL(string:model.img_url_high_light!), options: .continueInBackground, progress: { (a, b, nil) in
}) { (img, data, err, true) in
imgV.image = img
......@@ -154,6 +157,14 @@ class HLLTopCell: UITableViewCell,UIScrollViewDelegate {
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}else{
imgV.image = UIImage(named: "lmn_tool_image")
imgV.snp.makeConstraints { (make) in
make.width.equalTo(self.scViewBg.bounds.size.width)
make.height.equalTo(self.scViewBg.bounds.size.height)
make.centerX.equalTo(view.snp.centerX)
make.centerY.equalTo(view.snp.centerY)
}
}
}
scrollView?.addSubview(view)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment