| | |
| | | 138DA4D829F6305600A71FE7 /* Colors+Exception.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138DA4D029F6305600A71FE7 /* Colors+Exception.swift */; }; |
| | | 138DA4D929F6305600A71FE7 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138DA4D329F6305600A71FE7 /* LoginVC.swift */; }; |
| | | 138DA4DA29F6305600A71FE7 /* LoginVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 138DA4D429F6305600A71FE7 /* LoginVC.xib */; }; |
| | | 138E53E92A8B6C91005B3C47 /* LocationTool.swift in Sources */ = {isa = PBXBuildFile; fileRef = 138E53E82A8B6C91005B3C47 /* LocationTool.swift */; }; |
| | | 13941CDF29F6901D00AB569F /* BaseTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13941CDE29F6901D00AB569F /* BaseTableView.swift */; }; |
| | | 13941CE329F763C900AB569F /* PersonalCenterVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13941CE129F763C900AB569F /* PersonalCenterVC.swift */; }; |
| | | 13941CE429F763C900AB569F /* PersonalCenterVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13941CE229F763C900AB569F /* PersonalCenterVC.xib */; }; |
| | |
| | | 138DA4D029F6305600A71FE7 /* Colors+Exception.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Colors+Exception.swift"; sourceTree = "<group>"; }; |
| | | 138DA4D329F6305600A71FE7 /* LoginVC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = "<group>"; }; |
| | | 138DA4D429F6305600A71FE7 /* LoginVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoginVC.xib; sourceTree = "<group>"; }; |
| | | 138E53E82A8B6C91005B3C47 /* LocationTool.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationTool.swift; sourceTree = "<group>"; }; |
| | | 13941CDE29F6901D00AB569F /* BaseTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableView.swift; sourceTree = "<group>"; }; |
| | | 13941CE129F763C900AB569F /* PersonalCenterVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonalCenterVC.swift; sourceTree = "<group>"; }; |
| | | 13941CE229F763C900AB569F /* PersonalCenterVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PersonalCenterVC.xib; sourceTree = "<group>"; }; |
| | |
| | | 138DA4D029F6305600A71FE7 /* Colors+Exception.swift */, |
| | | 1309ADFA29F7840500F5FA26 /* Currency+Exception.swift */, |
| | | 13F47D432A063DE900B8AB63 /* UIButton+Exception.swift */, |
| | | 138E53E82A8B6C91005B3C47 /* LocationTool.swift */, |
| | | ); |
| | | path = Exception; |
| | | sourceTree = "<group>"; |
| | |
| | | 130F4EEC29F7B6C100937687 /* CargoInfoTCell.swift in Sources */, |
| | | 135FD1F12A04A86B0048BE7A /* TroubleFootView.swift in Sources */, |
| | | 1309AE1129F7919900F5FA26 /* HomeDetailAttachVC.swift in Sources */, |
| | | 138E53E92A8B6C91005B3C47 /* LocationTool.swift in Sources */, |
| | | 139F0F7A29F66EB7007D9EA4 /* HomeHeaderVC.swift in Sources */, |
| | | 13F47D422A05F5F900B8AB63 /* GoogleModel.swift in Sources */, |
| | | 138DA4D929F6305600A71FE7 /* LoginVC.swift in Sources */, |
| | |
| | | GENERATE_INFOPLIST_FILE = YES; |
| | | INFOPLIST_FILE = BrokerDriver/Info.plist; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "Upload receipts and vouchers using the camera"; |
| | | INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "Track driver location and report"; |
| | | INFOPLIST_KEY_NSLocationUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Upload receipts and vouchers using the photo album"; |
| | | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| | | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; |
| | | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; |
| | | IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
| | | LD_RUNPATH_SEARCH_PATHS = ( |
| | | "$(inherited)", |
| | |
| | | PRODUCT_NAME = "$(TARGET_NAME)"; |
| | | PROVISIONING_PROFILE_SPECIFIER = ""; |
| | | "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev_profile; |
| | | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; |
| | | SUPPORTS_MACCATALYST = NO; |
| | | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| | | SWIFT_EMIT_LOC_STRINGS = YES; |
| | | SWIFT_VERSION = 5.0; |
| | | TARGETED_DEVICE_FAMILY = "1,2"; |
| | | TARGETED_DEVICE_FAMILY = 1; |
| | | }; |
| | | name = Debug; |
| | | }; |
| | |
| | | GENERATE_INFOPLIST_FILE = YES; |
| | | INFOPLIST_FILE = BrokerDriver/Info.plist; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "Upload receipts and vouchers using the camera"; |
| | | INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "Track driver location and report"; |
| | | INFOPLIST_KEY_NSLocationUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Upload receipts and vouchers using the photo album"; |
| | | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| | | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; |
| | | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; |
| | | IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
| | | LD_RUNPATH_SEARCH_PATHS = ( |
| | | "$(inherited)", |
| | |
| | | PRODUCT_NAME = "$(TARGET_NAME)"; |
| | | PROVISIONING_PROFILE_SPECIFIER = ""; |
| | | "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adHoc_profile; |
| | | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; |
| | | SUPPORTS_MACCATALYST = NO; |
| | | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| | | SWIFT_EMIT_LOC_STRINGS = YES; |
| | | SWIFT_VERSION = 5.0; |
| | | TARGETED_DEVICE_FAMILY = "1,2"; |
| | | TARGETED_DEVICE_FAMILY = 1; |
| | | }; |
| | | name = Release; |
| | | }; |
| | |
| | | GENERATE_INFOPLIST_FILE = YES; |
| | | INFOPLIST_FILE = BrokerDriver/Info.plist; |
| | | INFOPLIST_KEY_NSCameraUsageDescription = "Upload receipts and vouchers using the camera"; |
| | | INFOPLIST_KEY_NSLocationAlwaysAndWhenInUseUsageDescription = "Track driver location and report"; |
| | | INFOPLIST_KEY_NSLocationUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Track driver location and report "; |
| | | INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "Upload receipts and vouchers using the photo album"; |
| | | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| | | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; |
| | | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; |
| | | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown"; |
| | | IPHONEOS_DEPLOYMENT_TARGET = 13.0; |
| | | LD_RUNPATH_SEARCH_PATHS = ( |
| | | "$(inherited)", |
| | |
| | | PRODUCT_NAME = "$(TARGET_NAME)"; |
| | | PROVISIONING_PROFILE_SPECIFIER = ""; |
| | | "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev_profile; |
| | | SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; |
| | | SUPPORTS_MACCATALYST = NO; |
| | | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| | | SWIFT_EMIT_LOC_STRINGS = YES; |
| | | SWIFT_VERSION = 5.0; |
| | | TARGETED_DEVICE_FAMILY = "1,2"; |
| | | TARGETED_DEVICE_FAMILY = 1; |
| | | }; |
| | | name = Staging; |
| | | }; |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "platform" : "ios", |
| | | "filename" : "notification-icon@2x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "2x", |
| | | "size" : "20x20" |
| | | }, |
| | | { |
| | | "filename" : "notification-icon@3x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "3x", |
| | | "size" : "20x20" |
| | | }, |
| | | { |
| | | "filename" : "icon-small.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "1x", |
| | | "size" : "29x29" |
| | | }, |
| | | { |
| | | "filename" : "icon-small@2x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "2x", |
| | | "size" : "29x29" |
| | | }, |
| | | { |
| | | "filename" : "icon-small@3x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "3x", |
| | | "size" : "29x29" |
| | | }, |
| | | { |
| | | "filename" : "icon-40@2x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "2x", |
| | | "size" : "40x40" |
| | | }, |
| | | { |
| | | "filename" : "icon-40@3x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "3x", |
| | | "size" : "40x40" |
| | | }, |
| | | { |
| | | "filename" : "icon.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "1x", |
| | | "size" : "57x57" |
| | | }, |
| | | { |
| | | "filename" : "icon@2x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "2x", |
| | | "size" : "57x57" |
| | | }, |
| | | { |
| | | "filename" : "icon-60@2x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "2x", |
| | | "size" : "60x60" |
| | | }, |
| | | { |
| | | "filename" : "icon-60@3x.png", |
| | | "idiom" : "iphone", |
| | | "scale" : "3x", |
| | | "size" : "60x60" |
| | | }, |
| | | { |
| | | "filename" : "notification-icon~ipad.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "20x20" |
| | | }, |
| | | { |
| | | "filename" : "notification-icon~ipad@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "20x20" |
| | | }, |
| | | { |
| | | "filename" : "icon-small.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "29x29" |
| | | }, |
| | | { |
| | | "filename" : "icon-small@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "29x29" |
| | | }, |
| | | { |
| | | "filename" : "icon-40.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "40x40" |
| | | }, |
| | | { |
| | | "filename" : "icon-40@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "40x40" |
| | | }, |
| | | { |
| | | "filename" : "icon-small-50.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "50x50" |
| | | }, |
| | | { |
| | | "filename" : "icon-small-50@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "50x50" |
| | | }, |
| | | { |
| | | "filename" : "icon-72.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "72x72" |
| | | }, |
| | | { |
| | | "filename" : "icon-72@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "72x72" |
| | | }, |
| | | { |
| | | "filename" : "icon-76.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "1x", |
| | | "size" : "76x76" |
| | | }, |
| | | { |
| | | "filename" : "icon-76@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "76x76" |
| | | }, |
| | | { |
| | | "filename" : "icon-83.5@2x.png", |
| | | "idiom" : "ipad", |
| | | "scale" : "2x", |
| | | "size" : "83.5x83.5" |
| | | }, |
| | | { |
| | | "filename" : "ios-marketing.png", |
| | | "idiom" : "ios-marketing", |
| | | "scale" : "1x", |
| | | "size" : "1024x1024" |
| | | } |
| | | ], |
New file |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "scale" : "1x" |
| | | }, |
| | | { |
| | | "filename" : "maker_start@2x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "2x" |
| | | }, |
| | | { |
| | | "filename" : "maker_start@3x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "3x" |
| | | } |
| | | ], |
| | | "info" : { |
| | | "author" : "xcode", |
| | | "version" : 1 |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "scale" : "1x" |
| | | }, |
| | | { |
| | | "filename" : "marker_check@2x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "2x" |
| | | }, |
| | | { |
| | | "filename" : "marker_check@3x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "3x" |
| | | } |
| | | ], |
| | | "info" : { |
| | | "author" : "xcode", |
| | | "version" : 1 |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "scale" : "1x" |
| | | }, |
| | | { |
| | | "filename" : "marker_terminal@2x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "2x" |
| | | }, |
| | | { |
| | | "filename" : "marker_terminal@3x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "3x" |
| | | } |
| | | ], |
| | | "info" : { |
| | | "author" : "xcode", |
| | | "version" : 1 |
| | | } |
| | | } |
New file |
| | |
| | | { |
| | | "images" : [ |
| | | { |
| | | "idiom" : "universal", |
| | | "scale" : "1x" |
| | | }, |
| | | { |
| | | "filename" : "marker_warehouse@2x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "2x" |
| | | }, |
| | | { |
| | | "filename" : "marker_warehouse@3x.png", |
| | | "idiom" : "universal", |
| | | "scale" : "3x" |
| | | } |
| | | ], |
| | | "info" : { |
| | | "author" : "xcode", |
| | | "version" : 1 |
| | | } |
| | | } |
| | |
| | | |
| | | var str:String{ |
| | | switch self { |
| | | case .GetInTicket:return "GET IN TICKET" |
| | | case .GetOutTicket:return "GET OUT TICKET" |
| | | case .GetInTicket:return "GATE IN TICKET" |
| | | case .GetOutTicket:return "GATE OUT TICKET" |
| | | case .Pod:return "POD" |
| | | case .Other:return "OTHER" |
| | | case .none:return "--" |
New file |
| | |
| | | // |
| | | // File.swift |
| | | // BrokerDriver |
| | | // |
| | | // Created by 无故事王国 on 2023/8/15. |
| | | // |
| | | |
| | | import UIKit |
| | | import CoreLocation |
| | | import MapKit |
| | | |
| | | |
| | | public enum MapNavigationType { |
| | | case BaiduMap //百度地图 |
| | | case Amap //高德地图 |
| | | case GoogleMap //谷歌地图 |
| | | case qqMap //qq地图 |
| | | |
| | | static let allValues = [BaiduMap,Amap,GoogleMap,qqMap] |
| | | |
| | | public var raw:String{ |
| | | get{ |
| | | switch self { |
| | | case .BaiduMap: |
| | | return "BaiduMaps" |
| | | case .Amap: |
| | | return "AMaps" |
| | | case .GoogleMap: |
| | | return "GoogleMaps" |
| | | case .qqMap: |
| | | return "TencentMaps" |
| | | } |
| | | } |
| | | } |
| | | public var URL:String{ |
| | | get{ |
| | | switch self { |
| | | case .BaiduMap: |
| | | return "baidumap://" |
| | | case .Amap: |
| | | return "iosamap://" |
| | | case .GoogleMap: |
| | | return "comgooglemaps://" |
| | | case .qqMap: |
| | | return "qqmap://" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* |
| | | |
| | | 配置:LSApplicationQueriesSchemes |
| | | 各种地图的 Scheme: |
| | | 百度地图:baidumap |
| | | 高德地图:iosamap |
| | | 谷歌地图:comgooglemaps |
| | | 腾讯地图:qqmap |
| | | */ |
| | | public class MapNavigationTool{ |
| | | |
| | | static var manager:CLLocationManager?; |
| | | |
| | | //查询已安装的地图 |
| | | public static func mapList()->[MapNavigationType]{ |
| | | var canOpenMapUrl = [MapNavigationType]() |
| | | for mapEnum in MapNavigationType.allValues{ |
| | | if UIApplication.shared.canOpenURL(URL(string: mapEnum.URL)!) { |
| | | canOpenMapUrl.append(mapEnum) |
| | | } |
| | | } |
| | | return canOpenMapUrl |
| | | } |
| | | |
| | | /// 使用系统自带的弹框进行导航 |
| | | /// - Parameters: |
| | | /// - coor: 经纬度 |
| | | /// - distanceName: 终点名称 |
| | | /// - scheme: 回跳至APP所需scheme |
| | | public static func startNav(_ coor:CLLocationCoordinate2D,distanceName:String,scheme:String){ |
| | | let alertVC = UIAlertController(title: "Navigation", message: "Please choose Nav", preferredStyle: .actionSheet) |
| | | for mapItem in JQ_MapNavigationTool.mapList() { |
| | | let alert = UIAlertAction(title: mapItem.raw, style: .default) { (_) in |
| | | JQ_MapNavigationTool.plaformMap(mapItem, scheme: scheme, coor: coor, distanceName: distanceName) |
| | | } |
| | | alertVC.addAction(alert) |
| | | } |
| | | |
| | | let appleMap = UIAlertAction(title: "AppleMaps", style: .default) { (_) in |
| | | JQ_MapNavigationTool.navMap(coor, distanceName: distanceName) |
| | | } |
| | | |
| | | alertVC.addAction(appleMap) |
| | | alertVC.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) |
| | | JQ_currentViewController().present(alertVC, animated: true, completion: nil) |
| | | } |
| | | |
| | | /// 原生地图导航 |
| | | /// - Parameters: |
| | | /// - coor: 经纬度 |
| | | /// - distanceName: 终点名称 |
| | | public static func navMap(_ coor:CLLocationCoordinate2D,distanceName:String){ |
| | | let currentLoc = MKMapItem.forCurrentLocation() |
| | | let distanceLoc = MKMapItem(placemark: MKPlacemark(coordinate: coor,addressDictionary: nil)) |
| | | distanceLoc.name = distanceName |
| | | |
| | | let launchOpt = [MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving, |
| | | MKLaunchOptionsShowsTrafficKey:true |
| | | ] as [String : Any] |
| | | |
| | | MKMapItem.openMaps(with: [currentLoc,distanceLoc], launchOptions: launchOpt) |
| | | } |
| | | |
| | | public static func plaformMap(_ type:JQ_MapNavigationType,scheme:String,coor:CLLocationCoordinate2D,distanceName:String){ |
| | | |
| | | var url = "" |
| | | switch type { |
| | | case .BaiduMap: |
| | | url = "baidumap://map/direction?origin={{My Location}}&destination=latlng:\(coor.latitude),\(coor.longitude)|name=\(distanceName)&mode=driving&coord_type=gcj02" |
| | | case .Amap: |
| | | url = "iosamap://navi?sourceApplication=Nav&backScheme=\(scheme)&lat=\(coor.latitude)&lon=\(coor.longitude)&dev=0&style=2" |
| | | case .GoogleMap: |
| | | url = "comgooglemaps://?x-source=Nav&x-success=\(scheme)&saddr=&daddr=\(coor.latitude),\(coor.longitude)&directionsmode=driving" |
| | | case .qqMap: |
| | | url = "qqmap://map/routeplan?from=My Location&type=drive&tocoord=\(coor.latitude),\(coor.longitude)&to=\(distanceName)&coord_type=1&policy=0" |
| | | } |
| | | UIApplication.shared.open(URL(string: url.jq_urlEncoded())!, options: [:]) { (status) in |
| | | if !status{ |
| | | JQ_ShowError(errorStr: "navigation failed,please choose other one") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public class JQ_LocationTool:NSObject,CLLocationManagerDelegate{ |
| | | |
| | | public typealias JQLocationLocationClouse = (CLLocation)->Void |
| | | public typealias JQLocationHeadingClouse = (CLHeading,Double)->Void |
| | | public typealias JQLocationErrorClouse = (Error)->Void |
| | | |
| | | public var manager:CLLocationManager! |
| | | |
| | | private var currentType = 0 |
| | | |
| | | public private(set) var currentLocation:CLLocation? |
| | | |
| | | public var locationClouse:JQLocationLocationClouse? |
| | | public var headingClouse:JQLocationHeadingClouse? |
| | | public var errorClouse:JQLocationErrorClouse? |
| | | |
| | | private static var _sharedInstance: JQ_LocationTool? |
| | | |
| | | public class func instance() -> JQ_LocationTool { |
| | | guard let instance = _sharedInstance else { |
| | | _sharedInstance = JQ_LocationTool() |
| | | return _sharedInstance! |
| | | } |
| | | return instance |
| | | } |
| | | private override init() { |
| | | super.init() |
| | | } |
| | | |
| | | public func startLocation(_ locationClouse:@escaping JQLocationLocationClouse,errorClouse:@escaping JQLocationErrorClouse){ |
| | | manager = CLLocationManager() |
| | | manager.desiredAccuracy = kCLLocationAccuracyBest |
| | | manager.distanceFilter = 10 |
| | | manager.delegate = self |
| | | currentType = 0 |
| | | self.locationClouse = locationClouse |
| | | self.errorClouse = errorClouse |
| | | |
| | | var currentStatus:CLAuthorizationStatus |
| | | if #available(iOS 14.0, *) { |
| | | currentStatus = manager.authorizationStatus |
| | | } else { |
| | | currentStatus = CLLocationManager.authorizationStatus() |
| | | } |
| | | switch currentStatus { |
| | | case .authorizedAlways,.authorizedWhenInUse:break |
| | | // manager.startUpdatingLocation() |
| | | case .restricted,.denied: |
| | | JQ_AuthorizesTool.default.openURL(.location) |
| | | case .notDetermined: |
| | | manager.requestWhenInUseAuthorization() |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | public func geocoder(_ location:CLLocation,completeClouse:@escaping CLGeocodeCompletionHandler){ |
| | | CLGeocoder().reverseGeocodeLocation(location, completionHandler: completeClouse) |
| | | } |
| | | |
| | | public func stopLocation(){ |
| | | manager.stopUpdatingLocation() |
| | | } |
| | | |
| | | public func stopHeading(){ |
| | | manager.stopUpdatingHeading() |
| | | } |
| | | |
| | | public func destroy(){ |
| | | JQ_LocationTool._sharedInstance = nil |
| | | } |
| | | |
| | | public func startHeading(_ headingClouse:@escaping JQLocationHeadingClouse,errorClouse:@escaping JQLocationErrorClouse){ |
| | | currentType = 1 |
| | | self.headingClouse = headingClouse |
| | | self.errorClouse = errorClouse |
| | | |
| | | var currentStatus:CLAuthorizationStatus |
| | | if #available(iOS 14.0, *) { |
| | | currentStatus = manager.authorizationStatus |
| | | } else { |
| | | currentStatus = CLLocationManager.authorizationStatus() |
| | | } |
| | | switch currentStatus { |
| | | case .authorizedAlways,.authorizedWhenInUse: |
| | | if CLLocationManager.headingAvailable() { |
| | | manager.startUpdatingHeading() |
| | | } |
| | | case .restricted,.denied: |
| | | JQ_AuthorizesTool.default.openURL(.location) |
| | | case .notDetermined: |
| | | manager.requestWhenInUseAuthorization() |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | public func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { |
| | | currentLocation = nil |
| | | errorClouse?(error) |
| | | } |
| | | |
| | | public func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) { |
| | | let angle = newHeading.magneticHeading/180.0*Double.pi |
| | | headingClouse?(newHeading,angle) |
| | | } |
| | | |
| | | public func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { |
| | | var currentStatus:CLAuthorizationStatus |
| | | if #available(iOS 14.0, *) { |
| | | currentStatus = manager.authorizationStatus |
| | | } else { |
| | | currentStatus = CLLocationManager.authorizationStatus() |
| | | } |
| | | switch currentStatus { |
| | | case .authorizedAlways,.authorizedWhenInUse: |
| | | manager.startUpdatingLocation() |
| | | case .restricted,.denied: |
| | | JQ_AuthorizesTool.default.openURL(.location) |
| | | case .notDetermined: |
| | | manager.requestWhenInUseAuthorization() |
| | | default:break |
| | | } |
| | | } |
| | | |
| | | public func locationManagerDidResumeLocationUpdates(_ manager: CLLocationManager) { |
| | | |
| | | } |
| | | |
| | | public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { |
| | | if let location = locations.filter({$0.coordinate.latitude > 0 && $0.coordinate.longitude > 0}).last{ |
| | | currentLocation = location |
| | | locationClouse?(location) |
| | | } |
| | | } |
| | | } |
| | |
| | | private(set) var type:Int! |
| | | private var model:OrderDetailModel?{ |
| | | didSet{ |
| | | if let m = model{ |
| | | if let m = model?.data{ |
| | | label_type.text = m.orderType |
| | | label_id.text = m.orderId |
| | | icon_id.image = m.status.transImage |
| | |
| | | contentTableView.reloadData() |
| | | cargoTableview.reloadData() |
| | | view_btn.isHidden = true |
| | | |
| | | |
| | | var startCoordinate:CLLocationCoordinate2D? |
| | | var endCoordinate:CLLocationCoordinate2D? |
| | | |
| | | if m.lat != 0 && m.lon != 0 { |
| | | startCoordinate = CLLocationCoordinate2D(latitude: m.lat, longitude: m.lon) |
| | | } |
| | | |
| | | if m.eLat != 0 && m.eLon != 0{ |
| | | endCoordinate = CLLocationCoordinate2D(latitude: m.eLat, longitude: m.eLon) |
| | | } |
| | | |
| | | let tuple = (startCoordinate,endCoordinate) |
| | | NotificationCenter.default.post(name: UpdateMap_Noti, object: tuple) |
| | | |
| | | NotificationCenter.default.post(name: UpdateMap_Noti, object: model) |
| | | view_btn.isHidden = m.button == 2 |
| | | |
| | | // switch m.status.rawValue{ |
| | | // case 2,3,4,5,12,14:type = 1 |
| | | // case 6,7,8,15:type = 2 |
| | | // case 9,10:type = 3 |
| | | // case 11:type = 4 |
| | | // default:break |
| | | // } |
| | | // |
| | | // switch type{ |
| | | // case 1: |
| | | // switch m.status.rawValue{ |
| | | // case 2,3,4,5,12,14:view_btn.isHidden = false |
| | | // default:view_btn.isHidden = true |
| | | // } |
| | | // case 2: |
| | | // switch m.status.rawValue{ |
| | | // case 6,7,8,15: |
| | | // view_btn.isHidden = false |
| | | // default:view_btn.isHidden = true |
| | | // } |
| | | // case 3: |
| | | // switch m.status.rawValue{ |
| | | // case 9,10: |
| | | // view_btn.isHidden = false |
| | | // if m.orderType != "Live Unload" && m.status.rawValue == 9{ |
| | | // view_btn.isHidden = true |
| | | // } |
| | | // default:view_btn.isHidden = true |
| | | // } |
| | | // case 4: |
| | | // switch m.status.rawValue{ |
| | | // case 11:view_btn.isHidden = false |
| | | // default:view_btn.isHidden = true |
| | | // } |
| | | // default:view_btn.isHidden = true |
| | | // } |
| | | } |
| | | } |
| | | } |
| | |
| | | //到达码头:提示上传 |
| | | //运输中:上传POD |
| | | //运回码头:提示上传 |
| | | guard let m = model else { return } |
| | | guard let m = model?.data else { return } |
| | | if m.nextStatus == .ArrivedPort{ |
| | | CommonAlertView.show(title: "Prompt!", content: "You need to upload gate out ticket", bt1: "Not upload yet", bt2: "To upload") { [weak self] in |
| | | AttachTypeView.show(orderId: m.orderId,recordEnum: .GetOutTicket) { |
| | |
| | | if cargoTableview == tableView{ |
| | | return 1 |
| | | } |
| | | return model?.list.count ?? 0 |
| | | return model?.data?.list.count ?? 0 |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | if cargoTableview == tableView{ |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_CargoInfoTCell") as! CargoInfoTCell |
| | | cell.l1.text = model?.tGoods?.containerNumber ?? "" |
| | | cell.l2.text = "\(model?.tGoods?.weight ?? 0)" |
| | | cell.l3.text = model?.tGoods?.size ?? "" |
| | | cell.l4.text = String(format: "%@\n%@", model?.tGoods?.type ?? "" ,model?.tGoods?.typeClass ?? "") |
| | | cell.l1.text = model?.data?.tGoods?.containerNumber ?? "" |
| | | cell.l2.text = "\(model?.data?.tGoods?.weight ?? 0)" |
| | | cell.l3.text = model?.data?.tGoods?.size ?? "" |
| | | cell.l4.text = String(format: "%@\n%@", model?.data?.tGoods?.type ?? "" ,model?.data?.tGoods?.typeClass ?? "") |
| | | return cell |
| | | } |
| | | |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_HomeDetailContentTCell") as! HomeDetailContentTCell |
| | | if let dict = model?.list[indexPath.row]{ |
| | | if let dict = model?.data?.list[indexPath.row]{ |
| | | cell.dicts = dict |
| | | } |
| | | |
| | |
| | | private lazy var mapView:GMSMapView = { |
| | | let map = GMSMapView() |
| | | map.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.6) |
| | | map.mapType = .normal |
| | | map.settings.scrollGestures = false |
| | | map.settings.zoomGestures = false |
| | | map.accessibilityElementsHidden = false |
| | | map.isBuildingsEnabled = false |
| | | map.isMyLocationEnabled = false |
| | | map.settings.scrollGestures = true |
| | | map.settings.zoomGestures = true |
| | | map.isBuildingsEnabled = true |
| | | map.settings.compassButton = true |
| | | map.settings.myLocationButton = false |
| | | map.setMinZoom(15, maxZoom: 20) |
| | | map.delegate = self |
| | | return map |
| | | }() |
| | | |
| | | private lazy var mananger:CLLocationManager = { |
| | | let manan = CLLocationManager() |
| | | manan.delegate = self |
| | | manan.requestAlwaysAuthorization() |
| | | manan.distanceFilter = 15 |
| | | manan.desiredAccuracy = kCLLocationAccuracyBestForNavigation |
| | | return manan |
| | | }() |
| | | |
| | | private lazy var destionMarker:GMSMarker = { |
| | |
| | | return marker |
| | | }() |
| | | |
| | | private lazy var startMarker:GMSMarker = { |
| | | let marker = GMSMarker() |
| | | marker.title = "Start" |
| | | marker.icon = UIImage(named: "maker_start") |
| | | return marker |
| | | }() |
| | | |
| | | private lazy var carMarker:GMSMarker = { |
| | | let marker = GMSMarker() |
| | | marker.title = "Car" |
| | | marker.icon = UIImage(named: "marker_car") |
| | | return marker |
| | | }() |
| | | |
| | | private lazy var checkMarker:GMSMarker = { |
| | | let marker = GMSMarker() |
| | | marker.title = "Check" |
| | | marker.icon = UIImage(named: "marker_check") |
| | | return marker |
| | | }() |
| | | |
| | | private lazy var yardMarker:GMSMarker = { |
| | | let marker = GMSMarker() |
| | | marker.title = "Warehouse" |
| | | marker.icon = UIImage(named: "marker_warehouse") |
| | | return marker |
| | | }() |
| | | |
| | |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(UpdateMap_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in |
| | | if let tuple = noti.object as? (CLLocationCoordinate2D?,CLLocationCoordinate2D?){ |
| | | self?.updateBounds(carCoordinate: tuple.0, terminalCoordinate: tuple.1) |
| | | guard let weakSelf = self else { return } |
| | | if let tuple = noti.object as? OrderDetailModel{ |
| | | |
| | | guard let start = tuple.lonlat.first else { return } |
| | | guard let terminal = tuple.lonlat.last else { return } |
| | | var wayPointes = [String]() |
| | | weakSelf.startMarker.position = CLLocationCoordinate2D(latitude: 30.670682, longitude: 104.078942) |
| | | // weakSelf.startMarker.position = CLLocationCoordinate2D(latitude: start.lat, longitude: start.lat) |
| | | weakSelf.startMarker.map = weakSelf.mapView |
| | | |
| | | |
| | | weakSelf.destionMarker.position = CLLocationCoordinate2D(latitude: 30.616992, longitude: 104.070893) |
| | | // weakSelf.destionMarker.position = CLLocationCoordinate2D(latitude: terminal.lat, longitude: terminal.lat) |
| | | weakSelf.destionMarker.map = weakSelf.mapView |
| | | |
| | | |
| | | |
| | | // 1 - 2: 2,3,5,12,13,14 |
| | | // 1- 3: 5,6 |
| | | // 3 - 4: 7,15 |
| | | //4 - 3: 9,10,11 |
| | | // 3 - 1: 11,18 |
| | | |
| | | |
| | | // index = 3 // 1:起点,2:检查站 ,3:场地,4:终点 |
| | | // if tuple.lonlat.count == 4{ |
| | | // weakSelf.yardMarker.position = CLLocationCoordinate2D(latitude: tuple.lonlat[2].lat, longitude: tuple.lonlat[2].lon) |
| | | // weakSelf.yardMarker.map = weakSelf.mapView |
| | | // wayPointes.append(String(format: "%lf;%lf", weakSelf.yardMarker.position.latitude,weakSelf.yardMarker.position.longitude)) |
| | | // |
| | | // weakSelf.checkMarker.position = CLLocationCoordinate2D(latitude: tuple.lonlat[1].lat, longitude: tuple.lonlat[1].lon) |
| | | // weakSelf.checkMarker.map = weakSelf.mapView |
| | | // wayPointes.append(String(format: "%lf;%lf", weakSelf.checkMarker.position.latitude,weakSelf.checkMarker.position.longitude)) |
| | | // } |
| | | // |
| | | // if tuple.lonlat.count == 3{ |
| | | // weakSelf.checkMarker.position = CLLocationCoordinate2D(latitude: tuple.lonlat[1].lat, longitude: tuple.lonlat[1].lon) |
| | | // weakSelf.checkMarker.map = weakSelf.mapView |
| | | // wayPointes.append(String(format: "%lf;%lf", weakSelf.checkMarker.position.latitude,weakSelf.checkMarker.position.longitude)) |
| | | // } |
| | | |
| | | GoogleServices.directionsLine(origin: .byCoordinates(weakSelf.startMarker.position), destination: .byCoordinates(weakSelf.destionMarker.position), waypoints: wayPointes.joined(separator: "|")).subscribe(onNext: {[weak self] data in |
| | | if let lg = data.routes.first?.legs.first{ |
| | | self?.addPathInMap(leg: lg) |
| | | } |
| | | }) { error in |
| | | |
| | | }.disposed(by: weakSelf.disposeBag) |
| | | self?.mananger.startUpdatingLocation() |
| | | // self?.updateBounds(carCoordinate: tuple.0, terminalCoordinate: tuple.1) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | |
| | | |
| | | func updateBounds(carCoordinate:CLLocationCoordinate2D?,terminalCoordinate:CLLocationCoordinate2D?){ |
| | | |
| | | |
| | | var centerCoordiante:CLLocationCoordinate2D? |
| | | |
| | | if carCoordinate != nil{ |
| | |
| | | polyline.map = mapView |
| | | } |
| | | |
| | | |
| | | private func addPathInMap(snaps:[SnappedPointModel]){ |
| | | let path = GMSMutablePath() |
| | | for snap in snaps { |
| | | if snap.location?.latitude != nil && snap.location?.longitude != nil{ |
| | | let coordinate = CLLocationCoordinate2D(latitude: snap.location!.latitude!, longitude: snap.location!.longitude!) |
| | | path.add(coordinate) |
| | | } |
| | | } |
| | | let polyline = GMSPolyline(path: path) |
| | | polyline.strokeWidth = 6.0 |
| | | polyline.strokeColor = Def_ThemeColor |
| | | polyline.geodesic = true |
| | | polyline.map = mapView |
| | | self.polyline = polyline |
| | | } |
| | | |
| | | private func addPathInMap(leg:GoogleRoteRouteLegModel){ |
| | | let path = GMSMutablePath() |
| | | for step in leg.steps{ |
| | | let startLocation = CLLocationCoordinate2D(latitude: step.start_location!.lat, longitude: step.start_location!.lng) |
| | | let endLocation = CLLocationCoordinate2D(latitude: step.end_location!.lat, longitude: step.end_location!.lng) |
| | | path.add(startLocation) |
| | | path.add(endLocation) |
| | | } |
| | | |
| | | let polyline = GMSPolyline(path: path) |
| | | polyline.strokeWidth = 6.0 |
| | | polyline.strokeColor = Def_ThemeColor |
| | | polyline.geodesic = true |
| | | polyline.map = mapView |
| | | self.polyline = polyline |
| | | } |
| | | |
| | | @objc func troubleAction(){ |
| | | let vc = TroubleListVC(orderId: orderId) |
| | | push(vc: vc) |
| | | } |
| | | } |
| | | |
| | | extension HomeDetailMapVC:GMSMapViewDelegate{ |
| | | func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool { |
| | | JQ_MapNavigationTool.startNav(marker.position, distanceName: marker.title ?? "None", scheme: "BrokerDriver") |
| | | return true |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | extension HomeDetailMapVC:CLLocationManagerDelegate{ |
| | | func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { |
| | | if let location = locations.last{ |
| | | let marker = GMSMarker(position: location.coordinate) |
| | | marker.icon = UIImage(named: "marker_car") |
| | | marker.map = mapView |
| | | mapView.animate(toLocation: location.coordinate) |
| | | } |
| | | } |
| | | } |
| | |
| | | pageMenu.unSelectedItemTitleFont = UIFont.systemFont(ofSize: 16, weight: .bold) |
| | | view.addSubview(pageMenu) |
| | | |
| | | var funcView = UIView() |
| | | let funcView = UIView() |
| | | funcView.backgroundColor = .white |
| | | view.addSubview(funcView) |
| | | funcView.snp.makeConstraints { make in |
| | |
| | | import UIKit |
| | | import FFPage |
| | | import SPPageMenu |
| | | import CoreLocation |
| | | |
| | | class HomeVC: BaseViewController { |
| | | |
| | |
| | | return vc |
| | | }() |
| | | |
| | | private lazy var manager:CLLocationManager = { |
| | | let mana = CLLocationManager() |
| | | mana.delegate = self |
| | | mana.requestAlwaysAuthorization() |
| | | mana.distanceFilter = 20 |
| | | mana.desiredAccuracy = 10 |
| | | return mana |
| | | }() |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | |
| | | manager.startUpdatingLocation() |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | extension HomeVC:CLLocationManagerDelegate{ |
| | | func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { |
| | | |
| | | } |
| | | |
| | | func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { |
| | | if let location = locations.last{ |
| | | Services.uploadLocation(coordinate: location.coordinate).subscribe(onNext: {data in |
| | | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| | | <plist version="1.0"> |
| | | <dict> |
| | | <key>SERVERURL</key> |
| | | <string>$(SERVER_URL)</string> |
| | | <key>UIAppFonts</key> |
| | | <array> |
| | | <string>Impact.ttf</string> |
| | |
| | | </array> |
| | | </dict> |
| | | </dict> |
| | | <key>SERVERURL</key> |
| | | <string>$(SERVER_URL)</string> |
| | | <key>UIBackgroundModes</key> |
| | | <array> |
| | | <string>location</string> |
| | | </array> |
| | | </dict> |
| | | </plist> |
| | |
| | | |
| | | |
| | | #if DEBUG |
| | | tf_email.text = "1511311473@qq.com" |
| | | tf_email.text = "testdriver@gmail.com" |
| | | tf_pwd.text = "111111" |
| | | |
| | | #endif |
| | |
| | | } |
| | | |
| | | func append(key: String,value: String?) -> ParamsAppender { |
| | | // if value?.isEmpty ?? true || value == "" { return self } |
| | | if value?.isEmpty ?? true || value == "" { return self } |
| | | params += ["\(key)":"\(value ?? "")"] |
| | | return self |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | class func requestMap<T: HandyJSON>(params: ParamsAppender, method: HTTPMethod, encoding: ParameterEncoding? = nil, progress: Bool = true) -> Observable<T>{ |
| | | return Observable<T>.create{ ob in |
| | | var hud: MBProgressHUD? |
| | | if progress { |
| | | hud = MBProgressHUD.showAdded(to: screnDelegate!.window!, animated: true) |
| | | hud?.bezelView.style = .solidColor |
| | | hud?.contentColor = .white |
| | | hud?.bezelView.backgroundColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 0.8) |
| | | hud?.bezelView.color = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 0.8) |
| | | hud?.removeFromSuperViewOnHide = true |
| | | } |
| | | var newEncoding: ParameterEncoding |
| | | if encoding != nil { |
| | | newEncoding = encoding! |
| | | } else { |
| | | newEncoding = method == .post ? URLEncoding.httpBody : URLEncoding.queryString |
| | | } |
| | | |
| | | sharedSessionManager.request(params.url.absoluteString, method: method, parameters:params.done(), encoding: newEncoding).validate().responseData{response in |
| | | LogInfo("请求地址:\(params.url)") |
| | | LogInfo("请求参数:\(params.params)") |
| | | hud?.hide(animated: true) |
| | | if response.error != nil { |
| | | LogError("\(response.error!)") |
| | | alert(msg: response.error!.localizedDescription) |
| | | ob.onError(response.error!) |
| | | }else if let data = response.data,let jsonString = String(data: data, encoding: String.Encoding.utf8){ |
| | | if let next = T.deserialize(from: jsonString){ |
| | | LogInfo("返回数据:\(next.toJSON())") |
| | | ob.onNext(next) |
| | | }else{ |
| | | alert(msg: "数据解析失败") |
| | | ob.onError(NetRequestError.Other) |
| | | } |
| | | }else{ |
| | | alert(msg: "解析失败") |
| | | ob.onError(NetRequestError.Other) |
| | | } |
| | | ob.onCompleted() |
| | | } |
| | | return Disposables.create{} |
| | | } |
| | | } |
| | | |
| | | class func requestData(params: ParamsAppender, method: HTTPMethod, encoding: ParameterEncoding? = nil, progress: Bool = true) -> Observable<Data>{ |
| | | return Observable<Data>.create{ ob in |
| | | var hud: MBProgressHUD? |
| | |
| | | import Alamofire |
| | | |
| | | #if DEBUG |
| | | let All_Url = "http://192.168.110.22:8040" |
| | | let All_Url = "http://54.67.44.33:8040" |
| | | //let All_Url = "http://54.67.44.33:8040" |
| | | let Google_Url = "https://roads.googleapis.com/v1" |
| | | let Google_Url = "https://maps.googleapis.com/maps/api" |
| | | #else |
| | | let All_Url = "http://54.67.44.33:8040" |
| | | let Google_Url = "https://roads.googleapis.com/v1" |
| | | let Google_Url = "https://maps.googleapis.com/maps/api" |
| | | #endif |
| | | |
| | | |
| | |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | | /// 上传定位 |
| | | class func uploadLocation(coordinate:CLLocationCoordinate2D)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | .interface(url: "/api/order/updateLonLat") |
| | | .append(key: "driverId", value:UserViewModel.getUserInfo()!.id) |
| | | .append(key: "lat", value: "\(coordinate.latitude)") |
| | | .append(key: "lon", value: "\(coordinate.longitude)") |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | | } |
| | | |
| | | class GoogleServices:NSObject{ |
| | |
| | | } |
| | | } |
| | | |
| | | class func directionsLine(origin:DirectionType,destination:DirectionType)->Observable<BaseResponse<GoogleRoteModel>>{ |
| | | class func directionsLine(origin:DirectionType,destination:DirectionType,waypoints:String)->Observable<GoogleRoteModel>{ |
| | | let params = ParamsAppender.build(url: Google_Url) |
| | | .interface(url: "/directions/json") |
| | | .append(key: "origin", value: origin.toFormat()) |
| | | .append(key: "destination", value: destination.toFormat()) |
| | | .append(key: "waypoints", value: waypoints) |
| | | .append(key: "alternatives", value: false) //可供选择方案:会增加请求时间 |
| | | return NetworkRequest.request(params: params.googleMapDone(), method: .post, progress: false) |
| | | return NetworkRequest.requestMap(params: params.googleMapDone(), method: .get, progress: false) |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import UIKit |
| | | import GoogleMaps |
| | | import MJRefresh |
| | | |
| | | class SceneDelegate: UIResponder, UIWindowSceneDelegate { |
| | | |
| | |
| | | window?.overrideUserInterfaceStyle = .light |
| | | window?.makeKeyAndVisible() |
| | | |
| | | MJRefreshConfig.default.languageCode = "en" |
| | | |
| | | setupGoogleAMap() |
| | | } |
| | | |
| | |
| | | if let recordEnum{ |
| | | pickerView.label_content.text = recordEnum.str |
| | | pickerView.btn_type.isEnabled = false |
| | | }else{ |
| | | pickerView.recordEnum = RecordEnum(rawValue: 1) |
| | | } |
| | | pickerView.successClouse = successClouse |
| | | pickerView.frame = screnDelegate?.window?.frame ?? .zero |
| | |
| | | guard let weakSelf = self else { return } |
| | | Services.uploadFile(file: data).subscribe(onNext: {[weak self] data in |
| | | self?.uploadModel = data.data |
| | | self?.imgV.jq_sdimage(url: data.data?.url ?? "") |
| | | self?.imgV.sd_setImage(with:URL(string: data.data?.url), placeholderImage: nil, options: .progressiveLoad, progress: { p1, p2, url in |
| | | |
| | | }, completed: { image, error, type, url in |
| | | |
| | | }) |
| | | self?.imgV.isHidden = false |
| | | }) { error in |
| | | alert(msg: error.localizedDescription) |
| | |
| | | <device id="retina6_12" orientation="portrait" appearance="light"/> |
| | | <dependencies> |
| | | <deployment identifier="iOS"/> |
| | | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/> |
| | | <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/> |
| | | <capability name="Named colors" minToolsVersion="9.0"/> |
| | | <capability name="System colors in document resources" minToolsVersion="11.0"/> |
| | | <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
| | |
| | | <rect key="frame" x="0.0" y="0.0" width="201.66666666666666" height="27"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="12"/> |
| | | <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> |
| | | <state key="normal" title="GET OUT TICKET"> |
| | | <state key="normal" title="GATE OUT TICKET"> |
| | | <color key="titleColor" red="0.16862745100000001" green="0.16862745100000001" blue="0.16862745100000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </state> |
| | | <connections> |
| | |
| | | <rect key="frame" x="0.0" y="27" width="201.66666666666666" height="27"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="12"/> |
| | | <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> |
| | | <state key="normal" title="GET IN TICKET"> |
| | | <state key="normal" title="GATE IN TICKET"> |
| | | <color key="titleColor" red="0.16862745100000001" green="0.16862745100000001" blue="0.16862745100000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </state> |
| | | <connections> |
| | |
| | | extension PhotoPickerView:TZImagePickerControllerDelegate{ |
| | | |
| | | public func imagePickerController(_ picker: TZImagePickerController!, didFinishPickingPhotos photos: [UIImage]!, sourceAssets assets: [Any]!, isSelectOriginalPhoto: Bool, infos: [[AnyHashable : Any]]!) { |
| | | guard let pngData = photos.first?.pngData() else { return alert(msg: "invaild photo") } |
| | | guard let pngData = photos.first?.jpegData(compressionQuality: 0.5) else { return alert(msg: "invaild photo") } |
| | | clouse?(pngData) |
| | | closeAction() |
| | | } |
| | |
| | | |
| | | public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { |
| | | picker.dismiss(animated: true) { [weak self] in |
| | | guard let originImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage,let pngData = originImage.pngData() else { return alert(msg: "invaild photo") } |
| | | guard let originImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage,let pngData = originImage.jpegData(compressionQuality: 0.5) else { return alert(msg: "invaild photo") } |
| | | self?.clouse?(pngData) |
| | | self?.closeAction() |
| | | } |
| | |
| | | } |
| | | |
| | | struct OrderDetailModel:HandyJSON { |
| | | var data:OrderDetailDataModel? |
| | | var lonlat = [CoordinateModel]() // 1:起点,2:检查站 ,3:场地,4:终点 |
| | | } |
| | | |
| | | struct OrderDetailDataModel:HandyJSON { |
| | | var containerNumber: String? |
| | | var eLat: CLLocationDistance = 0 |
| | | var eLon: CLLocationDistance = 0 |
| | |
| | | var button:Int = 2 |
| | | } |
| | | |
| | | struct CoordinateModel:HandyJSON{ |
| | | var lon:Double = 0 |
| | | var lat:Double = 0 |
| | | } |
| | | |
| | | |
| | | |
| | | struct OrderDetailGoodsModel:HandyJSON { |
| | | var billNumber: String = "" |
| | | var containerNumber: String = "" |