//
|
// LinesOfCreditListVC.swift
|
// OKProject
|
//
|
// Created by 无故事王国 on 2023/4/10.
|
// Copyright © 2023 yangwang. All rights reserved.
|
//
|
|
import UIKit
|
import RxRelay
|
|
class LinesOfCreditViewModel:YYRefreshViewModel<LinesModel>{
|
override func api() -> API! {
|
return .companyLimitList(pageNum: currentPage)
|
}
|
}
|
|
let RefreshLineOfCredit_Noti = Notification.Name.init("RefreshLineOfCredit_Noti")
|
|
class LinesOfCreditListVC: YYTableViewController {
|
|
private var viewModel = LinesOfCreditViewModel()
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
title = "额度申请"
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.separatorStyle = .none
|
tableView.register(UINib(nibName: "LineOfCredictTCell", bundle: nil), forCellReuseIdentifier: "_LineOfCredictTCell")
|
viewModel.configure(tableView: tableView)
|
tableView.beginRefreshing()
|
}
|
|
override func bindRx() {
|
super.bindRx()
|
NotificationCenter.default.rx.notification(RefreshLineOfCredit_Noti).takeUntil(self.rx.deallocated).subscribe(onNext: {noti in
|
self.tableView.beginRefreshing()
|
}).disposed(by: disposeBag)
|
}
|
}
|
|
extension LinesOfCreditListVC:UITableViewDelegate{
|
|
}
|
|
extension LinesOfCreditListVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return viewModel.dataSource.value.count
|
}
|
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_LineOfCredictTCell") as! LineOfCredictTCell
|
cell.backgroundColor = .clear
|
cell.lineModel = viewModel.dataSource.value[indexPath.row]
|
return cell
|
}
|
}
|