| | |
| | | private let provinceBtn = UIButton(type: .custom) |
| | | private var tableView:UITableView! |
| | | var superScrollView:UIScrollView? |
| | | |
| | | var flowCell:WorldCupRankTCell? |
| | | 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) |
| | | // } |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | if let m = model{ |
| | | self?.viewModel.id.accept(m.id) |
| | | self?.viewModel.isStudent.accept(m.isStudent) |
| | | self?.viewModel.beginRefresh() |
| | | |
| | | Services.getEntrantRank(id: m.id, isStudent: m.isStudent).subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | |
| | | } |
| | | |
| | | }).disposed(by: disposeBag) |
| | | |
| | | Observable.combineLatest(superScrollView!.rx.contentOffset, tableView.rx.contentOffset).subscribe { v1,v2 in |
| | | //获取rankTCell是否出现在屏幕内 |
| | | if let cell = self.flowCell{ |
| | | let rect = cell.convert(cell.bounds, to: app.window) |
| | | if rect.origin.y < 0 || rect.origin.y > self.view.height{ |
| | | NotificationCenter.default.post(name: ShowOrHiddenFlowImage_Noti, object: false) |
| | | }else{ |
| | | NotificationCenter.default.post(name: ShowOrHiddenFlowImage_Noti, object: true) |
| | | } |
| | | } |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | |
| | | @objc func radiusAction(btn:UIButton){ |
| | |
| | | } |
| | | return cell! |
| | | } |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "rankTCell") as! WorldCupRankTCell |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "rankTCell") as! WorldCupRankTCell |
| | | cell.indexPath = indexPath |
| | | cell.model = viewModel.dataSource.value[indexPath.row] |
| | | |
| | | if viewModel.dataSource.value[indexPath.row].oneself == 1{ |
| | | cell.borderColor = UIColor(hexString: "#FC743A") |
| | | cell.borderWidth = 1 |
| | | }else{ |
| | | cell.borderWidth = 0 |
| | | } |
| | | |
| | | cell.addLine(UIColor(hexStr: "#E1E1E1"), false, true, false, true, 0.4) |
| | | return cell |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { |
| | | if let rankTCell = cell as? WorldCupRankTCell{ |
| | | if viewModel.dataSource.value[indexPath.row].oneself == 1{ |
| | | flowCell = rankTCell |
| | | NotificationCenter.default.post(name: FlowImage_Noti, object: rankTCell.jq_captureToImage()) |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| | | if indexPath.section == 0{ |
| | | return 32 |