From 1c1af90c0a80fe60477de9d0141aa79957cd7e38 Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期四, 12 十月 2023 16:12:14 +0800
Subject: [PATCH] 修改BUG

---
 WanPai/Root/Course/VC/StudentExchangeVC.swift |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/WanPai/Root/Course/VC/StudentExchangeVC.swift b/WanPai/Root/Course/VC/StudentExchangeVC.swift
index 8fef734..62eb4a5 100644
--- a/WanPai/Root/Course/VC/StudentExchangeVC.swift
+++ b/WanPai/Root/Course/VC/StudentExchangeVC.swift
@@ -7,6 +7,7 @@
 
 import UIKit
 import RxSwift
+import QMUIKit
 
 class StudentExchangeViewModel:RefreshModel<StudentProfile1Model>{
     override func api() -> (Observable<BaseResponse<[StudentProfile1Model]>>)? {
@@ -17,8 +18,8 @@
 class StudentExchangeVC: BaseVC {
 
     @IBOutlet weak var tableView: BaseTableView!
-
-
+	@IBOutlet weak var btn_add: QMUIButton!
+	private var selectIndex:Int?
     private let viewModel = StudentExchangeViewModel()
 
     override func viewDidLoad() {
@@ -27,6 +28,8 @@
 
         viewModel.configure(tableView,needMore: false)
         viewModel.beginRefresh()
+		btn_add.imagePosition = .right
+		btn_add.spacingBetweenImageAndTitle = 5
     }
 
     override func setUI() {
@@ -47,10 +50,23 @@
         let studentVC = AddStudentVC(type: .course)
         push(vc: studentVC)
     }
+
+	@IBAction func changeAction(_ sender: UIButton) {
+		if let s = selectIndex{
+			let id = viewModel.dataSource.value[s].stuId
+			Services.startCourseSwitch(id: id).subscribe(onNext: { data in
+				NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil)
+				self.navigationController?.popViewController()
+			}).disposed(by: disposeBag)
+		}
+	}
 }
 
 extension StudentExchangeVC:UITableViewDelegate{
-
+	func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+		selectIndex = indexPath.row
+		tableView.reloadData()
+	}
 }
 
 extension StudentExchangeVC:UITableViewDataSource{
@@ -58,6 +74,20 @@
         let model = viewModel.dataSource.value[indexPath.row]
         let cell = tableView.dequeueReusableCell(withIdentifier: "_StudentInfo_3_TCell") as! StudentInfo_3_TCell
         cell.studentProfile1Model = model
+
+		if selectIndex != nil{
+			if indexPath.row == selectIndex{
+				cell.view_container.jq_borderColor = UIColor(hexStr: "#FD7902").withAlphaComponent(0.28)
+			}else{
+				cell.view_container.jq_borderColor = UIColor(hexStr: "#818080").withAlphaComponent(0.28)
+			}
+		}else{
+			if model.isNot == 1{
+				cell.view_container.jq_borderColor = UIColor(hexStr: "#FD7902").withAlphaComponent(0.28)
+			}else{
+				cell.view_container.jq_borderColor = UIColor(hexStr: "#818080").withAlphaComponent(0.28)
+			}
+		}
         return cell
     }
 

--
Gitblit v1.7.1