From f7e33a3255d9f87b20e4a06fc32012eaad77cad5 Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期三, 11 十月 2023 14:52:37 +0800
Subject: [PATCH] 完善

---
 WanPai/Root/Course/VC/AddStudentVC.swift |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/WanPai/Root/Course/VC/AddStudentVC.swift b/WanPai/Root/Course/VC/AddStudentVC.swift
index 4bfe798..7610708 100644
--- a/WanPai/Root/Course/VC/AddStudentVC.swift
+++ b/WanPai/Root/Course/VC/AddStudentVC.swift
@@ -116,27 +116,25 @@
     }
 
     private func addStudent(){
-
         if type == .course{
             Services.addStudent(studentModel).subscribe(onNext: { [weak self] data in
-                guard let weakSelf = self else { return }
-                alertSuccess(msg: "添加成功")
-                DispatchQueue.main.asyncAfter(deadline: .now()+1) {
-                    weakSelf.navigationController?.popViewController()
-                }
+				self?.addStudentSuccess()
             }).disposed(by: disposeBag)
         }else{
             Services.addParticipant(studentModel).subscribe(onNext: {[weak self] data in
-                guard let weakSelf = self else { return }
-                alertSuccess(msg: "添加成功")
-                DispatchQueue.main.asyncAfter(deadline: .now()+1) {
-                    weakSelf.navigationController?.popViewController()
-                    NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil)
-                }
+				self?.addStudentSuccess()
             }).disposed(by: disposeBag)
         }
     }
 
+	private func addStudentSuccess(){
+		alertSuccess(msg: "添加成功")
+		DispatchQueue.main.asyncAfter(deadline: .now()+1) {
+			self.navigationController?.popViewController()
+			NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil)
+		}
+	}
+
     deinit{
         JQ_ImagePickerTool.destroy()
     }

--
Gitblit v1.7.1