fix
无故事王国
2024-03-04 54c6ef0be42d9f2e49a344fd69f231cb6df43797
WanPai/Root/Search/VC/WorldCupRecordVC.swift
@@ -6,10 +6,24 @@
//
import UIKit
import RxSwift
import RxCocoa
class WorldCupRecordViewModel:RefreshInnerModel<WorldCupMatchRecordDataModel>{
            let studentId = BehaviorRelay<Int>(value:0)
            let isStudent = BehaviorRelay<Int>(value:0)
            override func api() -> (Observable<BaseResponse<BaseResponseList<WorldCupMatchRecordDataModel>>>)? {
                        return Services.getWorldCupMatchRecord(id: studentId.value, isStudent: isStudent.value, pageNo: page)
            }
}
class WorldCupRecordVC: BaseVC {
            private var tableView:UITableView!
            private var viewModel = WorldCupRecordViewModel()
            override func viewDidLoad() {
                        super.viewDidLoad()
                        view.backgroundColor = .clear
@@ -30,12 +44,15 @@
                        tableView.snp.makeConstraints { make in
                                    make.edges.equalToSuperview()
                        }
                        viewModel.configure(tableView)
                        viewModel.beginRefresh()
            }
}
extension WorldCupRecordVC:UITableViewDelegate,UITableViewDataSource{
            func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                        return 20
                        return viewModel.dataSource.value?.list.count ?? 0
            }
            func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -55,7 +72,7 @@
                                    headerView?.backgroundColor = .clear
                                    headerView?.contentView.backgroundColor = .clear
                                 let label   = UILabel()
                                    label.text = "总场次:0场"
                                    label.tag = 100
                                    label.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
                                    label.textColor = .black.withAlphaComponent(0.8)
                                    headerView?.contentView.addSubview(label)
@@ -65,6 +82,11 @@
                                                make.bottom.equalToSuperview().offset(-6.5)
                                    }
                        }
                        if let label = headerView?.contentView.viewWithTag(100) as? UILabel{
                                    label.text = "总场次:\(viewModel.dataSource.value?.totalSession ?? 0)场"
                        }
                        return headerView
            }