| | |
| | | |
| | | class WorldCupVC: BaseVC { |
| | | |
| | | private let cityBtn = UIButton(type: .custom) |
| | | private let provinceBtn = UIButton(type: .custom) |
| | | |
| | | private var partModels = [ActivityDetailPartModel]() |
| | | private var partModel = BehaviorRelay<ActivityDetailPartModel?>(value:nil) |
| | | private var currentRankModel = BehaviorRelay<WorldCupMatchRankModel?>(value: nil) |
| | | private var toPage:Int? |
| | | |
| | | lazy var footView:UIView = { |
| | | let v = UIView() |
| | | return v |
| | | }() |
| | | |
| | | lazy var worldCupRankVC:WorldCupRankVC = { |
| | | return WorldCupRankVC() |
| | | }() |
| | | |
| | | lazy var headerVC:WorldCupHeaderVC = { |
| | | let vc = WorldCupHeaderVC() |
| | |
| | | return vc |
| | | }() |
| | | |
| | | lazy var flowImageView:UIImageView = { |
| | | let i = UIImageView() |
| | | i.tag = 1001 |
| | | return i |
| | | }() |
| | | // lazy var flowImageView:UIImageView = { |
| | | // let i = UIImageView() |
| | | // i.tag = 1001 |
| | | // return i |
| | | // }() |
| | | |
| | | |
| | | lazy var pageVC:FFPageViewController = { |
| | | let pageViewController = FFPageViewController() |
| | |
| | | self.pageVC.scroll(toPage: self.toPage ?? 0, animation: false) |
| | | } |
| | | |
| | | addFootView() |
| | | } |
| | | |
| | | override func setUI() { |
| | | |
| | | } |
| | | |
| | | private func addFootView(){ |
| | | footView.backgroundColor = .white |
| | | footView.isHidden = true |
| | | view.addSubview(footView) |
| | | footView.snp.makeConstraints { make in |
| | | make.left.right.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 14)) |
| | | make.bottom.equalToSuperview() |
| | | make.height.equalTo(100 + UIDevice.jq_safeEdges.bottom) |
| | | } |
| | | |
| | | let stackView = UIStackView() |
| | | stackView.axis = .horizontal |
| | | stackView.distribution = .fillEqually |
| | | stackView.spacing = 10 |
| | | |
| | | provinceBtn.setTitle("全国", for: .normal) |
| | | provinceBtn.tag = 10 |
| | | provinceBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) |
| | | provinceBtn.setTitleColor(UIColor(hexString: "#FE7E03"), for: .normal) |
| | | provinceBtn.borderColor = UIColor(hexString: "#FE7E03") |
| | | provinceBtn.borderWidth = 1 |
| | | provinceBtn.cornerRadius = 20 |
| | | provinceBtn.addTarget(self, action: #selector(radiusAction), for: .touchUpInside) |
| | | |
| | | cityBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) |
| | | cityBtn.tag = 11 |
| | | cityBtn.setTitleColor(.white, for: .normal) |
| | | cityBtn.backgroundColor = UIColor(hexString: "#FE7E03") |
| | | cityBtn.cornerRadius = 20 |
| | | cityBtn.addTarget(self, action: #selector(radiusAction), for: .touchUpInside) |
| | | |
| | | stackView.addArrangedSubview(provinceBtn) |
| | | stackView.addArrangedSubview(cityBtn) |
| | | |
| | | footView.addSubview(stackView) |
| | | stackView.snp.makeConstraints { make in |
| | | make.left.right.equalToSuperview().inset(UIEdgeInsets(top: 0, left: 27, bottom: 0, right: 27)) |
| | | make.bottom.equalToSuperview().offset(-UIDevice.jq_safeEdges.bottom) |
| | | make.height.equalTo(40) |
| | | } |
| | | |
| | | let cell = WorldCupRankTCell(style: .default, reuseIdentifier: nil) |
| | | cell.tag = 1100 |
| | | cell.borderColor = UIColor(hexString: "#FC743A") |
| | | cell.jq_borderWidth = 1 |
| | | footView.addSubview(cell) |
| | | cell.snp.makeConstraints { make in |
| | | make.left.top.right.equalToSuperview() |
| | | make.height.equalTo(45) |
| | | } |
| | | } |
| | | |
| | | override func setRx() { |
| | | partModel.subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let student = data{ |
| | | Services.getEntrantRank(id: student.id, isStudent: student.isStudent).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.cityBtn.setTitle(model.cityName, for: .normal) |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | currentRankModel.subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data{ |
| | | if let cell = weakSelf.footView.viewWithTag(1100) as? WorldCupRankTCell{ |
| | | cell.model = model |
| | | } |
| | | weakSelf.footView.isHidden = false |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | // NotificationCenter.default.rx.notification(FlowImage_Noti, object: nil).take(until: self.rx.deallocated).subscribe(onNext: { noti in |
| | | // if let img = noti.object as? UIImage{ |
| | | // if let imag = self.view.viewWithTag(1001) as? UIImageView{ |
| | |
| | | // } |
| | | // |
| | | // }).disposed(by: disposeBag) |
| | | |
| | | } |
| | | |
| | | @objc func radiusAction(btn:UIButton){ |
| | | if btn.tag == 10{ |
| | | provinceBtn.jq_borderWidth = 0 |
| | | provinceBtn.setTitleColor(.white, for: .normal) |
| | | provinceBtn.backgroundColor = UIColor(hexString: "#FE7E03") |
| | | |
| | | cityBtn.setTitleColor(UIColor(hexString: "#FE7E03"), for: .normal) |
| | | cityBtn.backgroundColor = .white |
| | | cityBtn.jq_borderWidth = 1 |
| | | cityBtn.jq_borderColor = UIColor(hexString: "#FE7E03") |
| | | worldCupRankVC.viewModel.radius.accept(1) |
| | | }else{ |
| | | cityBtn.jq_borderWidth = 0 |
| | | cityBtn.setTitleColor(.white, for: .normal) |
| | | cityBtn.backgroundColor = UIColor(hexString: "#FE7E03") |
| | | |
| | | provinceBtn.setTitleColor(UIColor(hexString: "#FE7E03"), for: .normal) |
| | | provinceBtn.backgroundColor = .white |
| | | provinceBtn.jq_borderWidth = 1 |
| | | worldCupRankVC.viewModel.radius.accept(2) |
| | | } |
| | | worldCupRankVC.viewModel.beginRefresh() |
| | | |
| | | } |
| | | } |
| | |
| | | vc.partModel = partModel |
| | | return vc |
| | | }else{ |
| | | let vc = WorldCupRankVC() |
| | | vc.superScrollView = adapterVC.scrollview |
| | | vc.partModel = partModel |
| | | return vc |
| | | worldCupRankVC.superScrollView = adapterVC.scrollview |
| | | worldCupRankVC.partModel = partModel |
| | | worldCupRankVC.currentRankModel = currentRankModel |
| | | return worldCupRankVC |
| | | } |
| | | } |
| | | |
| | | func pageViewController(_ pageViewController: FFPageViewController, currentPageChanged currentPage: Int) { |
| | | menuVC.pageMenu.selectedItemIndex = currentPage |
| | | flowImageView.isHidden = currentPage != 3 |
| | | // flowImageView.isHidden = currentPage != 3 |
| | | footView.isHidden = currentPage != 3 |
| | | } |
| | | } |
| | | |
| | | extension WorldCupVC:SPPageMenuDelegate{ |
| | | func pageMenu(_ pageMenu: SPPageMenu, didSelectedItem index: Int) { |
| | | pageVC.scroll(toPage: index, animation: true) |
| | | flowImageView.isHidden = index != 3 |
| | | // flowImageView.isHidden = index != 3 |
| | | footView.isHidden = index != 3 |
| | | } |
| | | |
| | | func pageMenu(_ pageMenu: SPPageMenu, itemSelectedAt index: Int) { |