无故事王国
2024-03-14 a478b668ca1a5d4f6d2d9b1075d292cbbef90de5
WanPai/Root/Search/VC/WorldCupRankVC.swift
@@ -35,21 +35,11 @@
            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() {
@@ -118,6 +108,7 @@
                                    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{
@@ -130,6 +121,18 @@
                                    }
                        }).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){
@@ -263,13 +266,31 @@
                                    }
                                    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