| | |
| | | import JQTools |
| | | |
| | | #if DEBUG |
| | | //let All_Url = "https://console-mock.apipost.cn/mock/b5b2dee0-5564-40ae-f082-a352d502a153" |
| | | let All_Url = "http://192.168.110.165:10393/mock/b5b2dee0-5564-40ae-f082-a352d502a153" |
| | | let All_Url = "https://console-mock.apipost.cn/mock/b5b2dee0-5564-40ae-f082-a352d502a153" |
| | | //let All_Url = "http://192.168.110.165:10393/mock/b5b2dee0-5564-40ae-f082-a352d502a153" |
| | | #else |
| | | let All_Url = "http://192.168.110.80:5209" |
| | | #endif |
| | |
| | | var activityListModel:ActivityListModel?{ |
| | | didSet{ |
| | | if let m = activityListModel{ |
| | | img_profile.sd_setImage(with: URL(string: m.coverDrawing)!) |
| | | img_profile.sd_setImage(with: URL(string: m.coverDrawing)!,placeholderImage: UIImage(named: "placeholder_1")) |
| | | label_title.text = m.name |
| | | |
| | | var temp = [String]() |
| | |
| | | class ActivityDetailApplyVC: BaseVC { |
| | | |
| | | |
| | | @IBOutlet weak var img_profile: UIImageView! |
| | | @IBOutlet weak var view_banner: UIView! |
| | | @IBOutlet weak var label_storeName: UILabel! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_joinCondition: UILabel! |
| | |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var btn_addStudent: QMUIButton! |
| | | @IBOutlet weak var cons_tableHei: NSLayoutConstraint! |
| | | |
| | | private lazy var bannerView:CommonBannerView = { |
| | | let v = CommonBannerView() |
| | | return v |
| | | }() |
| | | |
| | | var activityDetailModel:ActivityDetailModel! |
| | | private var students = [ActivityDetailPartModel]() |
| | |
| | | super.viewDidLoad() |
| | | title = "活动详情" |
| | | |
| | | img_profile.sd_setImage(with: URL(string: activityDetailModel.storeCoverDrawing)!) |
| | | label_storeName.text = activityDetailModel.storeName + "(\(activityDetailModel.storeAddress))" |
| | | label_title.text = activityDetailModel.name |
| | | label_joinCondition.text = activityDetailModel.registerCondition.strTitle |
| | |
| | | students.append(contentsOf: activityDetailModel.participant) |
| | | cons_tableHei.constant = Double(students.count) * 100 |
| | | tableView.reloadData() |
| | | |
| | | bannerView.setImages(images: activityDetailModel.imgs.components(separatedBy: ","), type: .URL) { index in |
| | | |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") |
| | | |
| | | view_banner.addSubview(bannerView) |
| | | bannerView.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.56) |
| | | } |
| | | |
| | | @IBAction func addStudentAction(_ sender: QMUIButton) { |
| | |
| | | <outlet property="btn_addStudent" destination="vFF-I7-FyB" id="mwi-Hb-JXm"/> |
| | | <outlet property="btn_enroll" destination="V8a-fY-mQH" id="UGV-vA-sh2"/> |
| | | <outlet property="cons_tableHei" destination="E7r-ch-NFQ" id="292-df-rws"/> |
| | | <outlet property="img_profile" destination="8p4-kz-QQR" id="Vr2-gO-BRG"/> |
| | | <outlet property="label_address" destination="w7l-Hs-7EQ" id="LdO-Sd-ibK"/> |
| | | <outlet property="label_ageScope" destination="RkB-65-NBj" id="v0f-KQ-KRu"/> |
| | | <outlet property="label_city" destination="gQe-UF-wHC" id="wu9-wX-bZd"/> |
| | |
| | | <outlet property="label_title" destination="Mnc-lb-0cc" id="1SY-Nz-XIn"/> |
| | | <outlet property="tableView" destination="UEA-WV-jZV" id="exc-tP-CQA"/> |
| | | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| | | <outlet property="view_banner" destination="YbN-ld-elv" id="thH-Vk-HMA"/> |
| | | </connections> |
| | | </placeholder> |
| | | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| | |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XMe-LD-M9B"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="1064.3333333333333"/> |
| | | <subviews> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8p4-kz-QQR"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="220"/> |
| | | <color key="backgroundColor" systemColor="systemGray6Color"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" secondItem="8p4-kz-QQR" secondAttribute="height" multiplier="1:0.56" id="OEP-pY-QP4"/> |
| | | </constraints> |
| | | </imageView> |
| | | <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="fI5-pl-psr"> |
| | | <rect key="frame" x="0.0" y="220.00000000000006" width="393" height="844.33333333333348"/> |
| | | <subviews> |
| | |
| | | </view> |
| | | </subviews> |
| | | </stackView> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YbN-ld-elv"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="220"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" secondItem="YbN-ld-elv" secondAttribute="height" multiplier="1:0.56" id="upA-bL-68E"/> |
| | | </constraints> |
| | | </view> |
| | | </subviews> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstAttribute="trailing" secondItem="fI5-pl-psr" secondAttribute="trailing" id="0PG-GF-oKD"/> |
| | | <constraint firstAttribute="trailing" secondItem="8p4-kz-QQR" secondAttribute="trailing" id="aOK-9P-atD"/> |
| | | <constraint firstAttribute="trailing" secondItem="YbN-ld-elv" secondAttribute="trailing" id="4H1-8l-mzt"/> |
| | | <constraint firstItem="fI5-pl-psr" firstAttribute="top" secondItem="YbN-ld-elv" secondAttribute="bottom" id="8sf-B6-aKQ"/> |
| | | <constraint firstItem="YbN-ld-elv" firstAttribute="leading" secondItem="XMe-LD-M9B" secondAttribute="leading" id="NcZ-BV-d39"/> |
| | | <constraint firstItem="fI5-pl-psr" firstAttribute="leading" secondItem="XMe-LD-M9B" secondAttribute="leading" id="daU-BI-fBa"/> |
| | | <constraint firstItem="8p4-kz-QQR" firstAttribute="leading" secondItem="XMe-LD-M9B" secondAttribute="leading" id="eQz-0P-h4G"/> |
| | | <constraint firstItem="fI5-pl-psr" firstAttribute="top" secondItem="8p4-kz-QQR" secondAttribute="bottom" id="opW-hM-4QD"/> |
| | | <constraint firstItem="8p4-kz-QQR" firstAttribute="top" secondItem="XMe-LD-M9B" secondAttribute="top" id="q2G-C8-Ago"/> |
| | | <constraint firstItem="YbN-ld-elv" firstAttribute="top" secondItem="XMe-LD-M9B" secondAttribute="top" id="qBX-yp-Apm"/> |
| | | <constraint firstAttribute="bottom" secondItem="fI5-pl-psr" secondAttribute="bottom" id="x5k-7r-5yI"/> |
| | | </constraints> |
| | | </view> |
| | |
| | | </namedColor> |
| | | <systemColor name="systemBackgroundColor"> |
| | | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | </systemColor> |
| | | <systemColor name="systemGray6Color"> |
| | | <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </systemColor> |
| | | </resources> |
| | | </document> |
| | |
| | | class ActivityDetailVC: BaseVC { |
| | | private var id:Int! |
| | | |
| | | @IBOutlet weak var img_profile: UIImageView! |
| | | @IBOutlet weak var view_banner: UIView! |
| | | @IBOutlet weak var label_storeName: UILabel! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_joinCondition: UILabel! |
| | |
| | | @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! |
| | | @IBOutlet weak var btn_enroll: UIButton! |
| | | |
| | | private lazy var bannerView:CommonBannerView = { |
| | | let v = CommonBannerView() |
| | | return v |
| | | }() |
| | | |
| | | |
| | | var activityDetailModel:ActivityDetailModel!{ |
| | | didSet{ |
| | | img_profile.sd_setImage(with: URL(string: activityDetailModel.storeCoverDrawing)!) |
| | | label_storeName.text = activityDetailModel.storeName + "(\(activityDetailModel.storeAddress))" |
| | | label_title.text = activityDetailModel.name |
| | | label_joinCondition.text = activityDetailModel.registerCondition.strTitle |
| | |
| | | btn_enroll.setTitle(name, for: .normal) |
| | | btn_enroll.backgroundColor = color |
| | | |
| | | bannerView.setImages(images:activityDetailModel.imgs.components(separatedBy: ","), type: .URL) { index in |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | override func setUI() { |
| | | view_banner.addSubview(bannerView) |
| | | bannerView.frame = CGRect(x: 0, y: 0, width: JQ_ScreenW, height: JQ_ScreenW * 0.56) |
| | | } |
| | | |
| | | @IBAction func joinAction(_ sender: UIButton) { |
| | | guard activityDetailModel.apply == 0 else {return} |
| | | let vc = ActivityDetailApplyVC(model: activityDetailModel) |
| | |
| | | <outlet property="btn_enroll" destination="lNv-6h-9fm" id="1jA-V7-JGL"/> |
| | | <outlet property="cons_imgEnrollHei" destination="cJz-gp-mRM" id="VWo-7z-5pw"/> |
| | | <outlet property="img_enrollRequired" destination="c7G-7A-ePH" id="juI-hw-hEe"/> |
| | | <outlet property="img_profile" destination="tHB-vU-AiW" id="X08-8x-bwm"/> |
| | | <outlet property="label_address" destination="bbY-Kb-C5z" id="WcD-uY-098"/> |
| | | <outlet property="label_ageScope" destination="qcG-AF-9Uh" id="1hS-Wj-Jym"/> |
| | | <outlet property="label_city" destination="NBi-eH-iIS" id="NtM-vD-ivy"/> |
| | |
| | | <outlet property="label_storeName" destination="l5e-Xg-fHb" id="wFX-gB-Ijt"/> |
| | | <outlet property="label_title" destination="uIe-np-Pwt" id="MHn-gz-rST"/> |
| | | <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> |
| | | <outlet property="view_banner" destination="Heq-PT-PV0" id="9Jk-WR-odn"/> |
| | | </connections> |
| | | </placeholder> |
| | | <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> |
| | |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L7Z-R8-Jpz"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="1064.3333333333333"/> |
| | | <subviews> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tHB-vU-AiW"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="220"/> |
| | | <color key="backgroundColor" systemColor="systemGray6Color"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" secondItem="tHB-vU-AiW" secondAttribute="height" multiplier="1:0.56" id="Tgb-wP-wRL"/> |
| | | </constraints> |
| | | </imageView> |
| | | <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="HXl-f8-gCo"> |
| | | <rect key="frame" x="0.0" y="220.00000000000006" width="393" height="844.33333333333348"/> |
| | | <subviews> |
| | |
| | | </view> |
| | | </subviews> |
| | | </stackView> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Heq-PT-PV0"> |
| | | <rect key="frame" x="0.0" y="0.0" width="393" height="220"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" secondItem="Heq-PT-PV0" secondAttribute="height" multiplier="1:0.56" id="2XN-QZ-yIX"/> |
| | | </constraints> |
| | | </view> |
| | | </subviews> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <constraints> |
| | | <constraint firstItem="tHB-vU-AiW" firstAttribute="leading" secondItem="L7Z-R8-Jpz" secondAttribute="leading" id="5Nv-16-sJW"/> |
| | | <constraint firstItem="HXl-f8-gCo" firstAttribute="top" secondItem="tHB-vU-AiW" secondAttribute="bottom" id="5ql-rJ-qfS"/> |
| | | <constraint firstAttribute="trailing" secondItem="Heq-PT-PV0" secondAttribute="trailing" id="3QY-7K-7es"/> |
| | | <constraint firstItem="HXl-f8-gCo" firstAttribute="leading" secondItem="L7Z-R8-Jpz" secondAttribute="leading" id="8T3-BU-zfZ"/> |
| | | <constraint firstItem="tHB-vU-AiW" firstAttribute="top" secondItem="L7Z-R8-Jpz" secondAttribute="top" id="C5Z-fW-Le1"/> |
| | | <constraint firstAttribute="trailing" secondItem="tHB-vU-AiW" secondAttribute="trailing" id="ESE-Pv-sl4"/> |
| | | <constraint firstItem="Heq-PT-PV0" firstAttribute="leading" secondItem="L7Z-R8-Jpz" secondAttribute="leading" id="cyv-i6-HRm"/> |
| | | <constraint firstItem="Heq-PT-PV0" firstAttribute="top" secondItem="L7Z-R8-Jpz" secondAttribute="top" id="eKh-Kk-AOl"/> |
| | | <constraint firstAttribute="trailing" secondItem="HXl-f8-gCo" secondAttribute="trailing" id="kCd-UX-HAd"/> |
| | | <constraint firstItem="HXl-f8-gCo" firstAttribute="top" secondItem="Heq-PT-PV0" secondAttribute="bottom" id="wiw-zL-ywP"/> |
| | | <constraint firstAttribute="bottom" secondItem="HXl-f8-gCo" secondAttribute="bottom" id="yTi-tJ-6xJ"/> |
| | | </constraints> |
| | | </view> |
| | |
| | | </namedColor> |
| | | <systemColor name="systemBackgroundColor"> |
| | | <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | </systemColor> |
| | | <systemColor name="systemGray6Color"> |
| | | <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | </systemColor> |
| | | </resources> |
| | | </document> |
| | |
| | | didSet{ |
| | | stackView_vipPrice.isHidden = courseItemModel.originalPrice == nil |
| | | label_originPrice.isHidden = courseItemModel.originalPrice == nil |
| | | label_vipPrice.text = "会员价:\(courseItemModel.vipPrice.currency())" |
| | | |
| | | img_cover.sd_setImage(with: URL(string: courseItemModel.coverDrawing)) |
| | | img_cover.sd_setImage(with: URL(string: courseItemModel.coverDrawing),placeholderImage: UIImage(named: "placeholder_1")) |
| | | label_title.text = String(format: "%@(%@)", courseItemModel.name,courseItemModel.storeName) |
| | | label_teachTime.text = String(format: "上课时间:%@", courseItemModel.classStartTime) |
| | | label_enrollNumber.text = String(format: "已报名:%ld人", courseItemModel.applicantsNumber) |
| | |
| | | } |
| | | |
| | | |
| | | label_originPrice.attributedText = AttributedStringbuilder.build().add(string: courseItemModel.originalPrice?.currency() ?? "", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).underLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString |
| | | label_originPrice.attributedText = AttributedStringbuilder.build().add(string: courseItemModel.originalPrice?.currency() ?? "", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#C6C6C6")).delLine(color: UIColor(hexStr: "#C6C6C6")).mutableAttributedString |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | let idCardView = IDCardView() |
| | | idCardView.box.bind { text in |
| | | self.tf_idCard.text = text |
| | | idCardView.box.bind { [weak self] text in |
| | | self?.tf_idCard.text = text |
| | | } |
| | | tf_idCard.inputView = idCardView |
| | | |
| | |
| | | extension AddStudentVC:UITextFieldDelegate{ |
| | | func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { |
| | | if textField == tf_birthday{ |
| | | CommonDatePickerView.show(before: 18, after: 0, type: .YMD) { year, month, day in |
| | | textField.text = String(format: "%ld-%02ld-%02ld", year,month,day!) |
| | | CommonDatePickerView.show(before: 18, after: 0, type: .YMD) { year, month, day,_,_ in |
| | | textField.text = String(format: "%ld-%02ld-%02ld", year!,month!,day!) |
| | | } |
| | | return false |
| | | } |
| | |
| | | collectionView.register(UINib(nibName: "Common_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_Common_1_CCell") |
| | | |
| | | studentTableView.dataSource = self |
| | | studentTableView.separatorStyle = .none |
| | | studentTableView.register(UINib(nibName: "StudentInfoTCell", bundle: nil), forCellReuseIdentifier: "_StudentInfoTCell") |
| | | |
| | | btn_addStudent.imagePosition = .right |
| | |
| | | } |
| | | |
| | | @objc func datetimePickerAction(){ |
| | | CommonDatePickerView.show(before: 3, after: 0, type: .YM) { [weak self] year, month, _ in |
| | | let date = Date.jq_format(year: year, month: month, day: 2) |
| | | CommonDatePickerView.show(before: 3, after: 0, type: .YM) { [weak self] year, month, _,_,_ in |
| | | let date = Date.jq_format(year: year!, month: month!, day: 2) |
| | | self?.sectionView.btn_datetime.setTitle(date!.jq_format("yyyy年MM月>"), for: .normal) |
| | | self?.viewModel.startTime.accept(date) |
| | | self?.viewModel.beginRefresh() |
| | |
| | | class CommonDatePickerView: UIView,JQNibView{ |
| | | |
| | | enum DatePickerType{ |
| | | case YMD,YM |
| | | case YMD,YM,HHmm |
| | | } |
| | | |
| | | @IBOutlet weak var view_container: UIView! |
| | |
| | | |
| | | private var years = [Int]() |
| | | private var months = [1,2,3,4,5,6,7,8,9,10,11,12] |
| | | private var hours = [Int]() |
| | | private var minutes = [Int]() |
| | | private var days = [Int]() |
| | | private var clouse:((Int,Int,Int?)->Void)? |
| | | private var clouse:((Int?,Int?,Int?,Int?,Int?)->Void)? |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | |
| | | /// - before: 向上N年 |
| | | /// - after: 向下N年 |
| | | /// - type: 显示状态 |
| | | static func show(before:Int = 0,after:Int = 0,type:DatePickerType = .YM,clouse:@escaping (Int,Int,Int?)->Void){ |
| | | static func show(before:Int = 0,after:Int = 0,type:DatePickerType = .YM,clouse:@escaping (Int?,Int?,Int?,Int?,Int?)->Void){ |
| | | let pickerView = CommonDatePickerView.jq_loadNibView() |
| | | pickerView.type = type |
| | | pickerView.clouse = clouse |
| | | |
| | | |
| | | if type == .YM || type == .YMD{ |
| | | if before > 0{ |
| | | for i in 0...before{ |
| | | pickerView.years.append(Date().jq_nowYear() - i) |
| | |
| | | pickerView.years.append(Date().jq_nowYear() + i) |
| | | } |
| | | } |
| | | // pickerView.years = pickerView.years.sorted() |
| | | } |
| | | |
| | | if type == .HHmm{ |
| | | for i in 0...24{ |
| | | pickerView.hours.append(i) |
| | | } |
| | | |
| | | for i in 0...59{ |
| | | pickerView.minutes.append(i) |
| | | } |
| | | } |
| | | |
| | | |
| | | pickerView.frame = screnDelegate?.window?.frame ?? .zero |
| | | screnDelegate?.window?.addSubview(pickerView) |
| | |
| | | @IBAction func completeAction(_ sender: UIButton) { |
| | | |
| | | |
| | | var year:Int! |
| | | var month:Int! |
| | | var year:Int? |
| | | var month:Int? |
| | | var day:Int? |
| | | var hour:Int? |
| | | var minute:Int? |
| | | |
| | | switch type{ |
| | | case .YMD: |
| | |
| | | case .YM: |
| | | year = years[pickerView.selectedRow(inComponent: 0)] |
| | | month = months[pickerView.selectedRow(inComponent: 1)] |
| | | case .HHmm: |
| | | hour = hours[pickerView.selectedRow(inComponent: 0)] |
| | | minute = minutes[pickerView.selectedRow(inComponent: 1)] |
| | | case .none:break |
| | | } |
| | | |
| | |
| | | self.layoutIfNeeded() |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | self.clouse?(year,month,day) |
| | | self.clouse?(year,month,day,hour,minute) |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | if component == 1{ |
| | | if type == .YMD{pickerView.reloadComponent(2)} |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | extension CommonDatePickerView:UIPickerViewDataSource{ |
| | | func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { |
| | | |
| | | if component == 0{return years.count |
| | | |
| | | }else if component == 1{ |
| | | if component == 0{ |
| | | switch type{ |
| | | case .YM,.YMD:return years.count |
| | | case .HHmm:return hours.count |
| | | case .none:return 0 |
| | | } |
| | | } |
| | | |
| | | if component == 1{ |
| | | switch type{ |
| | | case .YM,.YMD: |
| | | if component == 1 && pickerView.selectedRow(inComponent: 0) == 0{ |
| | | return Date().jq_nowMonth() |
| | | } |
| | | return months.count |
| | | }else if component == 2{ |
| | | case .HHmm: |
| | | return minutes.count |
| | | case .none: |
| | | return 0 |
| | | } |
| | | } |
| | | |
| | | if component == 2{ |
| | | switch type{ |
| | | case .YMD: |
| | | let year = years[pickerView.selectedRow(inComponent: 0)] |
| | | let month = months[pickerView.selectedRow(inComponent: 1)] |
| | | return Date.jq_getDays(year, month) |
| | | default:return 0 |
| | | } |
| | | } |
| | | |
| | | return 0 |
| | | } |
| | | |
| | | func numberOfComponents(in pickerView: UIPickerView) -> Int { |
| | | switch type{ |
| | | case .YM:return 2 |
| | | case .YM,.HHmm:return 2 |
| | | case .YMD:return 3 |
| | | case .none:return 0 |
| | | } |
| | |
| | | |
| | | func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { |
| | | if component == 0{ |
| | | return "\(years[row])年" |
| | | }else if component == 1{ |
| | | return "\(months[row])月" |
| | | }else{ |
| | | return "\(row + 1)日" |
| | | switch type{ |
| | | case .YM,.YMD:return "\(years[row])年" |
| | | case .HHmm:return String(format: "%02ld时", hours[row]) |
| | | default:return nil |
| | | } |
| | | } |
| | | |
| | | if component == 1{ |
| | | switch type{ |
| | | case .YM,.YMD:return "\(months[row])月" |
| | | case .HHmm:return String(format: "%02ld分", minutes[row]) |
| | | default:return nil |
| | | } |
| | | } |
| | | |
| | | if component == 2{ |
| | | switch type{ |
| | | case .YMD:return "\(row + 1)日" |
| | | default:return nil |
| | | } |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @IBAction func datetimeAction(_ sender: UIButton) { |
| | | CommonDatePickerView.show(before: 3, after: 0, type: .YM) {[weak self] year, month, day in |
| | | self?.btn_date.setTitle(String(format: "%ld年%02ld月>", year,month), for: .normal) |
| | | self?.viewModel.yearMonth.accept(String(format: "%ld-02ld", year,month)) |
| | | CommonDatePickerView.show(before: 3, after: 0, type: .YM) {[weak self] year, month, day,_,_ in |
| | | self?.btn_date.setTitle(String(format: "%ld年%02ld月>", year!,month!), for: .normal) |
| | | self?.viewModel.yearMonth.accept(String(format: "%ld-02ld", year!,month!)) |
| | | self?.viewModel.beginRefresh() |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @objc func datetimePickerAction(){ |
| | | CommonDatePickerView.show(before: 2, after: 0, type: .YM) {[weak self] year, month,_ in |
| | | CommonDatePickerView.show(before: 2, after: 0, type: .YM) {[weak self] year, month,_,_,_ in |
| | | |
| | | self?.viewModel?.yearMonth.accept(String(format: "%ld年%ld月", year,month)) |
| | | self?.viewModel?.yearMonth.accept(String(format: "%ld年%ld月", year!,month!)) |
| | | self?.viewModel?.beginRefresh() |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @objc func fliterAction(){ |
| | | JQ_MenuView().show(self, tapView: btn_filter, items: ["全部","未使用","已使用","已过期"], tableHei: 150) {[weak self] index, str in |
| | | JQ_MenuView().show(self, tapView: btn_filter, items: ["全部","未使用","已使用","已过期"], tableHei: 230) {[weak self] index, str in |
| | | self?.btn_filter.setTitle(str, for: .normal) |
| | | if let vc = self?.pageViewController.currentController as? WelfareCouponsSubListVC{ |
| | | if index == 0{ |
| | |
| | | </button> |
| | | <wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BSv-nd-B1r"> |
| | | <rect key="frame" x="0.0" y="59" width="393" height="711"/> |
| | | <color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
| | | <wkWebViewConfiguration key="configuration"> |
| | | <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/> |
| | | <wkPreferences key="preferences"/> |
| | |
| | | |
| | | Services.querySiteType().subscribe(onNext: {data in |
| | | if let models = data.data{ |
| | | self.yardTypeItems = models |
| | | self.yardTypeItems.append(NormalSimpleModel(id: 0, name: "全部")) |
| | | self.yardTypeItems.append(contentsOf: models) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | Services.queryStoreList().subscribe(onNext: {data in |
| | | if let models = data.data{ |
| | | self.storeItems = models |
| | | self.storeItems.append(NormalSimpleModel(id: 0, name: "全部")) |
| | | self.storeItems.append(contentsOf: models) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | |
| | | guard !sender.isSelected else {return} |
| | | closeAction() |
| | | sender.isSelected = true |
| | | CourseSubTypeView.show(inView: self.view, afterView: view_top, items: yardTypeItems, selectModel: viewModel.siteType.value) { [weak self] m in |
| | | yardTypeView = CourseSubTypeView.show(inView: self.view, afterView: view_top, items: yardTypeItems, selectModel: viewModel.siteType.value) { [weak self] m in |
| | | sender.isSelected = false |
| | | sender.setTitle(m.name, for: .normal) |
| | | if m.id == 0{ |
| | | self?.viewModel.siteType.accept(nil) |
| | | sender.setTitle("场地类型", for: .normal) |
| | | }else{ |
| | | self?.viewModel.siteType.accept(m) |
| | | sender.setTitle(m.name, for: .normal) |
| | | } |
| | | |
| | | self?.viewModel.beginRefresh() |
| | | } closeClouse: { |
| | | sender.isSelected = false |
| | |
| | | sender.isSelected = true |
| | | inStoreView = CourseSubTypeView.show(inView: self.view, afterView: view_top, items: storeItems,selectModel: viewModel.inStore.value) { [weak self] m in |
| | | sender.isSelected = false |
| | | if m.id == 0{ |
| | | sender.setTitle("所在门店", for: .normal) |
| | | self?.viewModel.inStore.accept(nil) |
| | | }else{ |
| | | sender.setTitle(m.name, for: .normal) |
| | | self?.viewModel.inStore.accept(m) |
| | | } |
| | | self?.viewModel.beginRefresh() |
| | | } closeClouse: { |
| | | sender.isSelected = false |
| | |
| | | |
| | | |
| | | @IBAction func startTimeAction(_ sender: Any) { |
| | | CommonDatePickerView.show(before: 10, after: 0, type: .YM) {[weak self] year, month, _ in |
| | | self?.tf_startTime.text = String(format: "%ld-%02ld", year,month) |
| | | CommonDatePickerView.show(type: .HHmm) {[weak self] _, _, _,hour,minute in |
| | | self?.tf_startTime.text = String(format: "%02ld:%02ld", hour!,minute!) |
| | | } |
| | | } |
| | | |
| | | @IBAction func endTimeAction(_ sender: Any) { |
| | | CommonDatePickerView.show(before: 0, after: 2, type: .YM) { [weak self] year, month, _ in |
| | | self?.tf_endTime.text = String(format: "%ld-%02ld", year,month) |
| | | CommonDatePickerView.show(type: .HHmm) { [weak self] _, _, _,hour,minute in |
| | | self?.tf_endTime.text = String(format: "%02ld:%02ld", hour!,minute!) |
| | | } |
| | | } |
| | | |