宽窄优行-由【嘉易行】项目成品而来
无故事王国
2023-05-25 dc1998fc1ac124f6b9a0e434ccf91103dd936409
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
//  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
    }
}