From 4966eb10cbf5ce9c6ee37a13d393fb0ae2d85b60 Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期五, 08 三月 2024 21:59:57 +0800 Subject: [PATCH] 2.0功能完成 --- WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/Contents.json | 22 WanPai/Root/Search/VC/WorldCupContentApplyVC.swift | 32 WanPai/Root/Search/VC/MatchDetailVC.xib | 10 WanPai/Root/Search/VC/WorldCupVC.swift | 49 + WanPai/Root/Search/VC/MatchDetailVC.swift | 98 ++ WanPai/Root/Welfare/VC/WorldCupIntroVC.swift | 2 WanPai/Root/Course/VC/AddStudentVC.xib | 13 WanPai/Root/Home/VC/WorldCupListVC.swift | 10 WanPai/Root/Home/VC/HomeVC.xib | 6 WanPai/Root/Search/TCell/JudgeTCell.swift | 2 WanPai/Network/Services.swift | 3 WanPai/Base/BaseNav.swift | 324 +++++----- WanPai/Root/Home/VC/HomeVC.swift | 12 WanPai/Root/Home/VC/WorldCupListVC.xib | 10 WanPai/Root/Search/VC/WorldCupHeaderVC.swift | 42 WanPai/Root/Home/Model/HomeModel.swift | 1 WanPai/Common/View/AgreentView.swift | 2 WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@2x.png | 0 WanPai/Root/Other/View/StudentChoose2View.swift | 10 WanPai/Root/Search/VC/WorldCupRankVC.swift | 50 + WanPai/Config/Enums.swift | 4 WanPai/Root/Search/TCell/WorldCupRankTCell.swift | 26 WanPai/Root/Search/VC/WorldCupContentDetailVC.xib | 5 WanPai/Root/Search/VC/WorldCupContentApplyInputVC.swift | 173 ++-- WanPai/Root/Search/VC/WorldCupContentApplyVC.xib | 5 WanPai/Root/Home/Model/WorldCupModel.swift | 7 WanPai/Root/Search/VC/JudgeListVC.swift | 1 WanPai/Root/Search/VC/WorldCupContentDetailVC.swift | 9 WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@3x.png | 0 WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift | 336 +++++----- WanPai/Root/Search/VC/WorldCupRecordVC.swift | 12 WanPai/Config/Def.swift | 7 WanPai/Common/View/QRPreview.xib | 6 WanPai/Root/Search/VC/WorldCupContentApplyInputVC.xib | 5 WanPai/Root/Course/VC/AddStudentVC.swift | 399 ++++++------ WanPai/Root/Search/VC/WorldCupContentVC.swift | 40 + WanPai/Root/Search/VC/SearchVC.swift | 8 37 files changed, 1,008 insertions(+), 733 deletions(-) diff --git a/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/Contents.json b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/Contents.json new file mode 100644 index 0000000..1eeb66f --- /dev/null +++ b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "bg_worldCup@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "bg_worldCup@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@2x.png b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@2x.png new file mode 100644 index 0000000..6548309 --- /dev/null +++ b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@2x.png Binary files differ diff --git a/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@3x.png b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@3x.png new file mode 100644 index 0000000..2423a43 --- /dev/null +++ b/WanPai/Assets.xcassets/Bg/bg_worldCup.imageset/bg_worldCup@3x.png Binary files differ diff --git a/WanPai/Base/BaseNav.swift b/WanPai/Base/BaseNav.swift index a0a2bc7..083a224 100644 --- a/WanPai/Base/BaseNav.swift +++ b/WanPai/Base/BaseNav.swift @@ -1,174 +1,184 @@ - // - // BaseNavigationController.swift - // BrokerDriver - // - // Created by 无故事王国 on 2023/4/24. - // +// +// BaseNavigationController.swift +// BrokerDriver +// +// Created by 无故事王国 on 2023/4/24. +// import UIKit import JQTools class BaseNav: UINavigationController,UINavigationControllerDelegate { - -// private var popDelegate: UIGestureRecognizerDelegate? + + // private var popDelegate: UIGestureRecognizerDelegate? - /// 需要透明Nav的VC - private var lucencyVCs = [RechargeRecordVC.self,RechargeCenterVC.self] + /// 需要透明Nav的VC + private var lucencyVCs = [RechargeRecordVC.self,RechargeCenterVC.self] - private let img = UIImage.jq_gradient([UIColor(hexStr: "#FD8C02"),UIColor(hexStr: "#FD7202")], size: CGSize(width: JQ_ScreenW, height: JQ_NavBarHeight), radius: 0, locations: [0,1], direction: .vertical) - - open override func viewDidLoad() { - super.viewDidLoad() - self.navigationBar.barTintColor = .white - self.navigationBar.titleTextAttributes = [.font:UIFont.systemFont(ofSize: 18, weight: .medium), .foregroundColor:UIColor.white] - self.navigationBar.tintColor = UIColor.black - self.navigationBar.shadowImage = UIImage() - self.navigationBar.isTranslucent = true - self.delegate = self -// self.popDelegate = self.interactivePopGestureRecognizer?.delegate - self.interactivePopGestureRecognizer?.delegate = self + /// 世界杯风格 + private var worldCupVCs = [SearchVC.self,WorldCupVC.self,WorldCupHeaderVC.self,WorldCupMenuVC.self,WorldCupContentVC.self,WorldCupRecordVC.self,WorldCupRankVC.self] + + private let img = UIImage.jq_gradient([UIColor(hexStr: "#FD8C02"),UIColor(hexStr: "#FD7202")], size: CGSize(width: JQ_ScreenW, height: JQ_NavBarHeight), radius: 0, locations: [0,1], direction: .vertical) + + open override func viewDidLoad() { + super.viewDidLoad() + self.navigationBar.barTintColor = .white + self.navigationBar.titleTextAttributes = [.font:UIFont.systemFont(ofSize: 18, weight: .medium), .foregroundColor:UIColor.white] + self.navigationBar.tintColor = UIColor.black + self.navigationBar.shadowImage = UIImage() + self.navigationBar.isTranslucent = true + self.delegate = self + // self.popDelegate = self.interactivePopGestureRecognizer?.delegate + self.interactivePopGestureRecognizer?.delegate = self - if #available(iOS 15.0, *) { - let scrollBar = UINavigationBarAppearance() - scrollBar.configureWithOpaqueBackground() - scrollBar.backgroundEffect = nil - scrollBar.shadowColor = nil - scrollBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] - scrollBar.backgroundColor = UIColor.clear - scrollBar.backgroundImage = img - - - let standardBar = UINavigationBarAppearance() - standardBar.configureWithOpaqueBackground() - standardBar.backgroundEffect = nil - standardBar.shadowColor = nil - standardBar.shadowImage = nil - standardBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] - standardBar.backgroundColor = UIColor.clear - standardBar.backgroundImage = img - - navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 - navigationBar.standardAppearance = standardBar - }else { - navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] - navigationBar.isTranslucent = true - navigationBar.setBackgroundImage(UIImage(), for: .default) - navigationBar.shadowImage = UIImage() - } - } - - open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { - let status = lucencyVCs.contains(where: {$0 == viewController.classForCoder}) - if (navigationController.viewControllers.count == 1 || status) && !(viewController is WelfareVC){ - if #available(iOS 15.0, *) { - navigationBar.standardAppearance.backgroundImage = nil - navigationBar.scrollEdgeAppearance?.backgroundImage = nil - }else{ - navigationBar.setBackgroundImage(UIImage(), for: .default) - navigationBar.shadowImage = UIImage() - } - }else{ - if #available(iOS 15.0, *) { - navigationBar.standardAppearance.backgroundImage = img - navigationBar.scrollEdgeAppearance?.backgroundImage = img - }else{ - navigationBar.setBackgroundImage(img, for: .default) - } - } - } - - //侧滑 - public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { - if viewController == self.viewControllers[0] { - self.interactivePopGestureRecognizer!.delegate = self - }else{ - self.interactivePopGestureRecognizer!.delegate = nil - } - } + if #available(iOS 15.0, *) { + let scrollBar = UINavigationBarAppearance() + scrollBar.configureWithOpaqueBackground() + scrollBar.backgroundEffect = nil + scrollBar.shadowColor = nil + scrollBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] + scrollBar.backgroundColor = UIColor.clear + scrollBar.backgroundImage = img - open override var childForStatusBarHidden: UIViewController? { - return self.topViewController - } - - open override var childForStatusBarStyle: UIViewController? { - return self.topViewController - } - - override var preferredStatusBarStyle: UIStatusBarStyle{ - return .lightContent - } + + let standardBar = UINavigationBarAppearance() + standardBar.configureWithOpaqueBackground() + standardBar.backgroundEffect = nil + standardBar.shadowColor = nil + standardBar.shadowImage = nil + standardBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] + standardBar.backgroundColor = UIColor.clear + standardBar.backgroundImage = img + + navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 + navigationBar.standardAppearance = standardBar + }else { + navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont] + navigationBar.isTranslucent = true + navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationBar.shadowImage = UIImage() + } + } + + open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { + + if worldCupVCs.contains(where: {$0 == viewController.classForCoder}){ + navigationBar.standardAppearance.backgroundImage = UIImage(named: "bg_worldCup") + navigationBar.scrollEdgeAppearance?.backgroundImage = UIImage(named: "bg_worldCup") + return + } + + let status = lucencyVCs.contains(where: {$0 == viewController.classForCoder}) + if (navigationController.viewControllers.count == 1 || status) && !(viewController is WelfareVC){ + if #available(iOS 15.0, *) { + navigationBar.standardAppearance.backgroundImage = nil + navigationBar.scrollEdgeAppearance?.backgroundImage = nil + }else{ + navigationBar.setBackgroundImage(UIImage(), for: .default) + navigationBar.shadowImage = UIImage() + } + }else{ + if #available(iOS 15.0, *) { + navigationBar.standardAppearance.backgroundImage = img + navigationBar.scrollEdgeAppearance?.backgroundImage = img + }else{ + navigationBar.setBackgroundImage(img, for: .default) + } + } + } + + //侧滑 + public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { + if viewController == self.viewControllers[0] { + self.interactivePopGestureRecognizer!.delegate = self + }else{ + self.interactivePopGestureRecognizer!.delegate = nil + } + } + + open override var childForStatusBarHidden: UIViewController? { + return self.topViewController + } + + open override var childForStatusBarStyle: UIViewController? { + return self.topViewController + } + + override var preferredStatusBarStyle: UIStatusBarStyle{ + return .lightContent + } } class LoginNav: UINavigationController,UINavigationControllerDelegate { - - private var popDelegate: UIGestureRecognizerDelegate? - - open override func viewDidLoad() { - super.viewDidLoad() - self.navigationBar.barTintColor = .white - self.navigationBar.titleTextAttributes = [.font:UIFont.systemFont(ofSize: 18, weight: .medium), .foregroundColor:UIColor.black] - self.navigationBar.tintColor = UIColor.black - self.navigationBar.shadowImage = UIImage() - self.navigationBar.isTranslucent = true - self.delegate = self - self.popDelegate = self.interactivePopGestureRecognizer?.delegate - - - if #available(iOS 15.0, *) { - - // let img = UIImage.jq_gradient([UIColor(hexStr: "#FD8C02"),UIColor(hexStr: "#FD7202")], size: CGSize(width: JQ_ScreenW, height: JQ_NavBarHeight), radius: 0, locations: [0,1], direction: .vertical) - - let scrollBar = UINavigationBarAppearance() - scrollBar.configureWithOpaqueBackground() - scrollBar.backgroundEffect = nil - scrollBar.shadowColor = nil - scrollBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] - scrollBar.backgroundColor = UIColor.clear - // scrollBar.backgroundImage = img - - - let standardBar = UINavigationBarAppearance() - standardBar.configureWithOpaqueBackground() - standardBar.backgroundEffect = nil - standardBar.shadowColor = nil - standardBar.shadowImage = nil - standardBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] - standardBar.backgroundColor = UIColor.clear - // standardBar.backgroundImage = img - - navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 - navigationBar.standardAppearance = standardBar - - - }else { - navigationBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] - } - } - - open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { - - - } - - //侧滑 - public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { - if viewController == self.viewControllers[0] { - self.interactivePopGestureRecognizer!.delegate = self.popDelegate - }else{ - self.interactivePopGestureRecognizer!.delegate = nil - } - } - - open override var childForStatusBarHidden: UIViewController? { - return self.topViewController - } - - open override var childForStatusBarStyle: UIViewController? { - return self.topViewController - } - + + private var popDelegate: UIGestureRecognizerDelegate? + + open override func viewDidLoad() { + super.viewDidLoad() + self.navigationBar.barTintColor = .white + self.navigationBar.titleTextAttributes = [.font:UIFont.systemFont(ofSize: 18, weight: .medium), .foregroundColor:UIColor.black] + self.navigationBar.tintColor = UIColor.black + self.navigationBar.shadowImage = UIImage() + self.navigationBar.isTranslucent = true + self.delegate = self + self.popDelegate = self.interactivePopGestureRecognizer?.delegate + + + if #available(iOS 15.0, *) { + + // let img = UIImage.jq_gradient([UIColor(hexStr: "#FD8C02"),UIColor(hexStr: "#FD7202")], size: CGSize(width: JQ_ScreenW, height: JQ_NavBarHeight), radius: 0, locations: [0,1], direction: .vertical) + + let scrollBar = UINavigationBarAppearance() + scrollBar.configureWithOpaqueBackground() + scrollBar.backgroundEffect = nil + scrollBar.shadowColor = nil + scrollBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] + scrollBar.backgroundColor = UIColor.clear + // scrollBar.backgroundImage = img + + + let standardBar = UINavigationBarAppearance() + standardBar.configureWithOpaqueBackground() + standardBar.backgroundEffect = nil + standardBar.shadowColor = nil + standardBar.shadowImage = nil + standardBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] + standardBar.backgroundColor = UIColor.clear + // standardBar.backgroundImage = img + + navigationBar.scrollEdgeAppearance = scrollBar //顶部透明 + navigationBar.standardAppearance = standardBar + + + }else { + navigationBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor,.font:Def_NavFont] + } + } + + open func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { + + + } + + //侧滑 + public func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { + if viewController == self.viewControllers[0] { + self.interactivePopGestureRecognizer!.delegate = self.popDelegate + }else{ + self.interactivePopGestureRecognizer!.delegate = nil + } + } + + open override var childForStatusBarHidden: UIViewController? { + return self.topViewController + } + + open override var childForStatusBarStyle: UIViewController? { + return self.topViewController + } + } diff --git a/WanPai/Common/View/AgreentView.swift b/WanPai/Common/View/AgreentView.swift index 5e96e08..9b4ad5d 100644 --- a/WanPai/Common/View/AgreentView.swift +++ b/WanPai/Common/View/AgreentView.swift @@ -43,7 +43,7 @@ let attributed = AttributedStringbuilder.build() - if type != .other && type != .matchStore && type != .useStore{ + if type != .other && type != .matchStore && type != .useStore && type != .matchPoint{ Services.queryProtocol(type,progress: false).subscribe(onNext: { result in if let text = result.data?.jq_wrapHtml(){ attributed.add(string: text, withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "727272"), lineSpace: 4) diff --git a/WanPai/Common/View/QRPreview.xib b/WanPai/Common/View/QRPreview.xib index de5348d..f2af500 100644 --- a/WanPai/Common/View/QRPreview.xib +++ b/WanPai/Common/View/QRPreview.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22129"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -33,7 +33,7 @@ </connections> </button> </subviews> - <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/> + <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.90000000000000002" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="trailing" secondItem="6HX-Cl-1DV" secondAttribute="trailing" constant="44" id="97i-gB-Zk8"/> <constraint firstItem="Uua-ww-qMC" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Hsf-NB-MIA"/> diff --git a/WanPai/Config/Def.swift b/WanPai/Config/Def.swift index 25a60e1..8210bbb 100644 --- a/WanPai/Config/Def.swift +++ b/WanPai/Config/Def.swift @@ -236,7 +236,12 @@ } if page == "社区世界杯"{ - JQ_currentViewController().jq_push(vc: WorldCupListVC()) + if type == "详情"{ + JQ_currentViewController().jq_push(vc: WorldCupContentApplyVC(id: id!)) + } + if type == "主页" || type == "列表"{ + JQ_currentViewController().jq_push(vc: WorldCupListVC()) + } } case "开始课程": diff --git a/WanPai/Config/Enums.swift b/WanPai/Config/Enums.swift index dc76812..599a34e 100644 --- a/WanPai/Config/Enums.swift +++ b/WanPai/Config/Enums.swift @@ -125,6 +125,8 @@ ///智慧球场 case wisdomCourt = 8 + case worldcupDetail = 9 + case nothing = -999 var defaultImg:UIImage{ @@ -146,7 +148,7 @@ case .wisdomCourt: return UIImage(named: "b_7")! default: - return UIImage() + return UIImage(named: "b_1")! } } } diff --git a/WanPai/Network/Services.swift b/WanPai/Network/Services.swift index f86015d..feb6cf9 100644 --- a/WanPai/Network/Services.swift +++ b/WanPai/Network/Services.swift @@ -14,7 +14,8 @@ #if DEBUG //let All_Url = "http://192.168.110.27:56666" //罗易胜 //let All_Url = "http://192.168.110.85:56666" //正式地址 -let All_Url = "http://192.168.110.80:56666" //正式地址 +//let All_Url = "http://192.168.110.80:56666" //正式地址 +let All_Url = "http://221.182.45.100:56666" let Game_Url = "https://try.daowepark.com" //let Socket_Url = "192.168.110.22" #else diff --git a/WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift b/WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift index 075fbbd..9b4a491 100644 --- a/WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift +++ b/WanPai/Root/Activity/VC/ActivitySignupDetailVC.swift @@ -14,175 +14,175 @@ class ActivitySignupDetailVC: BaseVC { - private var id:Int! - @IBOutlet weak var view_banner: CommonBannerView! - // @IBOutlet weak var img_profile: UIImageView! -// @IBOutlet weak var label_storeNames: UILabel! - @IBOutlet weak var label_title: UILabel! - @IBOutlet weak var label_joinCondition: UILabel! - @IBOutlet weak var label_address: UILabel! - @IBOutlet weak var label_duetime: UILabel! - @IBOutlet weak var label_starttime: UILabel! - @IBOutlet weak var label_endtime: UILabel! - @IBOutlet weak var label_ageScope: UILabel! - @IBOutlet weak var label_city: UILabel! - @IBOutlet weak var label_money: UILabel! - @IBOutlet weak var label_totalMoney: UILabel! - @IBOutlet weak var label_introducion: UILabel! - @IBOutlet weak var img_enrollRequired: UIImageView! - @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! - @IBOutlet weak var btn_cancel: QMUIButton! - @IBOutlet weak var tableView: UITableView! - @IBOutlet weak var cons_tableHei: NSLayoutConstraint! - @IBOutlet weak var label_matchStore: UILabel! - @IBOutlet weak var btn_moreMatchStore: UIButton! - - var activityDetailModel:ActivityDetailModel?{ - didSet{ + private var id:Int! + @IBOutlet weak var view_banner: CommonBannerView! + // @IBOutlet weak var img_profile: UIImageView! + // @IBOutlet weak var label_storeNames: UILabel! + @IBOutlet weak var label_title: UILabel! + @IBOutlet weak var label_joinCondition: UILabel! + @IBOutlet weak var label_address: UILabel! + @IBOutlet weak var label_duetime: UILabel! + @IBOutlet weak var label_starttime: UILabel! + @IBOutlet weak var label_endtime: UILabel! + @IBOutlet weak var label_ageScope: UILabel! + @IBOutlet weak var label_city: UILabel! + @IBOutlet weak var label_money: UILabel! + @IBOutlet weak var label_totalMoney: UILabel! + @IBOutlet weak var label_introducion: UILabel! + @IBOutlet weak var img_enrollRequired: UIImageView! + @IBOutlet weak var cons_imgEnrollHei: NSLayoutConstraint! + @IBOutlet weak var btn_cancel: QMUIButton! + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var cons_tableHei: NSLayoutConstraint! + @IBOutlet weak var label_matchStore: UILabel! + @IBOutlet weak var btn_moreMatchStore: UIButton! - guard let m = activityDetailModel else {return} + var activityDetailModel:ActivityDetailModel?{ + didSet{ + + guard let m = activityDetailModel else {return} - let imgs = m.imgs.components(separatedBy: ",") - var items = [CommonBannerModel]() - for (index,img) in imgs.enumerated(){ - items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) - } - view_banner.setItems(items: items) + let imgs = m.imgs.components(separatedBy: ",") + var items = [CommonBannerModel]() + for (index,img) in imgs.enumerated(){ + items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) + } + view_banner.setItems(items: items) - label_title.text = m.name - label_joinCondition.text = m.registerCondition.strTitle + "参与" - label_address.text = m.address - label_duetime.text = m.registerEndTime - label_starttime.text = m.startTime - label_endtime.text = m.endTime - label_ageScope.text = m.age + "岁" - label_introducion.text = m.introduction - label_city.isHidden = m.province.isEmpty || m.city.isEmpty - label_city.text = m.province + "|" + m.city - label_matchStore.text = m.storeInfos.map({$0.name}).joined(separator: ",") - btn_moreMatchStore.isHidden = (label_matchStore.text?.count ?? 0) < 50 + label_title.text = m.name + label_joinCondition.text = m.registerCondition.strTitle + "参与" + label_address.text = m.address + label_duetime.text = m.registerEndTime + label_starttime.text = m.startTime + label_endtime.text = m.endTime + label_ageScope.text = m.age + "岁" + label_introducion.text = m.introduction + label_city.isHidden = m.province.isEmpty || m.city.isEmpty + label_city.text = m.province + "|" + m.city + label_matchStore.text = m.storeInfos.map({$0.name}).joined(separator: ",") + btn_moreMatchStore.isHidden = (label_matchStore.text?.count ?? 0) < 50 - img_enrollRequired.sd_setImage(with: URL(string: m.registrationNotes)) {[weak self] image, error, type, url in - guard let img = image else { - self?.cons_imgEnrollHei.constant = 0;return + img_enrollRequired.sd_setImage(with: URL(string: m.registrationNotes)) {[weak self] image, error, type, url in + guard let img = image else { + self?.cons_imgEnrollHei.constant = 0;return + } + + let radio = img.size.width / img.size.height + self?.cons_imgEnrollHei.constant = JQ_ScreenW / radio + } + + switch m.payType { + case .wechat,.aliPay: + label_money.text = String(format: "%@/人", m.cashPrice.currency()) + label_totalMoney.text = String(format: "合计:%@", (m.cashPrice * Double(m.participant.count)).currency()) + case .coin: + label_money.text = String(format: "%ld币/人", m.playPaiCoin) + label_totalMoney.text = String(format: "合计:%ld币", (m.playPaiCoin * m.participant.count)) + case .courseNum: + label_money.text = String(format: "%ld课时/人", m.classPrice) + label_totalMoney.text = String(format: "合计:%ld课时", (m.classPrice * m.participant.count)) + default: + label_money.text = "未知" + label_totalMoney.text = "未知" + } + + cons_tableHei.constant = Double(m.participant.count) * 100 + tableView.reloadData() + + switch m.status { + case .prepare: + let name = m.apply == 1 ? "取消":"已取消" + let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") + btn_cancel.isUserInteractionEnabled = m.apply == 1 + btn_cancel.setTitle(name, for: .normal) + btn_cancel.backgroundColor = color + + if m.apply == 1{ + btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) + } + + case .ongoing: + let endTime = Date.jq_StringToTimeInterval(m.registerEndTime, "yyyy-MM-dd HH:mm") + let a = Date.jq_CalByDays(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)) + if Date.jq_CalByEnum(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)).minute > 0{ + let name = m.apply == 1 ? "取消":"已取消" + let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") + btn_cancel.isUserInteractionEnabled = m.apply == 1 + btn_cancel.setTitle(name, for: .normal) + btn_cancel.backgroundColor = color + if m.apply == 1{ + btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) + } + }else{ + btn_cancel.setTitle("进行中", for: .normal) + btn_cancel.isUserInteractionEnabled = false + btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") + } + + case .over: + btn_cancel.setTitle("已结束", for: .normal) + btn_cancel.isUserInteractionEnabled = false + btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") + case .cancel: + btn_cancel.setTitle("已取消", for: .normal) + btn_cancel.isUserInteractionEnabled = false + btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") + default:break + } + } } - let radio = img.size.width / img.size.height - self?.cons_imgEnrollHei.constant = JQ_ScreenW / radio - } + required init(id: Int) { + super.init(nibName: nil, bundle: nil) + self.id = id + } - switch m.payType { - case .wechat,.aliPay: - label_money.text = String(format: "%@/人", m.cashPrice.currency()) - label_totalMoney.text = String(format: "合计:%@", (m.cashPrice * Double(m.participant.count)).currency()) - case .coin: - label_money.text = String(format: "%ld币/人", m.playPaiCoin) - label_totalMoney.text = String(format: "合计:%ld币", (m.playPaiCoin * m.participant.count)) - case .courseNum: - label_money.text = String(format: "%ld课时/人", m.classPrice) - label_totalMoney.text = String(format: "合计:%ld课时", (m.classPrice * m.participant.count)) - default: - label_money.text = "未知" - label_totalMoney.text = "未知" - } - - cons_tableHei.constant = Double(m.participant.count) * 100 - tableView.reloadData() - - switch m.status { - case .prepare: - let name = m.apply == 1 ? "取消":"已取消" - let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") - btn_cancel.isUserInteractionEnabled = m.apply == 1 - btn_cancel.setTitle(name, for: .normal) - btn_cancel.backgroundColor = color - - if m.apply == 1{ - btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) - } - - case .ongoing: - let endTime = Date.jq_StringToTimeInterval(m.registerEndTime, "yyyy-MM-dd HH:mm") - let a = Date.jq_CalByDays(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)) - if Date.jq_CalByEnum(startDate: Date(), endDate: Date(timeIntervalSince1970: endTime)).minute > 0{ - let name = m.apply == 1 ? "取消":"已取消" - let color = m.apply == 1 ? Def_ThemeColor:UIColor(hexStr: "#C0C0C0") - btn_cancel.isUserInteractionEnabled = m.apply == 1 - btn_cancel.setTitle(name, for: .normal) - btn_cancel.backgroundColor = color - if m.apply == 1{ - btn_cancel.setImage(UIImage(named: "btn_cancel"), for: .normal) - } - }else{ - btn_cancel.setTitle("进行中", for: .normal) - btn_cancel.isUserInteractionEnabled = false - btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") - } - - case .over: - btn_cancel.setTitle("已结束", for: .normal) - btn_cancel.isUserInteractionEnabled = false - btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") - case .cancel: - btn_cancel.setTitle("已取消", for: .normal) - btn_cancel.isUserInteractionEnabled = false - btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") - default:break - } - } - } - - required init(id: Int) { - super.init(nibName: nil, bundle: nil) - self.id = id - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - override func viewDidLoad() { - super.viewDidLoad() - title = "活动详情" + override func viewDidLoad() { + super.viewDidLoad() + title = "活动详情" - Services.queryMyCompetitionInfo(id: id).subscribe(onNext: {data in - self.activityDetailModel = data.data - }).disposed(by: disposeBag) - } + Services.queryMyCompetitionInfo(id: id).subscribe(onNext: {data in + self.activityDetailModel = data.data + }).disposed(by: disposeBag) + } - override func setUI() { - btn_cancel.imagePosition = .left - btn_cancel.spacingBetweenImageAndTitle = 12 - tableView.delegate = self - tableView.dataSource = self - tableView.separatorStyle = .none - tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") - let moreBtnAttributeding = AttributedStringbuilder.build().add(string: "查看更多", withFont: UIFont.systemFont(ofSize: 12, weight: .medium), withColor: Def_ThemeColor).underLine(color: Def_ThemeColor).mutableAttributedString - btn_moreMatchStore.setAttributedTitle(moreBtnAttributeding, for: .normal) - } + override func setUI() { + btn_cancel.imagePosition = .left + btn_cancel.spacingBetweenImageAndTitle = 12 + tableView.delegate = self + tableView.dataSource = self + tableView.separatorStyle = .none + tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") + let moreBtnAttributeding = AttributedStringbuilder.build().add(string: "查看更多", withFont: UIFont.systemFont(ofSize: 12, weight: .medium), withColor: Def_ThemeColor).underLine(color: Def_ThemeColor).mutableAttributedString + btn_moreMatchStore.setAttributedTitle(moreBtnAttributeding, for: .normal) + } - @IBAction func matchStoreAction(_ sender: UIButton) { - if let content = activityDetailModel?.storeInfos.map({$0.name}).joined(separator: ","){ - AgreentView.show(type: .matchStore, content: content) - } - } + @IBAction func matchStoreAction(_ sender: UIButton) { + if let content = activityDetailModel?.storeInfos.map({$0.name}).joined(separator: ","){ + AgreentView.show(type: .matchStore, content: content) + } + } - @IBAction func operationAction(_ sender: UIButton) { - CommonAlertView.show(title: "提示", content: "确认取消吗?取消后相关费用将会退还到原支付账户!") { [weak self]status in - guard let weakSelf = self else { return } - if status{ - Services.cancelMyCOmpetition(id: weakSelf.id).subscribe(onNext: { data in - alertSuccess(msg: "取消成功") - self?.btn_cancel.setTitle("已取消", for: .normal) - self?.btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") - NotificationCenter.default.post(name: CancelActivitySingup_Noti, object: nil) - NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) - }).disposed(by: weakSelf.disposeBag) - } - } - } + @IBAction func operationAction(_ sender: UIButton) { + CommonAlertView.show(title: "提示", content: "确认取消吗?取消后相关费用将会退还到原支付账户!") { [weak self]status in + guard let weakSelf = self else { return } + if status{ + Services.cancelMyCOmpetition(id: weakSelf.id).subscribe(onNext: { data in + alertSuccess(msg: "取消成功") + self?.btn_cancel.setTitle("已取消", for: .normal) + self?.btn_cancel.backgroundColor = UIColor(hexStr: "#C0C0C0") + NotificationCenter.default.post(name: CancelActivitySingup_Noti, object: nil) + NotificationCenter.default.post(name: StudentRefresh_Nofi, object: nil) + }).disposed(by: weakSelf.disposeBag) + } + } + } } @@ -191,20 +191,20 @@ } extension ActivitySignupDetailVC:UITableViewDataSource{ - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let student = activityDetailModel!.participant[indexPath.row] - let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_2_TCell") as! StudentInfo_2_TCell - cell.indexPath = indexPath - cell.activityDetailPartModel = student - cell.btn_edit.isHidden = true - cell.img_radio.isHidden = true - cell.btn_delete.isHidden = true + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let student = activityDetailModel!.participant[indexPath.row] + let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_2_TCell") as! StudentInfo_2_TCell + cell.indexPath = indexPath + cell.activityDetailPartModel = student + cell.btn_edit.isHidden = true + cell.img_radio.isHidden = true + cell.btn_delete.isHidden = true - return cell - } + return cell + } - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return activityDetailModel?.participant.count ?? 0 - } + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return activityDetailModel?.participant.count ?? 0 + } } diff --git a/WanPai/Root/Course/VC/AddStudentVC.swift b/WanPai/Root/Course/VC/AddStudentVC.swift index 0cc1470..b3a30c5 100644 --- a/WanPai/Root/Course/VC/AddStudentVC.swift +++ b/WanPai/Root/Course/VC/AddStudentVC.swift @@ -11,234 +11,235 @@ class AddStudentVC: BaseVC { - @IBOutlet weak var img_profile: UIImageView! - @IBOutlet weak var view_profile: UIView! - @IBOutlet weak var tf_name: QMUITextField! - @IBOutlet weak var tf_gender: UITextField! - @IBOutlet weak var tf_idCard: UITextField! - @IBOutlet weak var tf_height: QMUITextField! - @IBOutlet weak var view_height: UIView! - @IBOutlet weak var view_weight: UIView! - @IBOutlet weak var view_phone: UIView! - @IBOutlet weak var tf_weight: QMUITextField! - @IBOutlet weak var tf_phone: QMUITextField! - @IBOutlet weak var tf_birthday: UITextField! + @IBOutlet weak var img_profile: UIImageView! + @IBOutlet weak var view_profile: UIView! + @IBOutlet weak var tf_name: QMUITextField! + @IBOutlet weak var tf_gender: UITextField! + @IBOutlet weak var tf_idCard: UITextField! + @IBOutlet weak var tf_height: QMUITextField! + @IBOutlet weak var view_height: UIView! + @IBOutlet weak var view_weight: UIView! + @IBOutlet weak var view_phone: UIView! + @IBOutlet weak var tf_weight: QMUITextField! + @IBOutlet weak var tf_phone: QMUITextField! + @IBOutlet weak var tf_birthday: UITextField! - var profileImg:UIImage? + var profileImg:UIImage? - var studentModel = StudentProfileModel() - var studentInfo:StudentProfile1Model? - var activityDetailPartModel:ActivityDetailPartModel? - var type:ItemType! + var studentModel = StudentProfileModel() + var studentInfo:StudentProfile1Model? + var activityDetailPartModel:ActivityDetailPartModel? + var type:ItemType! - var verifyIdCard:Bool = false + var verifyIdCard:Bool = false - init(type:ItemType,studentInfo:StudentProfile1Model? = nil) { - super.init(nibName: nil, bundle: nil) - self.type = type - self.studentInfo = studentInfo - } + init(type:ItemType,studentInfo:StudentProfile1Model? = nil) { + super.init(nibName: nil, bundle: nil) + self.type = type + self.studentInfo = studentInfo + } - init(activityDetailPartModel:ActivityDetailPartModel? = nil) { - super.init(nibName: nil, bundle: nil) - self.type = .activity - self.activityDetailPartModel = activityDetailPartModel - } + init(activityDetailPartModel:ActivityDetailPartModel? = nil) { + super.init(nibName: nil, bundle: nil) + self.type = .activity + self.activityDetailPartModel = activityDetailPartModel + } - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - override func viewDidLoad() { - super.viewDidLoad() - if type == .course{ - title = "添加运动营成员" - view_profile.isHidden = false - if studentInfo != nil{ - title = "编辑运动营成员" - tf_name.placeholder = "请输入运动营成员姓名" - tf_height.placeholder = "请输入运动营成员身高" - tf_weight.placeholder = "请输入运动营成员体重" - tf_phone.placeholder = "请输入运动营成员联系方式" - tf_idCard.placeholder = "请输入运动营成员身份证号" - tf_name.text = studentInfo!.stuName - tf_idCard.text = studentInfo!.idCard - tf_height.text = String(format: "%.0lf", studentInfo!.stuHeight) - tf_weight.text = String(format: "%.0lf", studentInfo!.stuWeight) - tf_phone.text = studentInfo!.stuPhone - tf_birthday.text = studentInfo!.birthday - img_profile.sd_setImage(with: URL(string: studentInfo!.stuHeadImg)) - studentModel.headImg = studentInfo!.stuHeadImg - studentModel.stuId = studentInfo!.stuId - tf_gender.text = studentModel.sex == .man ? "男":"女" - } - }else{ - view_profile.isHidden = true - title = "添加人员" - tf_name.placeholder = "请输入人员姓名" - tf_height.placeholder = "请输入身高" - tf_weight.placeholder = "请输入体重" - tf_phone.placeholder = "请输入联系方式" - tf_idCard.placeholder = "请输入身份证号" - if let m = activityDetailPartModel{ - title = "编辑人员" - tf_name.text = m.name - tf_idCard.text = m.idcard - tf_height.text = String(format: "%.0lf", m.height) - tf_weight.text = String(format: "%.0lf", m.weight) - tf_phone.text = m.phone - tf_birthday.text = m.birthday - tf_gender.text = m.gender == .man ? "男":"女" - view_height.isHidden = true - view_weight.isHidden = true - view_phone.isHidden = true + override func viewDidLoad() { + super.viewDidLoad() + if type == .course{ + title = "添加运动营成员" + view_profile.isHidden = false + if studentInfo != nil{ + title = "编辑运动营成员" + tf_name.placeholder = "请输入运动营成员姓名" + tf_height.placeholder = "请输入运动营成员身高" + tf_weight.placeholder = "请输入运动营成员体重" + tf_phone.placeholder = "请输入运动营成员联系方式" + tf_idCard.placeholder = "请输入运动营成员身份证号" + tf_name.text = studentInfo!.stuName + tf_idCard.text = studentInfo!.idCard + tf_height.text = String(format: "%.0lf", studentInfo!.stuHeight) + tf_weight.text = String(format: "%.0lf", studentInfo!.stuWeight) + tf_phone.text = studentInfo!.stuPhone + tf_birthday.text = studentInfo!.birthday + img_profile.sd_setImage(with: URL(string: studentInfo!.stuHeadImg)) + studentModel.headImg = studentInfo!.stuHeadImg + studentModel.stuId = studentInfo!.stuId + tf_gender.text = studentModel.sex == .man ? "男":"女" + } + }else{ + view_profile.isHidden = true + title = "添加人员" + tf_name.placeholder = "请输入人员姓名" + tf_height.placeholder = "请输入身高" + tf_weight.placeholder = "请输入体重" + tf_phone.placeholder = "请输入联系方式" + tf_idCard.placeholder = "请输入身份证号" + if let m = activityDetailPartModel{ + title = "编辑人员" + tf_name.text = m.name + tf_idCard.text = m.idcard + tf_height.text = String(format: "%.0lf", m.height) + tf_weight.text = String(format: "%.0lf", m.weight) + tf_phone.text = m.phone + tf_birthday.text = m.birthday + tf_gender.text = m.gender == .man ? "男":"女" + view_height.isHidden = true + view_weight.isHidden = true + view_phone.isHidden = true - tf_name.isEnabled = false - tf_birthday.isEnabled = false - tf_gender.isEnabled = false - } - } + tf_name.isEnabled = false + tf_birthday.isEnabled = false + tf_gender.isEnabled = false + } + } - let idCardView = IDCardView() - idCardView.box.bind { [weak self] text in - self?.tf_idCard.text = text - } - tf_idCard.inputView = idCardView + let idCardView = IDCardView() + idCardView.box.bind { [weak self] text in + self?.tf_idCard.text = text + } + tf_idCard.inputView = idCardView - let tap = UITapGestureRecognizer(target: self, action: #selector(userImgUploadAction)) - img_profile.isUserInteractionEnabled = true - img_profile.addGestureRecognizer(tap) - } + let tap = UITapGestureRecognizer(target: self, action: #selector(userImgUploadAction)) + img_profile.isUserInteractionEnabled = true + img_profile.addGestureRecognizer(tap) + } - override func setUI() { - tf_birthday.delegate = self - tf_gender.delegate = self - } + override func setUI() { + tf_birthday.delegate = self + tf_gender.delegate = self + } - @objc func userImgUploadAction(){ - JQ_ImagePickerTool.getSharedInstance().singleImage({ [weak self] image in - self?.img_profile.image = image - self?.profileImg = image - }, clipSize: CGSize(width: JQ_ScreenW, height: JQ_ScreenW)) - } + @objc func userImgUploadAction(){ + JQ_ImagePickerTool.getSharedInstance().singleImage({ [weak self] image in + self?.img_profile.image = image + self?.profileImg = image + }, clipSize: CGSize(width: JQ_ScreenW, height: JQ_ScreenW)) + } - @IBAction func completeAction(_ sender: UIButton) { - if studentInfo == nil && type == .course{ - guard profileImg != nil else {alertError(msg: "请上传运动营成员头像");return} - } + @IBAction func completeAction(_ sender: UIButton) { + if studentInfo == nil && type == .course{ + guard profileImg != nil else {alertError(msg: "请上传运动营成员头像");return} + } - guard !tf_name.text!.isEmpty else {alertError(msg: tf_name.placeholder!);return} - guard !tf_birthday.text!.isEmpty else {alertError(msg: "请选择生日");return} - guard !tf_gender.text!.isEmpty else {alertError(msg: "请选择性别");return} + guard !tf_name.text!.isEmpty else {alertError(msg: tf_name.placeholder!);return} + guard !tf_birthday.text!.isEmpty else {alertError(msg: "请选择生日");return} + guard !tf_gender.text!.isEmpty else {alertError(msg: "请选择性别");return} - if type == .course{ - guard !tf_height.text!.isEmpty else {alertError(msg: tf_height.placeholder!);return} - guard !tf_weight.text!.isEmpty else {alertError(msg: tf_weight.placeholder!);return} - guard tf_height.text != "0" else {alertError(msg: "请输入正确的身高");return} - guard tf_weight.text != "0" else {alertError(msg: "请输入正确的体重");return} - } + if type == .course{ + guard !tf_height.text!.isEmpty else {alertError(msg: tf_height.placeholder!);return} + guard !tf_weight.text!.isEmpty else {alertError(msg: tf_weight.placeholder!);return} + guard tf_height.text != "0" else {alertError(msg: "请输入正确的身高");return} + guard tf_weight.text != "0" else {alertError(msg: "请输入正确的体重");return} + } - if !tf_phone.isEmpty{ - guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} - } - - if !tf_idCard.isEmpty || activityDetailPartModel != nil{ - guard tf_idCard.text!.jq_idCard() else {alertError(msg: "请输入正确的身份证号码");return} - } + if !tf_phone.isEmpty{ + guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return} + } - studentModel.birthday = tf_birthday.text! - studentModel.name = tf_name.text! - studentModel.height = tf_height.text!.toDouble - studentModel.weight = tf_weight.text!.toDouble - studentModel.phone = tf_phone.text! - studentModel.idCard = tf_idCard.text! - studentModel.name = tf_name.text! +// if !tf_idCard.isEmpty || activityDetailPartModel != nil{ +// +// } + guard tf_idCard.text!.jq_idCard() else {alertError(msg: "请输入正确的身份证号码");return} - if profileImg != nil{ - showHUD("正在上传头像") - profileImg!.uploadImgToService().subscribe(onNext: { [weak self] imgUrl in - guard let weakSelf = self else { return } - weakSelf.studentModel.headImg = imgUrl - hiddenHUD() - weakSelf.addStudent() - }, onError: { error in - hiddenHUD() - alertError(msg: error.localizedDescription) - }).disposed(by: disposeBag) - }else{ - addStudent() - } - } + studentModel.birthday = tf_birthday.text! + studentModel.name = tf_name.text! + studentModel.height = tf_height.text!.toDouble + studentModel.weight = tf_weight.text!.toDouble + studentModel.phone = tf_phone.text! + studentModel.idCard = tf_idCard.text! + studentModel.name = tf_name.text! - private func addStudent(){ - if type == .course{ - if studentInfo == nil{ - Services.addStudent(studentModel).subscribe(onNext: { [weak self] data in - self?.addStudentSuccess(text: "编辑成功") - }).disposed(by: disposeBag) - }else{ - Services.editStu(studentModel).subscribe(onNext: {[weak self]data in - self?.addStudentSuccess(text: "添加成功") - NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil) - }) { error in + if profileImg != nil{ + showHUD("正在上传头像") + profileImg!.uploadImgToService().subscribe(onNext: { [weak self] imgUrl in + guard let weakSelf = self else { return } + weakSelf.studentModel.headImg = imgUrl + hiddenHUD() + weakSelf.addStudent() + }, onError: { error in + hiddenHUD() + alertError(msg: error.localizedDescription) + }).disposed(by: disposeBag) + }else{ + addStudent() + } + } - }.disposed(by: disposeBag) - } - }else{ - if activityDetailPartModel != nil{ - activityDetailPartModel!.idcard = tf_idCard.text! - Services.editParticipant(activityDetailPartModel!).subscribe(onNext: {[weak self] data in - self?.addStudentSuccess(text: "编辑成功") - }).disposed(by: disposeBag) + private func addStudent(){ + if type == .course{ + if studentInfo == nil{ + Services.addStudent(studentModel).subscribe(onNext: { [weak self] data in + self?.addStudentSuccess(text: "编辑成功") + }).disposed(by: disposeBag) + }else{ + Services.editStu(studentModel).subscribe(onNext: {[weak self]data in + self?.addStudentSuccess(text: "添加成功") + NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil) + }) { error in - }else{ - Services.addParticipant(studentModel).subscribe(onNext: {[weak self] data in - self?.addStudentSuccess(text: "添加成功") - }).disposed(by: disposeBag) - } - } - } + }.disposed(by: disposeBag) + } + }else{ + if activityDetailPartModel != nil{ + activityDetailPartModel!.idcard = tf_idCard.text! + Services.editParticipant(activityDetailPartModel!).subscribe(onNext: {[weak self] data in + self?.addStudentSuccess(text: "编辑成功") + }).disposed(by: disposeBag) - private func addStudentSuccess(text:String){ - alertSuccess(msg: text) - DispatchQueue.main.asyncAfter(deadline: .now()+1) { - self.navigationController?.popViewController() - NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil) - } - } + }else{ + Services.addParticipant(studentModel).subscribe(onNext: {[weak self] data in + self?.addStudentSuccess(text: "添加成功") + }).disposed(by: disposeBag) + } + } + } - deinit{ - JQ_ImagePickerTool.destroy() - } + private func addStudentSuccess(text:String){ + alertSuccess(msg: text) + DispatchQueue.main.asyncAfter(deadline: .now()+1) { + self.navigationController?.popViewController() + NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil) + } + } + + deinit{ + JQ_ImagePickerTool.destroy() + } } extension AddStudentVC:UITextFieldDelegate{ - func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { - if textField == tf_birthday{ - view.endEditing(true) - CommonDatePickerView.show(before: 60, after: 0, type: .YMD) { year, month, day,_,_ in - textField.text = String(format: "%ld-%02ld-%02ld", year!,month!,day!) - } - return false - } + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { + if textField == tf_birthday{ + view.endEditing(true) + CommonDatePickerView.show(before: 60, after: 0, type: .YMD) { year, month, day,_,_ in + textField.text = String(format: "%ld-%02ld-%02ld", year!,month!,day!) + } + return false + } - if textField == tf_gender{ + if textField == tf_gender{ - let alertVC = UIAlertController(title: "性别", message: nil, preferredStyle: .actionSheet) - alertVC.addAction(UIAlertAction(title: "男", style: .default) { _ in - self.tf_gender.text = "男" - }) + let alertVC = UIAlertController(title: "性别", message: nil, preferredStyle: .actionSheet) + alertVC.addAction(UIAlertAction(title: "男", style: .default) { _ in + self.tf_gender.text = "男" + }) - alertVC.addAction(UIAlertAction(title: "女", style: .default) { _ in - self.tf_gender.text = "女" - }) + alertVC.addAction(UIAlertAction(title: "女", style: .default) { _ in + self.tf_gender.text = "女" + }) - alertVC.addAction(UIAlertAction(title: "取消", style: .cancel)) - present(alertVC, animated: true) - return false - } - return true - } + alertVC.addAction(UIAlertAction(title: "取消", style: .cancel)) + present(alertVC, animated: true) + return false + } + return true + } } - + diff --git a/WanPai/Root/Course/VC/AddStudentVC.xib b/WanPai/Root/Course/VC/AddStudentVC.xib index a5ab017..a06900f 100644 --- a/WanPai/Root/Course/VC/AddStudentVC.xib +++ b/WanPai/Root/Course/VC/AddStudentVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22131"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <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"/> @@ -357,11 +357,14 @@ </constraints> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="身份证号" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JjF-jS-GPH"> - <rect key="frame" x="14.000000000000004" y="16.666666666666629" width="57.333333333333343" height="17"/> + <rect key="frame" x="30.000000000000004" y="16.666666666666629" width="57.333333333333343" height="17"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_item_p" translatesAutoresizingMaskIntoConstraints="NO" id="Udv-bd-yGQ"> + <rect key="frame" x="15" y="19" width="12" height="12"/> + </imageView> <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入运动营成员身份证号" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LD0-ej-DmH"> <rect key="frame" x="120" y="0.0" width="233" height="49.666666666666664"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> @@ -374,11 +377,13 @@ <constraint firstItem="LD0-ej-DmH" firstAttribute="top" secondItem="eXg-lM-iFa" secondAttribute="top" id="2K7-zV-OyA"/> <constraint firstAttribute="bottom" secondItem="NlW-dD-gIp" secondAttribute="bottom" id="9Mu-Gg-yex"/> <constraint firstItem="LD0-ej-DmH" firstAttribute="leading" secondItem="eXg-lM-iFa" secondAttribute="leading" constant="120" id="9U6-rD-Jfd"/> - <constraint firstItem="JjF-jS-GPH" firstAttribute="leading" secondItem="eXg-lM-iFa" secondAttribute="leading" constant="14" id="IKT-yR-MXN"/> + <constraint firstItem="JjF-jS-GPH" firstAttribute="centerY" secondItem="Udv-bd-yGQ" secondAttribute="centerY" id="9u5-dT-w12"/> + <constraint firstItem="JjF-jS-GPH" firstAttribute="leading" secondItem="Udv-bd-yGQ" secondAttribute="trailing" constant="3" id="D3m-eN-BHV"/> <constraint firstItem="NlW-dD-gIp" firstAttribute="leading" secondItem="eXg-lM-iFa" secondAttribute="leading" constant="14" id="Qir-9y-1mQ"/> <constraint firstAttribute="trailing" secondItem="NlW-dD-gIp" secondAttribute="trailing" constant="14" id="jSc-75-egP"/> <constraint firstItem="NlW-dD-gIp" firstAttribute="top" secondItem="LD0-ej-DmH" secondAttribute="bottom" id="mxF-BK-Axi"/> <constraint firstAttribute="height" constant="50" id="ngz-MT-wKh"/> + <constraint firstItem="Udv-bd-yGQ" firstAttribute="leading" secondItem="eXg-lM-iFa" secondAttribute="leading" constant="15" id="vAa-A7-sCK"/> <constraint firstItem="JjF-jS-GPH" firstAttribute="centerY" secondItem="eXg-lM-iFa" secondAttribute="centerY" id="xph-Ep-7kc"/> </constraints> </view> diff --git a/WanPai/Root/Home/Model/HomeModel.swift b/WanPai/Root/Home/Model/HomeModel.swift index 840f018..d715555 100644 --- a/WanPai/Root/Home/Model/HomeModel.swift +++ b/WanPai/Root/Home/Model/HomeModel.swift @@ -30,6 +30,7 @@ var sort:Int = 0 var backgroundImage:String = "" var cellHeight:Double = 270 + var id = 0 } class HomeStoreTopBannerModel:HandyJSON{ diff --git a/WanPai/Root/Home/Model/WorldCupModel.swift b/WanPai/Root/Home/Model/WorldCupModel.swift index d25c6a5..a3e4fee 100644 --- a/WanPai/Root/Home/Model/WorldCupModel.swift +++ b/WanPai/Root/Home/Model/WorldCupModel.swift @@ -26,7 +26,7 @@ struct WorldCupDetailModel:HandyJSON{ var address: String = "" var age: String = "" - var cash: Int = 0 + var cash: Double = 0 var classHour: Int = 0 var content: String = "" var endTime: String = "" @@ -50,6 +50,11 @@ } +struct WorldCupDetailBannerModel:HandyJSON{ + var name = "" + var url = "" +} + struct WorldCupJudgeModel:HandyJSON{ var activeTime: String = "" var id: Int = 0 diff --git a/WanPai/Root/Home/VC/HomeVC.swift b/WanPai/Root/Home/VC/HomeVC.swift index 913dd6e..1df2680 100644 --- a/WanPai/Root/Home/VC/HomeVC.swift +++ b/WanPai/Root/Home/VC/HomeVC.swift @@ -134,6 +134,13 @@ guard SDImageCache.shared.diskImageDataExists(withKey: m.backgroundImage) else { SDWebImageDownloader.shared.downloadImage(with: URL(string: m.backgroundImage), options: .useNSURLCache) { _, _,_ in } completed: { image, data, error, status in + + guard m.backgroundImage.isEmpty else { + m.cellHeight = 100 + group.leave() + return + } + if let img = image{ m.cellHeight = w / (img.size.width / img.size.height) }else{ @@ -158,6 +165,8 @@ } completed: { image, data, error, status in if let img = image{ m.cellHeight = w / (img.size.width / img.size.height) + }else{ + m.cellHeight = 100 } group.leave() } @@ -315,6 +324,9 @@ case .worldcup: let vc = WorldCupIntroVC() push(vc: vc) + case .worldcupDetail: + let vc = WorldCupContentApplyVC(id: m.id) + push(vc: vc) case .course: let vc = CourseListVC(selectStore: simpleModel) push(vc: vc) diff --git a/WanPai/Root/Home/VC/HomeVC.xib b/WanPai/Root/Home/VC/HomeVC.xib index f3e4b19..cb9eb99 100644 --- a/WanPai/Root/Home/VC/HomeVC.xib +++ b/WanPai/Root/Home/VC/HomeVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" 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="22131"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/> <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"/> @@ -151,7 +151,7 @@ <constraint firstItem="pid-yy-hW2" firstAttribute="leading" secondItem="WGQ-UH-Uvg" secondAttribute="leading" id="y7p-rN-LaS"/> </constraints> </view> - <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="ysy-N3-BCh" customClass="BaseCollectionView" customModule="WanPai" customModuleProvider="target"> + <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="ysy-N3-BCh" customClass="BaseCollectionView" customModule="WanPai" customModuleProvider="target"> <rect key="frame" x="0.0" y="290.33333333333331" width="393" height="527.66666666666674"/> <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="Hvc-jj-SAe"> <size key="itemSize" width="128" height="128"/> diff --git a/WanPai/Root/Home/VC/WorldCupListVC.swift b/WanPai/Root/Home/VC/WorldCupListVC.swift index 28cda9f..5e3b6c6 100644 --- a/WanPai/Root/Home/VC/WorldCupListVC.swift +++ b/WanPai/Root/Home/VC/WorldCupListVC.swift @@ -20,7 +20,15 @@ override func api() -> (Observable<BaseResponse<[WorldCupListModel]>>)? { let deserModel = HomeStoreModel.deserialize(from: UserDefaults.standard.object(forKey: "CurrentStore") as? String) - return Services.worldCupList(id: deserModel!.storeId, content: search.value, gender: gender.value.id, sort: sort.value, storeId: storeId.value?.id) + + var genderID:Int? + if gender.value.id == 0{ + genderID = nil + }else{ + genderID = gender.value.id + } + + return Services.worldCupList(id: deserModel!.storeId, content: search.value, gender:genderID, sort: sort.value, storeId: storeId.value?.id) } } diff --git a/WanPai/Root/Home/VC/WorldCupListVC.xib b/WanPai/Root/Home/VC/WorldCupListVC.xib index 60a2364..2cc3ce4 100644 --- a/WanPai/Root/Home/VC/WorldCupListVC.xib +++ b/WanPai/Root/Home/VC/WorldCupListVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22504"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <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"/> @@ -69,6 +69,9 @@ <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Z7Q-0r-hlk" customClass="QMUIButton"> <rect key="frame" x="0.0" y="0.0" width="79" height="52"/> + <constraints> + <constraint firstAttribute="width" relation="lessThanOrEqual" constant="120" id="ycg-Nq-H9l"/> + </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="举办城市" image="icon_down_arrow"> @@ -80,6 +83,9 @@ </button> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8O9-Hj-qgP" customClass="QMUIButton"> <rect key="frame" x="113" y="0.0" width="79" height="52"/> + <constraints> + <constraint firstAttribute="width" relation="lessThanOrEqual" constant="120" id="ERe-vA-51w"/> + </constraints> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="16"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" title="报名条件" image="icon_down_arrow"> diff --git a/WanPai/Root/Other/View/StudentChoose2View.swift b/WanPai/Root/Other/View/StudentChoose2View.swift index 898fb28..72d0b75 100644 --- a/WanPai/Root/Other/View/StudentChoose2View.swift +++ b/WanPai/Root/Other/View/StudentChoose2View.swift @@ -98,7 +98,10 @@ } @IBAction func completeAction(_ sender: UIButton) { - // clickClouse!(selectStudents) + guard selectStudents != nil else { + alert(msg: "请选择" );return + } + clickClouse!(selectStudents!) closeAction() } } @@ -118,8 +121,13 @@ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_2_TCell") as! StudentInfo_2_TCell + cell.indexPath = indexPath + cell.activityDetailPartModel = viewModel.dataSource.value[indexPath.row] + cell.img_radio.isHidden = false cell.btn_delete.isHidden = true cell.btn_edit.isHidden = true + + cell.img_radio.image = UIImage(named: selectStudents?.id == viewModel.dataSource.value[indexPath.row].id ? "btn_select" : "btn_select_u") return cell } } diff --git a/WanPai/Root/Search/TCell/JudgeTCell.swift b/WanPai/Root/Search/TCell/JudgeTCell.swift index a663ee1..1d952a0 100644 --- a/WanPai/Root/Search/TCell/JudgeTCell.swift +++ b/WanPai/Root/Search/TCell/JudgeTCell.swift @@ -25,7 +25,7 @@ label_state.text = model.status.rawTitle label_time.text = "活动时间:\(model.activeTime)" label_times.text = "已比赛场次数:\(model.matchNumber)" - btn_begin.isHidden = model.status == .cancel || model.status == .ongoing + btn_begin.isHidden = model.status != .ongoing } } diff --git a/WanPai/Root/Search/TCell/WorldCupRankTCell.swift b/WanPai/Root/Search/TCell/WorldCupRankTCell.swift index 36cb531..9b592f3 100644 --- a/WanPai/Root/Search/TCell/WorldCupRankTCell.swift +++ b/WanPai/Root/Search/TCell/WorldCupRankTCell.swift @@ -16,6 +16,28 @@ private var userNameLabel:UILabel! private var numerLabel:UILabel! private var radioLabel:UILabel! + var indexPath:IndexPath! + + var model:WorldCupMatchRankModel?{ + didSet{ + if let m = model{ + userNameLabel.text = m.name + userImg.sd_setImage(with: URL(string: m.avatar)) + numerLabel.text = "\(m.totalSession)" + radioLabel.text = "\(m.winRate)%" + + rankImg.image = UIImage(named: "rank_\(indexPath.row + 1)") + switch indexPath.row{ + case 0...2: + rankImg.isHidden = false + rankLabel.text = "" + default: + rankImg.isHidden = true + rankLabel.text = "\(indexPath.row + 1)" + } + } + } + } override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: .default, reuseIdentifier: reuseIdentifier) @@ -31,7 +53,7 @@ selectionStyle = .none - rankImg = UIImageView(image: UIImage(named: "rank_1")) + rankImg = UIImageView() contentView.addSubview(rankImg) rankImg.snp.makeConstraints { make in make.left.equalTo(15) @@ -61,7 +83,7 @@ } userNameLabel = UILabel() - userNameLabel.text = "wang" + userNameLabel.text = "" userNameLabel.font = UIFont.systemFont(ofSize: 14, weight: .medium) userNameLabel.textColor = .black contentView.addSubview(userNameLabel) diff --git a/WanPai/Root/Search/VC/JudgeListVC.swift b/WanPai/Root/Search/VC/JudgeListVC.swift index 193cb11..d634117 100644 --- a/WanPai/Root/Search/VC/JudgeListVC.swift +++ b/WanPai/Root/Search/VC/JudgeListVC.swift @@ -19,7 +19,6 @@ override func api() -> (Observable<BaseResponse<[WorldCupJudgeModel]>>)? { return Services.worldCupJudgeList(content: content.value, storeId: storeId.value?.id) } - } class JudgeListVC: BaseVC { diff --git a/WanPai/Root/Search/VC/MatchDetailVC.swift b/WanPai/Root/Search/VC/MatchDetailVC.swift index 0f6ffaf..f055fa6 100644 --- a/WanPai/Root/Search/VC/MatchDetailVC.swift +++ b/WanPai/Root/Search/VC/MatchDetailVC.swift @@ -12,13 +12,19 @@ class MatchDetailVC: BaseVC { @IBOutlet weak var view_red1: UIView! + @IBOutlet weak var view_red1Img: UIImageView! @IBOutlet weak var view_red2: UIView! + @IBOutlet weak var view_red2Img: UIImageView! @IBOutlet weak var view_red3: UIView! + @IBOutlet weak var view_red3Img: UIImageView! @IBOutlet weak var view_blue1: UIView! + @IBOutlet weak var view_blue1Img: UIImageView! @IBOutlet weak var view_blue2: UIView! + @IBOutlet weak var view_blue2Img: UIImageView! @IBOutlet weak var view_blue3: UIView! - + @IBOutlet weak var view_blue3Img: UIImageView! + @IBOutlet weak var view_device: UIView! @IBOutlet weak var label_deviceTitle: UILabel! @IBOutlet weak var label_matchPoint: UILabel! @@ -115,38 +121,80 @@ @IBAction func deleRedUserAction(_ sender: UIButton) { let index = sender.tag - 10 - redTeamItems.remove(at: index) - redStackView.arrangedSubviews[index].isHidden = true + + if index > redTeamItems.count{ + redTeamItems.removeLast() + }else{ + redTeamItems.remove(at: index) + } + if index == 0{ + view_red1.isHidden = true + } + if index == 1{ + view_red2.isHidden = true + } + if index == 2{ + view_red3.isHidden = true + } + } @IBAction func deleBlueUserAction(_ sender: UIButton) { - let index = sender.tag - 10 - blueTeamItems.remove(at: index) - blueStackView.arrangedSubviews[index].isHidden = true + let index = sender.tag - 20 + if index > blueTeamItems.count{ + blueTeamItems.removeLast() + }else{ + blueTeamItems.remove(at: index) + } + if index == 0{ + view_blue1.isHidden = true + } + if index == 1{ + view_blue2.isHidden = true + } + if index == 2{ + view_blue3.isHidden = true + } } private func updateUserView(){ - for item in redTeamItems { - for subView in redStackView.arrangedSubviews{ - if subView.isHidden{ - if let img = subView.subviews.first as? UIImageView{ - img.sd_setImage(with: URL(string: item.avatar)) - subView.isHidden = false - break - } - } + + view_red1.isHidden = true + view_red2.isHidden = true + view_red3.isHidden = true + view_blue1.isHidden = true + view_blue2.isHidden = true + view_blue3.isHidden = true + + for (index,item) in redTeamItems.enumerated() { + if index == 0{ + view_red1.isHidden = false + view_red1Img.sd_setImage(with: URL(string: item.avatar)) + } + if index == 1{ + view_red2.isHidden = false + view_red2Img.sd_setImage(with: URL(string: item.avatar)) + } + + if index == 2{ + view_red3.isHidden = false + view_red3Img.sd_setImage(with: URL(string: item.avatar)) } } - for item in blueTeamItems { - for subView in blueStackView.arrangedSubviews{ - if subView.isHidden{ - if let img = subView.subviews.first as? UIImageView{ - img.sd_setImage(with: URL(string: item.avatar)) - subView.isHidden = false - break - } - } + for (index,item) in blueTeamItems.enumerated() { + if index == 0{ + view_blue1.isHidden = false + view_blue1Img.sd_setImage(with: URL(string: item.avatar)) + } + if index == 1{ + view_blue2.isHidden = false + view_blue2Img.sd_setImage(with: URL(string: item.avatar)) + } + + if index == 2{ + view_blue3.isHidden = false + view_blue3Img.sd_setImage(with: URL(string: item.avatar)) } } } @@ -170,10 +218,8 @@ @IBAction func handleAction(_ sender: UIButton) { if sender.isSelected{ - #if !DEBUG guard redTeamItems.count == 3 else{alert(msg: "红队人数不足");return} guard blueTeamItems.count == 3 else{alert(msg: "蓝队人数不足");return} - #endif guard let devCode = deviceQRCode else{alert(msg: "请扫描设备二维码");return} struct TempModel:HandyJSON{ diff --git a/WanPai/Root/Search/VC/MatchDetailVC.xib b/WanPai/Root/Search/VC/MatchDetailVC.xib index 132d990..1dce7c5 100644 --- a/WanPai/Root/Search/VC/MatchDetailVC.xib +++ b/WanPai/Root/Search/VC/MatchDetailVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22504"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> @@ -19,12 +19,18 @@ <outlet property="redStackView" destination="IM3-iJ-n3i" id="rMz-jS-Vq6"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view_blue1" destination="NC1-mI-zKx" id="tlf-qa-Zta"/> + <outlet property="view_blue1Img" destination="kwN-sM-5Jp" id="963-M8-A7H"/> <outlet property="view_blue2" destination="MAY-fE-XVW" id="zXt-hK-2nw"/> + <outlet property="view_blue2Img" destination="4Ro-YL-VwE" id="I9u-ba-DRO"/> <outlet property="view_blue3" destination="Pv2-U4-eh9" id="8Aa-BL-tOr"/> + <outlet property="view_blue3Img" destination="bcy-TN-a7B" id="uG4-ip-AIs"/> <outlet property="view_device" destination="t22-L5-pNm" id="pM5-Hn-UwJ"/> <outlet property="view_red1" destination="WaE-Ya-Qah" id="PZx-EF-S91"/> + <outlet property="view_red1Img" destination="WBK-jh-hgX" id="LMQ-F9-sL9"/> <outlet property="view_red2" destination="DL1-JD-042" id="u4s-RH-wK5"/> + <outlet property="view_red2Img" destination="pDI-vT-Fpd" id="Pf2-kf-y1O"/> <outlet property="view_red3" destination="yx0-w9-Zk2" id="PNW-Kh-vZM"/> + <outlet property="view_red3Img" destination="Duc-CA-hkw" id="6Zs-qv-zxe"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> diff --git a/WanPai/Root/Search/VC/SearchVC.swift b/WanPai/Root/Search/VC/SearchVC.swift index c1a71bf..982a548 100644 --- a/WanPai/Root/Search/VC/SearchVC.swift +++ b/WanPai/Root/Search/VC/SearchVC.swift @@ -76,11 +76,6 @@ self?.items.append("裁判入口") self?.func_collectionView.reloadData() } - - #if DEBUG - self?.items.append("裁判入口") - self?.func_collectionView.reloadData() - #endif } }) { error in @@ -131,7 +126,7 @@ } override var preferredStatusBarStyle: UIStatusBarStyle{ - return .darkContent + return .lightContent } } @@ -238,3 +233,4 @@ return CGSize(width: JQ_ScreenW, height: JQ_ScreenW * 0.6541) } } + diff --git a/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.swift b/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.swift index 3209e60..2196c5e 100644 --- a/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.swift +++ b/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.swift @@ -36,6 +36,7 @@ @IBOutlet weak var btn_agreement: UIButton! @IBOutlet weak var cons_tableHei: NSLayoutConstraint! @IBOutlet weak var btn_addStudent: QMUIButton! + @IBOutlet weak var btn_enroll: UIButton! @@ -63,37 +64,45 @@ tableView.register(UINib(nibName: "StudentInfo_2_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_2_TCell") } - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidLoad() { + super.viewDidLoad() title = "社区世界杯" let imgs = detailModel.infoImg.components(separatedBy: ",") - var items = [CommonBannerModel]() - for (index,img) in imgs.enumerated(){ - items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) - } - bannerView.setItems(items: items) + var items = [CommonBannerModel]() + for (index,img) in imgs.enumerated(){ + items.append(CommonBannerModel(index: index,resource: img,mediaType: .imageUrl)) + } + bannerView.setItems(items: items) - btn_moreStore.isHidden = detailModel.storeInfos.count > 1 + let endDateTimeInterval = Date.jq_StringToTimeInterval(detailModel.registrationClosingTime, "yyyy-MM-dd HH:mm") + if endDateTimeInterval < Date().timeIntervalSince1970{ + btn_enroll.setTitle("报名已截止", for: .normal) + btn_enroll.backgroundColor = .gray.withAlphaComponent(0.5) + } - label_title.text = detailModel.name - label_hot.text = "\(detailModel.heat)" - label_duetime.text = detailModel.registrationClosingTime - label_starttime.text = detailModel.startTime - label_endtime.text = detailModel.endTime - label_ageScope.text = detailModel.age + "岁" - switch detailModel.gender{ - case 1:label_genderCond.text = "男" - case 2:label_genderCond.text = "女" - default:label_genderCond.text = "全部" - } - label_city.text = "" - label_address.text = detailModel.address - label_matchPoint.text = detailModel.storeInfos.map({$0.name}).joined(separator: "、") - label_pay_money.text = "¥\(detailModel.cash)/人" - label_pay_coin.text = "\(detailModel.paiCoin)币/人" - label_pay_course.text = "\(detailModel.classHour)课时/人" - } + btn_moreStore.isHidden = detailModel.storeInfos.count == 1 + + label_title.text = detailModel.name + label_hot.text = "\(detailModel.heat)" + label_duetime.text = detailModel.registrationClosingTime + label_starttime.text = detailModel.startTime + label_endtime.text = detailModel.endTime + label_ageScope.text = detailModel.age + "岁" + switch detailModel.gender{ + case 1:label_genderCond.text = "男" + case 2:label_genderCond.text = "女" + default:label_genderCond.text = "全部" + } + label_city.text = "" + label_address.text = detailModel.address + label_matchPoint.text = detailModel.storeInfos.map({$0.name}).joined(separator: "、") + + label_pay_money.text = detailModel.cash == 0 ? "免费":"¥\(detailModel.cash)/人" + label_pay_coin.text = detailModel.paiCoin == 0 ? "免费":"\(detailModel.paiCoin)币/人" + label_pay_course.text = detailModel.classHour == 0 ? "免费":"\(detailModel.classHour)课时/人" + + } override func setRx() { tableView.rx.observe(CGSize.self, "contentSize").subscribe(onNext: {[weak self] size in @@ -122,7 +131,7 @@ sender.isSelected = !sender.isSelected } - + @IBAction func webAction(_ sender: Any) { let webVC = CommonWebVC(type: .matchStore,customTitle: "社区世界杯报名协议") push(vc: webVC) @@ -147,71 +156,67 @@ for v in weakSelf.students{ result.append(["id":v.id,"isStudent":v.isStudent]) } - Services.worldCupPaymentCheck(id: weakSelf.detailModel.id, ids: result.jq_toJson1(), uid: nil).subscribe(onNext: {data in - if let model = data.data{ - var money:Double? - var paiCoin:Int? - var classHour:Int? + var money:Double = 0 + var paiCoin:Int = 0 + var classHour:Int = 0 - money = weakSelf.detailModel.cash.double + money = weakSelf.detailModel.cash + paiCoin = weakSelf.detailModel.paiCoin + classHour = weakSelf.detailModel.classHour - if model.paiCoin == 1{ - paiCoin = weakSelf.detailModel.paiCoin - } - - if model.classHour == 1{ - classHour = weakSelf.detailModel.classHour - } - PaymentView.show(enumType: .worldCup, money: (ali: money, wx: money, coin: paiCoin, course:classHour, integral: nil)) {[weak self] payType in - guard let weakSelf = self else { return } - Services.worldCupPayment(id: weakSelf.detailModel.id, ids: result.jq_toJson1(), payType: payType, uid: nil).subscribe(onNext: {data in - if let m = data.data{ - switch payType { - case .aliPay: - YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) { result in - switch result { - case .success: - let vc = PaymentResultVC(result: .success, objType: .worldCup) - self?.push(vc: vc) - case .cancel: - alert(msg: "交易取消") - case .failure(_): - let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) - self?.push(vc: vc) - } - } - case .coin,.free: - let vc = PaymentResultVC(result: .success, objType: .worldCup) - self?.push(vc: vc) - case .courseNum: - let vc = PaymentResultVC(result: .success, objType: .worldCup) - self?.push(vc: vc) - default:break - } - } - },onError: { error in - if let er = error as? NetworkRequest.NetRequestError{ - switch er { - case .Other(let code,let string): - let vc = PaymentResultVC(result: .fail(string,code), objType: .worldCup) - JQ_currentViewController().jq_push(vc: vc) - default: - let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) - JQ_currentViewController().jq_push(vc: vc) - } - } - }).disposed(by: weakSelf.disposeBag) - } + if money == 0 && paiCoin == 0 && classHour == 0{ + weakSelf.payment(payType: .free, result: result) + }else{ + PaymentView.show(enumType: .worldCup, money: (ali: money, wx: money, coin: paiCoin, course:classHour, integral: nil)) {[weak self] payType in + guard let weakSelf = self else { return } + weakSelf.payment(payType: payType, result: result) } - }).disposed(by: weakSelf.disposeBag) - - - + } } } } + private func payment(payType:PayType,result:[Dictionary<String,Int>]){ + Services.worldCupPayment(id: detailModel.id, ids: result.jq_toJson1(), payType: payType, uid: nil).subscribe(onNext: {[weak self]data in + if let m = data.data{ + switch payType { + case .aliPay: + YYPaymentManager.shared.sendPaymentRequest(YYAlipayRequest(orderString: m.orderString)) { result in + switch result { + case .success: + let vc = PaymentResultVC(result: .success, objType: .worldCup) + self?.push(vc: vc) + case .cancel: + alert(msg: "交易取消") + case .failure(_): + let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) + self?.push(vc: vc) + } + } + case .coin,.free: + let vc = PaymentResultVC(result: .success, objType: .worldCup) + self?.push(vc: vc) + case .courseNum: + let vc = PaymentResultVC(result: .success, objType: .worldCup) + self?.push(vc: vc) + default:break + } + } + },onError: { error in + if let er = error as? NetworkRequest.NetRequestError{ + switch er { + case .Other(let code,let string): + let vc = PaymentResultVC(result: .fail(string,code), objType: .worldCup) + JQ_currentViewController().jq_push(vc: vc) + default: + let vc = PaymentResultVC(result: .fail("支付失败",0), objType: .worldCup) + JQ_currentViewController().jq_push(vc: vc) + } + } + }).disposed(by: disposeBag) + } + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.xib b/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.xib index a1136c1..e0d9ac5 100644 --- a/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.xib +++ b/WanPai/Root/Search/VC/WorldCupContentApplyInputVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22504"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <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"/> @@ -14,6 +14,7 @@ <connections> <outlet property="btn_addStudent" destination="J6G-ci-uFv" id="NWF-LA-tm8"/> <outlet property="btn_agreement" destination="q5y-in-bNV" id="dA7-bY-ILw"/> + <outlet property="btn_enroll" destination="kdj-bD-RIR" id="FnQ-m9-e5f"/> <outlet property="btn_moreStore" destination="AgA-ET-N0O" id="u3j-bV-RNv"/> <outlet property="cons_tableHei" destination="7Nj-Ch-Bss" id="g2d-CY-NCq"/> <outlet property="label_address" destination="Mmh-IM-z9o" id="hJU-oa-HZD"/> diff --git a/WanPai/Root/Search/VC/WorldCupContentApplyVC.swift b/WanPai/Root/Search/VC/WorldCupContentApplyVC.swift index d8b0991..9934a75 100644 --- a/WanPai/Root/Search/VC/WorldCupContentApplyVC.swift +++ b/WanPai/Root/Search/VC/WorldCupContentApplyVC.swift @@ -29,6 +29,7 @@ @IBOutlet weak var webView: WKWebView! @IBOutlet weak var cons_webHei: NSLayoutConstraint! @IBOutlet weak var btn_moreStore: UIButton! + @IBOutlet weak var btn_enroll: UIButton! private var detailModel:WorldCupDetailModel? @@ -67,7 +68,7 @@ } self?.bannerView.setItems(items: items) - self?.btn_moreStore.isHidden = model.storeInfos.count > 1 + self?.btn_moreStore.isHidden = model.storeInfos.count == 1 self?.label_title.text = model.name self?.label_hot.text = "\(model.heat)" @@ -83,12 +84,35 @@ self?.label_city.text = "" self?.label_address.text = model.address self?.label_matchPoint.text = model.storeInfos.map({$0.name}).joined(separator: "、") - self?.label_pay_money.text = "¥\(model.cash)/人" - self?.label_pay_coin.text = "\(model.paiCoin)币/人" - self?.label_pay_course.text = "\(model.classHour)课时/人" + + if model.cash == 0{ + self?.label_pay_money.text = "免费" + }else{ + self?.label_pay_money.text = "¥\(model.cash)/人" + } + + if model.paiCoin == 0{ + self?.label_pay_coin.text = "免费" + }else{ + self?.label_pay_coin.text = "\(model.paiCoin)币/人" + } + + if model.classHour == 0{ + self?.label_pay_coin.text = "免费" + }else{ + self?.label_pay_course.text = "\(model.classHour)课时/人" + } + self?.label_desc.text = model.intro self?.webView.loadHTMLString(model.content.jq_wrapHtml(), baseURL: nil) + + let endDateTimeInterval = Date.jq_StringToTimeInterval(model.registrationClosingTime, "yyyy-MM-dd HH:mm") + if endDateTimeInterval < Date().timeIntervalSince1970{ + self?.btn_enroll.setTitle("报名已截止", for: .normal) + self?.btn_enroll.backgroundColor = .gray.withAlphaComponent(0.5) + } + self?.detailModel = model } }).disposed(by: disposeBag) diff --git a/WanPai/Root/Search/VC/WorldCupContentApplyVC.xib b/WanPai/Root/Search/VC/WorldCupContentApplyVC.xib index 8063116..e46b079 100644 --- a/WanPai/Root/Search/VC/WorldCupContentApplyVC.xib +++ b/WanPai/Root/Search/VC/WorldCupContentApplyVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22504"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <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"/> @@ -12,6 +12,7 @@ <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WorldCupContentApplyVC" customModule="WanPai" customModuleProvider="target"> <connections> + <outlet property="btn_enroll" destination="3aZ-G8-j6f" id="hd5-No-xwO"/> <outlet property="btn_moreStore" destination="8A3-ba-Lfp" id="gNd-9Y-tYk"/> <outlet property="cons_webHei" destination="mZW-Bo-YeJ" id="jsg-oq-zAd"/> <outlet property="label_address" destination="5zE-II-xtR" id="bgD-gj-Q7I"/> diff --git a/WanPai/Root/Search/VC/WorldCupContentDetailVC.swift b/WanPai/Root/Search/VC/WorldCupContentDetailVC.swift index 0a65a3f..208e191 100644 --- a/WanPai/Root/Search/VC/WorldCupContentDetailVC.swift +++ b/WanPai/Root/Search/VC/WorldCupContentDetailVC.swift @@ -34,6 +34,7 @@ @IBOutlet weak var webView: WKWebView! @IBOutlet weak var cons_webHei: NSLayoutConstraint! @IBOutlet weak var cons__cancelBtnHei: NSLayoutConstraint! + @IBOutlet weak var btn_enroll: UIButton! private var id:Int! private lazy var bannerView:CommonBannerView = { @@ -84,11 +85,17 @@ self?.label_address.text = model.address self?.label_city.text = "" self?.label_matchStore.text = model.storeInfos.map({$0.name}).joined(separator: "、") - self?.btn_moreMatchStore.isHidden = model.storeInfos.count > 1 + self?.btn_moreMatchStore.isHidden = model.storeInfos.count == 1 self?.tableView.reloadData() self?.webView.loadHTMLString(model.content.jq_wrapHtml(), baseURL: nil) self?.btn_cancel.isHidden = model.revocable == 0 self?.cons__cancelBtnHei.constant = model.revocable == 0 ? 0:40 + + let endDateTimeInterval = Date.jq_StringToTimeInterval(model.registrationClosingTime, "yyyy-MM-dd HH:mm") + if endDateTimeInterval < Date().timeIntervalSince1970{ + self?.btn_enroll.setTitle("报名已截止", for: .normal) + self?.btn_enroll.backgroundColor = .gray.withAlphaComponent(0.5) + } } }).disposed(by: disposeBag) } diff --git a/WanPai/Root/Search/VC/WorldCupContentDetailVC.xib b/WanPai/Root/Search/VC/WorldCupContentDetailVC.xib index 9886f67..e2d0685 100644 --- a/WanPai/Root/Search/VC/WorldCupContentDetailVC.xib +++ b/WanPai/Root/Search/VC/WorldCupContentDetailVC.xib @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" 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="22504"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/> <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"/> @@ -13,6 +13,7 @@ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WorldCupContentDetailVC" customModule="WanPai" customModuleProvider="target"> <connections> <outlet property="btn_cancel" destination="Gkg-tn-WFH" id="u4S-QZ-qFa"/> + <outlet property="btn_enroll" destination="Gkg-tn-WFH" id="dHR-xr-fFS"/> <outlet property="btn_moreMatchStore" destination="tjO-5y-Kg9" id="twv-r8-wNh"/> <outlet property="cons__cancelBtnHei" destination="y3u-8o-eMw" id="eWN-fY-L44"/> <outlet property="cons_tableHei" destination="HCn-5Z-SAr" id="JPW-ED-7vP"/> diff --git a/WanPai/Root/Search/VC/WorldCupContentVC.swift b/WanPai/Root/Search/VC/WorldCupContentVC.swift index f9f6679..17304bd 100644 --- a/WanPai/Root/Search/VC/WorldCupContentVC.swift +++ b/WanPai/Root/Search/VC/WorldCupContentVC.swift @@ -21,11 +21,11 @@ } class WorldCupContentVC: BaseVC { - var currentPartModel:ActivityDetailPartModel? - +// var currentPartModel:ActivityDetailPartModel? + var partModel:BehaviorRelay<ActivityDetailPartModel?>? + var superScrollView:UIScrollView? private var viewModel = WorldCupContentViewModel() - - private var tableView:UITableView! + private(set) var tableView:UITableView! override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .clear @@ -54,11 +54,31 @@ viewModel.configure(tableView) - if let m = currentPartModel{ - viewModel.studentID.accept(m.id) - viewModel.isStudent.accept(m.isStudent) - viewModel.beginRefresh() - } +// if let m = currentPartModel{ +// viewModel.studentID.accept(m.id) +// viewModel.isStudent.accept(m.isStudent) +// viewModel.beginRefresh() +// } + +// tableView.panGestureRecognizer.delegate = self + } + + override func setRx() { + partModel?.subscribe(onNext: {[weak self] model in + if let m = model{ + self?.viewModel.studentID.accept(m.id) + self?.viewModel.isStudent.accept(m.isStudent) + self?.viewModel.beginRefresh() + } + }).disposed(by: disposeBag) + } +} + +extension WorldCupContentVC:UIScrollViewDelegate{ + + func scrollViewDidScroll(_ scrollView: UIScrollView) { + let off = superScrollView!.contentOffset.y + scrollView.contentOffset.y + superScrollView!.contentOffset.y = max(0,min(350,off)) } } @@ -80,7 +100,7 @@ let cell = tableView.dequeueReusableCell(withIdentifier: "_WorldCupTCell") as! WorldCupTCell cell.backgroundColor = .clear cell.setWorldCupListModel(model) - cell.label_state.text = viewModel.state.value == 2 ? "未开始":"进行中" + cell.label_state.text = viewModel.state.value == 2 ? "进行中":"未开始" return cell } diff --git a/WanPai/Root/Search/VC/WorldCupHeaderVC.swift b/WanPai/Root/Search/VC/WorldCupHeaderVC.swift index c0fb5eb..c4246be 100644 --- a/WanPai/Root/Search/VC/WorldCupHeaderVC.swift +++ b/WanPai/Root/Search/VC/WorldCupHeaderVC.swift @@ -8,6 +8,7 @@ import UIKit import QMUIKit import JQTools +import RxRelay class WorldCupHeaderVC: BaseVC { @@ -21,18 +22,21 @@ @IBOutlet weak var label_loseNum: UILabel! @IBOutlet weak var label_winRate: UILabel! - var currentPartModel:ActivityDetailPartModel?{ - didSet{ - if let m = currentPartModel{ - label_name.text = m.name - if let qrCode = WorldCupUserInfoQRCodel(id: m.id, isStudent: m.isStudent).toJSONString(){ - img_QR.image = UIImage.jq_GenerateQRCode(with: "\(qrCode)", width: 76) - } - getData(id: m.id, isStudent: m.isStudent) - } +// var currentPartModel:ActivityDetailPartModel?{ +// didSet{ +// if let m = currentPartModel{ +// label_name.text = m.name +// if let qrCode = WorldCupUserInfoQRCodel(id: m.id, isStudent: m.isStudent).toJSONString(){ +// img_QR.image = UIImage.jq_GenerateQRCode(with: "\(qrCode)", width: 76) +// } +// getData(id: m.id, isStudent: m.isStudent) +// } +// +// } +// } - } - } + var partModel:BehaviorRelay<ActivityDetailPartModel?>? + var partModels = [ActivityDetailPartModel](){ didSet{ btn_exchange.isHidden = partModels.count <= 1 @@ -51,6 +55,18 @@ setProvince(rank: 0) setCity(cityName: "", rank: 0) + } + + override func setRx() { + partModel?.subscribe(onNext: {[weak self]model in + if let m = model{ + self?.label_name.text = m.name + if let qrCode = WorldCupUserInfoQRCodel(id: m.id, isStudent: m.isStudent).toJSONString(){ + self?.img_QR.image = UIImage.jq_GenerateQRCode(with: "\(qrCode)", width: 76) + } + self?.getData(id: m.id, isStudent: m.isStudent) + } + }).disposed(by: disposeBag) } private func getData(id:Int,isStudent:Int){ @@ -76,8 +92,8 @@ @IBAction func exchangeAction(_ sender: Any) { - StudentChoose2View.show { items in - + StudentChoose2View.show {[weak self] item in + self?.partModel?.accept(item) } } } diff --git a/WanPai/Root/Search/VC/WorldCupRankVC.swift b/WanPai/Root/Search/VC/WorldCupRankVC.swift index 61d1e27..80709d3 100644 --- a/WanPai/Root/Search/VC/WorldCupRankVC.swift +++ b/WanPai/Root/Search/VC/WorldCupRankVC.swift @@ -27,7 +27,7 @@ class WorldCupRankVC: BaseVC { private var viewModel = WorldCupRankViewModel() - var currentPartModel:ActivityDetailPartModel? + var partModel:BehaviorRelay<ActivityDetailPartModel?>? private var worldCupRankModel:WorldCupRankModel? private let cityBtn = UIButton(type: .custom) private let yearBtn = QMUIButton(type: .custom) @@ -38,18 +38,18 @@ override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .clear - if let model = currentPartModel{ - viewModel.id.accept(model.id) - viewModel.isStudent.accept(model.isStudent) - Services.getEntrantRank(id: model.id, isStudent: model.isStudent).subscribe(onNext: {[weak self] data in - if let model = data.data{ - self?.worldCupRankModel = model - self?.cityBtn.setTitle(model.cityName, for: .normal) - self?.cityBtn.layoutIfNeeded() - self?.cityBtn.layoutSubviews() - } - }).disposed(by: disposeBag) - } +// if let model = currentPartModel{ +// viewModel.id.accept(model.id) +// viewModel.isStudent.accept(model.isStudent) +// Services.getEntrantRank(id: model.id, isStudent: model.isStudent).subscribe(onNext: {[weak self] data in +// if let model = data.data{ +// self?.worldCupRankModel = model +// self?.cityBtn.setTitle(model.cityName, for: .normal) +// self?.cityBtn.layoutIfNeeded() +// self?.cityBtn.layoutSubviews() +// } +// }).disposed(by: disposeBag) +// } } override func setUI() { @@ -108,8 +108,28 @@ stackView.addArrangedSubview(provinceBtn) stackView.addArrangedSubview(cityBtn) - viewModel.configure(tableView) + viewModel.configure(tableView,needMore: false) viewModel.beginRefresh() + } + + override func setRx() { + partModel?.subscribe(onNext: {[weak self] model in + guard let weakSelf = self else { return } + if let m = model{ + self?.viewModel.id.accept(m.id) + self?.viewModel.isStudent.accept(m.isStudent) + + Services.getEntrantRank(id: m.id, isStudent: m.isStudent).subscribe(onNext: {[weak self] data in + if let model = data.data{ + self?.worldCupRankModel = model + self?.cityBtn.setTitle(model.cityName, for: .normal) + self?.cityBtn.layoutIfNeeded() + self?.cityBtn.layoutSubviews() + } + }).disposed(by: weakSelf.disposeBag) + } + + }).disposed(by: disposeBag) } @objc func radiusAction(btn:UIButton){ @@ -237,6 +257,8 @@ return cell! } let cell = tableView.dequeueReusableCell(withIdentifier: "rankTCell") as! WorldCupRankTCell + cell.indexPath = indexPath + cell.model = viewModel.dataSource.value[indexPath.row] cell.addLine(UIColor(hexStr: "#E1E1E1"), false, true, false, true, 0.4) return cell } diff --git a/WanPai/Root/Search/VC/WorldCupRecordVC.swift b/WanPai/Root/Search/VC/WorldCupRecordVC.swift index 2b8c3a2..b08ce1a 100644 --- a/WanPai/Root/Search/VC/WorldCupRecordVC.swift +++ b/WanPai/Root/Search/VC/WorldCupRecordVC.swift @@ -22,8 +22,9 @@ class WorldCupRecordVC: BaseVC { - private var tableView:UITableView! + private(set) var tableView:UITableView! private var viewModel = WorldCupRecordViewModel() + var partModel:BehaviorRelay<ActivityDetailPartModel?>? override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .clear @@ -48,6 +49,15 @@ viewModel.configure(tableView) viewModel.beginRefresh() } + + override func setRx() { + partModel?.subscribe(onNext: {[weak self]model in + if let m = model{ + self?.viewModel.studentId.accept(m.id) + self?.viewModel.isStudent.accept(m.isStudent) + } + }).disposed(by: disposeBag) + } } extension WorldCupRecordVC:UITableViewDelegate,UITableViewDataSource{ diff --git a/WanPai/Root/Search/VC/WorldCupVC.swift b/WanPai/Root/Search/VC/WorldCupVC.swift index d3c586b..c70151f 100644 --- a/WanPai/Root/Search/VC/WorldCupVC.swift +++ b/WanPai/Root/Search/VC/WorldCupVC.swift @@ -9,25 +9,20 @@ import SPPageMenu import FFPage import JQTools - +import RxSwift +import RxRelay +import RxCocoa +import RxDataSources +import ReplayKit class WorldCupVC: BaseVC { - private var partModels = [ActivityDetailPartModel](){ - didSet{ - currentPartModel = partModels.first - } - } - - private var currentPartModel:ActivityDetailPartModel?{ - didSet{ - headerVC.currentPartModel = currentPartModel - pageVC.reloadData() - } - } + private var partModels = [ActivityDetailPartModel]() + private var partModel = BehaviorRelay<ActivityDetailPartModel?>(value:nil) lazy var headerVC:WorldCupHeaderVC = { let vc = WorldCupHeaderVC() + vc.partModel = partModel return vc }() @@ -41,6 +36,7 @@ vc.headViewController = headerVC vc.menuViewController = menuVC vc.pageViewController = pageVC + vc.style = .headRefresh vc.headHeight = 350 vc.menuHeight = 50 vc.style = .subRefresh @@ -77,17 +73,27 @@ } menuVC.pageMenu.delegate = self - Services.getParticipant().subscribe(onNext: {[weak self ]data in if let items = data.data{ guard let weakSelf = self else { return } weakSelf.partModels = items + weakSelf.headerVC.partModels = items + weakSelf.partModel.accept(items.first) } }).disposed(by: disposeBag) + + headerVC.partModel = partModel } override func setUI() { + } + + override func setRx() { +// partModel.subscribe(onNext: { data in +// +// +// }).disposed(by: disposeBag) } } @@ -98,14 +104,21 @@ func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController { if page <= 1{ - let contentVC = WorldCupContentVC(state:page + 1) - contentVC.currentPartModel = currentPartModel + var state = 1 + if page == 0{ + state = 2 + } + let contentVC = WorldCupContentVC(state:state) + contentVC.superScrollView = adapterVC.scrollview + contentVC.partModel = partModel return contentVC }else if page == 2{ - return WorldCupRecordVC() + let vc = WorldCupRecordVC() + vc.partModel = partModel + return vc }else{ let vc = WorldCupRankVC() - vc.currentPartModel = currentPartModel + vc.partModel = partModel return vc } } diff --git a/WanPai/Root/Welfare/VC/WorldCupIntroVC.swift b/WanPai/Root/Welfare/VC/WorldCupIntroVC.swift index 0fdb02f..36707c7 100644 --- a/WanPai/Root/Welfare/VC/WorldCupIntroVC.swift +++ b/WanPai/Root/Welfare/VC/WorldCupIntroVC.swift @@ -54,7 +54,7 @@ @objc func jumpAction(){ if let m = model{ - jumpPage(model: m.model, page: m.page, type: m.type, id: m.id) + jumpPage(model: m.model, page: m.page, type: m.type, id: m.turnId) } } -- Gitblit v1.7.1