From bb4b7bdc199b81dd7e3febcfdc9bd69f6f80d633 Mon Sep 17 00:00:00 2001
From: younger_times <841720330@qq.com>
Date: 星期四, 20 七月 2023 17:28:28 +0800
Subject: [PATCH] 完善

---
 WanPai/Root/Course/VC/StudentExchangeVC.swift |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/WanPai/Root/Course/VC/StudentExchangeVC.swift b/WanPai/Root/Course/VC/StudentExchangeVC.swift
index c31c94e..8fef734 100644
--- a/WanPai/Root/Course/VC/StudentExchangeVC.swift
+++ b/WanPai/Root/Course/VC/StudentExchangeVC.swift
@@ -6,14 +6,27 @@
 //
 
 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() {
@@ -21,6 +34,13 @@
         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) {
@@ -35,11 +55,13 @@
 
 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
     }
 }

--
Gitblit v1.7.1