| | |
| | | // |
| | | |
| | | 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 |
| | |
| | | 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 { |
| | |
| | | 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) |
| | |
| | | make.bottom.equalToSuperview().offset(-6.5) |
| | | } |
| | | } |
| | | |
| | | if let label = headerView?.contentView.viewWithTag(100) as? UILabel{ |
| | | label.text = "总场次:\(viewModel.dataSource.value?.totalSession ?? 0)场" |
| | | } |
| | | |
| | | return headerView |
| | | } |
| | | |