OKProject/Class/Enums.swift
@@ -230,6 +230,7 @@ switch self{ case .review:return "审核中" case .reject:return "已拒绝" default:return "" } } } OKProject/Class/Home/Controller/HomeVC.swift
@@ -701,6 +701,12 @@ let vc = TravelVC.init(orderType: .offical) vc.showCar = showCar vc.officialCharterClouse = { [weak self] (viewModel) in guard viewModel.trailReason.value != nil else { alert(text: "请先选择出行事由");return } let officialCharterVC = OfficialCharterVC() officialCharterVC.viewModel = viewModel officialCharterVC.view.frame = CGRect(x: 0, y: ScreenHeight, width: ScreenWidth, height: self?.view.height ?? 0) OKProject/Class/Home/Controller/OfficialCharterVC.swift
@@ -26,12 +26,57 @@ var test_num = 1 var viewModel:TravelViewModel! var minDate:Date = Date() var startDateTime:Date? var endDateTime:Date? var passengers = [PassengerInfo]() override func viewDidLoad() { super.viewDidLoad() tableView.delegate = self tableView.dataSource = self tableView.register(UINib(nibName: "OfficialCharterPassengerTCell", bundle: nil), forCellReuseIdentifier: "_OfficialCharterPassengerTCell") if viewModel.passengers.value.count == 0{ let temp = PassengerInfo(name: app.userInfo.nickName, phone: app.userInfo.phone) passengers.append(temp) }else{ passengers.append(contentsOf: viewModel.passengers.value) } label_passengerNum.text = "\(passengers.count)" tableView.reloadData { [weak self] in guard let weakSelf = self else { return } weakSelf.tableViewHeiCons.constant = 100.0 * Double(weakSelf.passengers.count - 1) } label_contact.text = passengers.first?.name ?? "" label_contactPhone.text = passengers.first?.phone ?? "" if let v = YYMapViewManager.share.timeStamp.value{ let datetime = DateClass.timeStampToString("\(v * 1000)", dateFormat: "yyyy-MM-dd HH:mm") startDateTime = Date(timeIntervalSince1970: v) btn_starttime.setTitle(datetime, for: .normal) } switch_notice.isOn = true } override func bindRx() { YYMapViewManager.share.originInfo.subscribe(onNext: {info in self.label_startaddress.text = info?.name ?? "" }).disposed(by: rx.disposeBag) YYMapViewManager.share.destination.subscribe(onNext: {info in self.label_endaddress.text = info?.name ?? "" }).disposed(by: rx.disposeBag) switch_notice.rx.value.changed.subscribe { status in let value = status ? 1:0 self.viewModel.isNotice.accept(value) }.disposed(by: disposeBag) } override func setupViews() { @@ -44,6 +89,30 @@ btn_endtime.spacingBetweenImageAndTitle = 9 } @IBAction func selectStartAddressAction(){ let vc = storyBoard(name: "Home", identifier: "SearchAddressVC") as! SearchAddressVC vc.origin.accept(true) vc.complete.delegate(on: self) { (self, arge) in let (model,_) = arge self.label_startaddress.text = model.address YYMapViewManager.share.searchInfo.accept(model) YYMapViewManager.share.addressNameType.accept(.search) } self.yy_push(vc: vc) } @IBAction func selectEndAddressAction(){ let vc = storyBoard(name: "Home", identifier: "SearchAddressVC") as! SearchAddressVC vc.origin.accept(false) vc.complete.delegate(on: self) { (self, arge) in let (model,_) = arge self.label_endaddress.text = model.address YYMapViewManager.share.addressNameType.accept(.normal) YYMapViewManager.share.destination.accept(model) } self.yy_push(vc: vc) } @IBAction func singleAction(_ sender: UIButton) { UIView.animate(withDuration: 0.6) { self.view.y = screenH @@ -53,10 +122,66 @@ } @IBAction func addPassengerAction(_ sender: UIButton) { test_num += 1 passengers.append(PassengerInfo()) tableView.reloadData {[weak self] in guard let weakSelf = self else { return } weakSelf.tableViewHeiCons.constant = 100.0 * Double(weakSelf.test_num) weakSelf.tableViewHeiCons.constant = 100.0 * Double(weakSelf.passengers.count - 1) weakSelf.label_passengerNum.text = "\(weakSelf.passengers.count)" } } @IBAction func startTimeAction(_ sender: UIButton) { BRDatePickerView.showDatePicker(withTitle: "选择用车时间", dateType: .YMDHM, defaultSelValue: minDate.zoneFormat("yyyy-MM-dd HH:mm"), minDate:minDate, maxDate: nil, isAutoSelect: false, themeColor: .blue) { (str) in self.btn_starttime.setTitle(str!, for: .normal) self.startDateTime = DateClass.dateStringToDate(str!,format: "yyyy-MM-dd HH:mm") } } @IBAction func endTimeAction(_ sender: UIButton) { guard let date = startDateTime?.addingTimeInterval(5 * 3600) else { alert(text: "请选择开始时间");return} BRDatePickerView.showDatePicker(withTitle: "选择用车时间", dateType: .YMDHM, defaultSelValue: minDate.zoneFormat("yyyy-MM-dd HH:mm"), minDate:date, maxDate: nil, isAutoSelect: false, themeColor: .blue) { [self] (str) in self.btn_endtime.setTitle(str!, for: .normal) let endDateTime = DateClass.dateStringToDate(str!,format: "yyyy-MM-dd HH:mm") let diffDays = DateClass.dateDifference(endDateTime, from:self.startDateTime!) guard diffDays >= 0.5 else {alert(text: "最短不能低于0.5天");return} self.endDateTime = endDateTime self.label_usedtime.text = String(format: "%@天", diffDays.remain1Digits()) } } @IBAction func submitAction(_ sender: UIButton) { guard startDateTime != nil else { alert(text: "请选择用车开始时间");return } guard endDateTime != nil else { alert(text: "请选择用车结束时间");return } guard YYMapViewManager.share.searchInfo.value != nil else { alert(text: "请选择开始地址");return } guard YYMapViewManager.share.destination.value != nil else { alert(text: "请选择结束地址");return } guard passengers.filter({$0.name.isEmpty }).count == 0 else { alert(text: "请填写联系人信息");return } viewModel.travelEndTime.accept(endDateTime!.dateFormat(format: "yyyy-MM-dd HH:mm")) YYMapViewManager.share.timeStamp.accept(startDateTime!.timeIntervalSince1970) viewModel.passengers.accept(passengers) UIView.animate(withDuration: 0.6) { self.view.y = screenH } completion: { _ in self.removeFromParent() } } } @@ -70,13 +195,32 @@ let cell = tableView.dequeueReusableCell(withIdentifier: "_OfficialCharterPassengerTCell") as! OfficialCharterPassengerTCell cell.indexPath = indexPath cell.listener.bind { indexPath in print("--->\(indexPath)") if viewModel.passengers.value.count > 0{ let passenger = passengers[indexPath.row + 1] cell.tf_contact.text = passenger.name cell.tf_contactPhone.text = passenger.phone } cell.tf_contact.rx.text.orEmpty.subscribe(onNext: { [weak self] text in self?.passengers[indexPath.row + 1].name = text }).disposed(by: disposeBag) cell.tf_contactPhone.rx.text.orEmpty.subscribe(onNext: { [weak self] text in self?.passengers[indexPath.row + 1].phone = text }).disposed(by: disposeBag) cell.listener.bind { [weak self] indexPath in guard let weakSelf = self else { return } weakSelf.passengers.remove(at: indexPath.row + 1) tableView.reloadData { guard let weakSelf = self else { return } weakSelf.tableViewHeiCons.constant = 100.0 * Double(weakSelf.passengers.count - 1) } } return cell } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return test_num return passengers.count - 1 } } OKProject/Class/Home/Controller/OfficialCharterVC.xib
@@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <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="21505"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> @@ -122,6 +122,9 @@ <state key="normal" title="请选择用车时间" image="icon_more_gray"> <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.29999999999999999" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="startTimeAction:" destination="-1" eventType="touchUpInside" id="Q8u-Zk-8jq"/> </connections> </button> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> @@ -149,6 +152,9 @@ <state key="normal" title="请选择结束时间" image="icon_more_gray"> <color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="0.29999999999999999" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="endTimeAction:" destination="-1" eventType="touchUpInside" id="Qx0-Na-LV2"/> </connections> </button> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> @@ -219,7 +225,7 @@ <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="G09-cE-z2s"> <rect key="frame" x="0.0" y="0.0" width="393" height="101"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="11D-eD-flN"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="11D-eD-flN" customClass="TapButton" customModule="OK出行" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="393" height="51"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_starting point" translatesAutoresizingMaskIntoConstraints="NO" id="zYe-Or-0zd"> @@ -255,8 +261,11 @@ <constraint firstAttribute="height" constant="51" id="s5F-A2-aLt"/> <constraint firstItem="yjm-bu-np7" firstAttribute="centerY" secondItem="zYe-Or-0zd" secondAttribute="centerY" id="yDK-FE-8CX"/> </constraints> <connections> <action selector="selectStartAddressAction" destination="-1" eventType="touchUpInside" id="vtQ-8w-9zd"/> </connections> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0aW-Il-Xgv"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0aW-Il-Xgv" customClass="TapButton" customModule="OK出行" customModuleProvider="target"> <rect key="frame" x="0.0" y="51" width="393" height="50"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_end point" translatesAutoresizingMaskIntoConstraints="NO" id="Ee6-dl-vEt"> @@ -282,6 +291,9 @@ <constraint firstItem="bgC-Cv-ZBT" firstAttribute="centerY" secondItem="Ee6-dl-vEt" secondAttribute="centerY" id="aTC-Bw-Um5"/> <constraint firstAttribute="trailing" secondItem="bgC-Cv-ZBT" secondAttribute="trailing" constant="4" id="pKZ-Np-1Uj"/> </constraints> <connections> <action selector="selectEndAddressAction" destination="-1" eventType="touchUpInside" id="WB5-Rz-35A"/> </connections> </view> </subviews> </stackView> @@ -453,6 +465,9 @@ <real key="value" value="4"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> <connections> <action selector="submitAction:" destination="-1" eventType="touchUpInside" id="jkn-aG-YDL"/> </connections> </button> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="包车调度电话:--" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AFH-Ri-HOt"> <rect key="frame" x="140" y="20" width="113" height="17"/> OKProject/Class/Home/Controller/ReasonforTravelVC.swift
@@ -25,6 +25,7 @@ class ReasonforTravelVC: YYViewController { @IBOutlet weak var label_peopleNum: UILabel! @IBOutlet weak var scrollButtomCons: NSLayoutConstraint! @IBOutlet weak var tableView: UITableView! @IBOutlet weak var tableViewHeiCons: NSLayoutConstraint! @@ -129,6 +130,8 @@ tableViewHeiCons.constant = 40 * Double(passengers.count) tableView.reloadData() view_addPassenger.isHidden = passengers.count >= 4 label_peopleNum.text = "出行人数 " + "\(passengers.count)" } @IBAction func closeAction(_ sender: Any) { @@ -161,6 +164,8 @@ cell.index = indexPath cell.label_name.text = passengers[indexPath.row].name cell.tf_phone.text = passengers[indexPath.row].phone cell.btn_delete.isHidden = indexPath.row == 0 cell.tf_phone.isEnabled = indexPath.row != 0 cell.tf_phone.rx.text.changed.subscribe(onNext: { [weak self] text in self?.passengers[indexPath.row].phone = text @@ -191,6 +196,7 @@ }else{ selectIndex.insert(indexPath.row) } label_peopleNum.text = "出行人数 " + "\(selectIndex.count)" collectionView.reloadData() } } OKProject/Class/Home/Controller/ReasonforTravelVC.xib
@@ -16,6 +16,7 @@ <outlet property="collectViewHeiCons" destination="e7F-uA-FOt" id="cyW-GN-Wvk"/> <outlet property="collectionView" destination="APN-Uk-xlb" id="sBV-eq-qNs"/> <outlet property="label_limit" destination="XFP-vx-uY8" id="Cfd-Sg-Ypm"/> <outlet property="label_peopleNum" destination="nTg-hg-GYI" id="djo-yC-FeQ"/> <outlet property="scrollButtomCons" destination="AXO-WC-gpl" id="fAF-aV-ev4"/> <outlet property="tableView" destination="Ypo-vh-eFs" id="QqV-93-68s"/> <outlet property="tableViewHeiCons" destination="YVm-v0-FlQ" id="BYg-tT-Eic"/> OKProject/Class/Home/Model/EnterpriseModel.swift
@@ -94,4 +94,10 @@ /// 订单类型(1=普通订单,2=摆渡订单) var type:Int! /// 包车时间 var travelEndTime:String? /// 是否通知 var isNotice:Int? } OKProject/Class/Home/Model/TravelServiceModel.swift
@@ -90,6 +90,8 @@ /// 订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中) var state: Int = 0 var auditStatus:OrderAuthStatus! /// 司机头像 var driverAvatar: String = "" OKProject/Class/Home/View/Reason_Content_TCell.swift
@@ -13,6 +13,7 @@ @IBOutlet weak var label_name: UILabel! @IBOutlet weak var tf_phone: QMUITextField! @IBOutlet weak var btn_delete: UIButton! var index:IndexPath! var clouse:((IndexPath)->Void)? OKProject/Class/Home/View/Reason_Content_TCell.xib
@@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <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="21505"/> <capability name="Safe area layout guides" 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"/> @@ -85,6 +85,7 @@ </tableViewCellContentView> <viewLayoutGuide key="safeArea" id="njF-e1-oar"/> <connections> <outlet property="btn_delete" destination="oly-Lw-XJB" id="gqr-wP-aK4"/> <outlet property="label_name" destination="nRL-CF-GJN" id="b3h-ym-YKi"/> <outlet property="tf_phone" destination="wzT-Yj-6VN" id="uAC-HN-J6C"/> </connections> OKProject/Class/Home/View/TripAddressCell.swift
@@ -378,6 +378,7 @@ if YYMapViewManager.share.orderType.value == .taxi{ self.button_date.setTitle(YYMapViewManager.share.timeStamp.value == nil ? "选择时间" : "\(YYMapViewManager.share.timeStamp.value?.toFormat(format: "M月d日 HH:mm") ?? "选择时间")", for: .normal) }else if YYMapViewManager.share.orderType.value == .offical{ YYMapViewManager.share.passenger.accept(nil) self.button_date.setTitle(YYMapViewManager.share.timeStamp.value == nil ? "时间" : "\(YYMapViewManager.share.timeStamp.value?.toFormat(format: "M月d日 HH:mm") ?? "时间")", for: .normal) self.button_passenger.setTitle(YYMapViewManager.share.passenger.value == nil ? "事由出行" : "\(YYMapViewManager.share.passenger.value?.name ?? "事由出行")", for: .normal) }else{ @@ -392,6 +393,7 @@ if YYMapViewManager.share.orderType.value == .offical{ self.button_more.isHidden = true YYMapViewManager.share.passenger.accept(PassengerModel(name: app.userInfo.nickName, phone: app.userInfo.phone)) } self.label_more.text = "选乘车人" OKProject/Class/Home/ViewModel/TravelViewModel.swift
@@ -70,6 +70,12 @@ /// 计费方式 let calType = BehaviorRelay<Int?>(value: nil) /// 包车结束时间(2020-08-20 10:10) let travelEndTime = BehaviorRelay<String?>(value: nil) //1:提醒,0:不提醒 let isNotice = BehaviorRelay<Int?>(value: nil) /// 获取正在进行中的订单 func queryServingOrder() { APIManager.shared.provider.rx @@ -188,7 +194,9 @@ YYMapViewManager.share.passenger.accept(PassengerModel(name: app.userInfo.nickName, phone: app.userInfo.phone)) } let reqModel = OfficalRequstModel(serverCarModelId:selectedCarType.value?.id,calType: .Single, endAddress: destination.name, endLat: destination.lat, endLon: destination.lon, orderSource: 1, orderType: orderType, passengers: YYMapViewManager.share.passenger.value?.name, passengersPhone: YYMapViewManager.share.passenger.value?.phone, payWay: officalPaymentType.value.rawValue, people: passengers.value.arrayToJson(), peopleNum: passengers.value.count, placementLat: Double(YYMapViewManager.share.userLocation.latitude), placementLon: Double(YYMapViewManager.share.userLocation.longitude), reason: trailContentReason.value, reasonTypeNames: trailReason.value, startAddress: originInfo.name, startLat: originInfo.lat, startLon: originInfo.lon, substitute: substitute, travelTime: timeStamp, type: 1) let calType = CalType(rawValue: YYMapViewManager.share.calType.value!) let reqModel = OfficalRequstModel(serverCarModelId:selectedCarType.value?.id,calType: calType, endAddress: destination.name, endLat: destination.lat, endLon: destination.lon, orderSource: 1, orderType: orderType, passengers: YYMapViewManager.share.passenger.value?.name, passengersPhone: YYMapViewManager.share.passenger.value?.phone, payWay: officalPaymentType.value.rawValue, people: passengers.value.arrayToJson(), peopleNum: passengers.value.count, placementLat: Double(YYMapViewManager.share.userLocation.latitude), placementLon: Double(YYMapViewManager.share.userLocation.longitude), reason: trailContentReason.value, reasonTypeNames: trailReason.value, startAddress: originInfo.name, startLat: originInfo.lat, startLon: originInfo.lon, substitute: substitute, travelTime: timeStamp, type: 1,travelEndTime: travelEndTime.value,isNotice: isNotice.value) APIManager.shared.provider.rx .request(.saveOrderBusiness(model: reqModel)).map(YYModel<SwitchCityModel>.self) OKProject/Class/Taxi/Controller/TravelServiceVC.swift
@@ -140,6 +140,10 @@ @IBOutlet weak var adTableView: UITableView! @IBOutlet weak var adTableViewHeiCons: NSLayoutConstraint! @IBOutlet weak var view_container: UIView! @IBOutlet weak var view_topInfo: UIView! let homeViewModel = HomeViewModel() /// 接单后 @@ -786,6 +790,26 @@ if model.endLat == 0.0 || model.endLon == 0.0{ self.akeyView.isHidden = false } if model.auditStatus == .reject{ self.navigationItem.title = "审核被拒" self.view_container.backgroundColor = UIColor(hexString: "#F3F4F5") self.mapView.removeFromSuperview() self.button_cancelOrder.isHidden = false self.createAuditView(title: "审核被拒绝\n", subTitle: "") return } if model.auditStatus == .review{ self.navigationItem.title = "等待审核" self.view_container.backgroundColor = UIColor(hexString: "#F3F4F5") self.mapView.removeFromSuperview() self.button_cancelOrder.isHidden = false self.createAuditView(title: "部门审核中\n", subTitle: "超出30分钟未审核完成请联系部门负责人") return } switch model.state{ case 1: self.navigationItem.title = "等待应答" @@ -1016,6 +1040,22 @@ } } func createAuditView(title:String,subTitle:String){ let attributeStringbuilder = AttributedStringbuilder() attributeStringbuilder.add(string: title, withFont: UIFont.systemFont(ofSize: 16,weight: .medium), withColor: UIColor(hexString: "#50638A")!, lineSpace: 5) attributeStringbuilder.add(string: subTitle, withFont: UIFont.systemFont(ofSize: 12), withColor: UIColor(hexString: "#50638A")!, lineSpace: 5) let auditL = UILabel() auditL.attributedText = attributeStringbuilder.mutableAttributedString auditL.numberOfLines = 0 auditL.textAlignment = .center view_container.addSubview(auditL) auditL.snp.makeConstraints { make in make.top.equalTo(view_topInfo.snp.bottom).offset(73) make.centerX.equalToSuperview() } } /// 清除点标记 func removeDriverAnnotations() { if driverPointArray.count > 0{ OKProject/Class/Taxi/Controller/TravelServiceVC.xib
@@ -53,10 +53,12 @@ <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view_cancel" destination="2UQ-Mt-BFb" id="ErN-Qn-d78"/> <outlet property="view_complete" destination="rtQ-AU-27G" id="R9J-vu-RTg"/> <outlet property="view_container" destination="U9W-pW-UXF" id="4wD-Fo-pPi"/> <outlet property="view_driverInfo" destination="twZ-Fu-Xr0" id="eoG-Rr-KCG"/> <outlet property="view_line1" destination="qGr-JH-gX7" id="T7L-5G-q8o"/> <outlet property="view_line2" destination="AbH-Y6-6KY" id="H84-8S-3XM"/> <outlet property="view_noDriver" destination="MGc-ED-b1m" id="Arc-gh-arH"/> <outlet property="view_topInfo" destination="xPt-ID-Aq3" id="7UY-x9-13F"/> <outlet property="view_tripInfo" destination="ysu-3F-DMF" id="Hih-fT-c8S"/> </connections> </placeholder> OKProject/Extension/AttributedStringbuilder.swift
@@ -16,18 +16,22 @@ return AttributedStringbuilder() } @discardableResult func add(string: String,withFont: UIFont,withColor: UIColor,lineSpace: CGFloat) -> AttributedStringbuilder { let style = NSMutableParagraphStyle() style.lineSpacing = lineSpace mutableAttributedString.append(NSAttributedString(string: string, attributes: [NSAttributedString.Key.foregroundColor: withColor,NSAttributedString.Key.font: withFont, NSAttributedString.Key.paragraphStyle: style])) return self } @discardableResult func add(string: String,withFont: UIFont,withColor: UIColor,backColor: UIColor) -> AttributedStringbuilder { let style = NSMutableParagraphStyle() mutableAttributedString.append(NSAttributedString(string: string, attributes: [NSAttributedString.Key.foregroundColor: withColor,NSAttributedString.Key.font: withFont,NSAttributedString.Key.backgroundColor: backColor, NSAttributedString.Key.paragraphStyle: style])) return self } @discardableResult func add(string: String,withFont: UIFont,withColor: UIColor,indent: CGFloat) -> AttributedStringbuilder { let style = NSMutableParagraphStyle() style.firstLineHeadIndent = indent @@ -35,6 +39,7 @@ return self } @discardableResult func add(string: String,withFont: UIFont,withColor: UIColor,indent: CGFloat,lineSpace: CGFloat) -> AttributedStringbuilder { let style = NSMutableParagraphStyle() style.firstLineHeadIndent = indent @@ -43,6 +48,7 @@ return self } @discardableResult func underLine() -> AttributedStringbuilder { let range1 = NSRange(location: 0, length: mutableAttributedString.string.count) let number = NSNumber(value:NSUnderlineStyle.single.rawValue) @@ -50,23 +56,25 @@ return self } @discardableResult func add(string: String,withFont: UIFont,withColor: UIColor) -> AttributedStringbuilder { mutableAttributedString.append(NSAttributedString(string: string, attributes: [NSAttributedString.Key.foregroundColor: withColor,NSAttributedString.Key.font: withFont])) return self } @discardableResult func add(string: String,withSize: CGFloat,withColor: UIColor) -> AttributedStringbuilder { mutableAttributedString.append(NSAttributedString(string: string, attributes: [NSAttributedString.Key.foregroundColor: withColor,NSAttributedString.Key.font: UIFont.systemFont(ofSize: withSize)])) return self } @discardableResult func attach(attachment: NSTextAttachment) -> AttributedStringbuilder { mutableAttributedString.append(NSAttributedString(attachment: attachment)) return self } @discardableResult func attach(image: UIImage) -> AttributedStringbuilder { let attachment = NSTextAttachment() attachment.image = image OKProject/Extension/Date+Extension.swift
@@ -241,10 +241,10 @@ } /// 日期字符串转date static func dateStringToDate(_ dateStr:String) ->Date { static func dateStringToDate(_ dateStr:String,format:String = "yyyy-MM-dd") ->Date { let dateFormatter = DateFormatter() dateFormatter.timeZone = TimeZone(abbreviation: "UTC") dateFormatter.dateFormat = "yyyy-MM-dd" dateFormatter.dateFormat = format let date = dateFormatter.date(from: dateStr) return date! }