| | |
| | | // |
| | | |
| | | import UIKit |
| | | import RxSwift |
| | | |
| | | class StudentExchangeViewModel:RefreshModel<StudentProfile1Model>{ |
| | | override func api() -> (Observable<BaseResponse<[StudentProfile1Model]>>)? { |
| | | return Services.startCourceStudentList() |
| | | } |
| | | } |
| | | |
| | | class StudentExchangeVC: BaseVC { |
| | | |
| | | @IBOutlet weak var tableView: UITableView! |
| | | @IBOutlet weak var tableView: BaseTableView! |
| | | |
| | | |
| | | private let viewModel = StudentExchangeViewModel() |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | title = "切换学员" |
| | | |
| | | viewModel.configure(tableView,needMore: false) |
| | | viewModel.beginRefresh() |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.register(UINib(nibName: "StudentInfo_3_TCell", bundle: nil), forCellReuseIdentifier: "_StudentInfo_3_TCell") |
| | | tableView.jq_setEmptyView() |
| | | } |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe(onNext: {noti in |
| | | self.viewModel.beginRefresh() |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @IBAction func addStudentAction(_ sender: UIButton) { |
| | |
| | | |
| | | extension StudentExchangeVC:UITableViewDataSource{ |
| | | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| | | let model = viewModel.dataSource.value[indexPath.row] |
| | | let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_3_TCell") as! StudentInfo_3_TCell |
| | | cell.studentProfile1Model = model |
| | | return cell |
| | | } |
| | | |
| | | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| | | return 10 |
| | | return viewModel.dataSource.value.count |
| | | } |
| | | } |