From 7ab2d732db69aed82fa019a5ee6f4b5888cd399a Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期五, 15 三月 2024 14:36:38 +0800
Subject: [PATCH] fix bug

---
 WanPai/Root/Course/VC/AddStudentVC.swift |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/WanPai/Root/Course/VC/AddStudentVC.swift b/WanPai/Root/Course/VC/AddStudentVC.swift
index 47d6527..34c7151 100644
--- a/WanPai/Root/Course/VC/AddStudentVC.swift
+++ b/WanPai/Root/Course/VC/AddStudentVC.swift
@@ -24,7 +24,8 @@
 				@IBOutlet weak var tf_phone: QMUITextField!
 				@IBOutlet weak var tf_birthday: UITextField!
 				@IBOutlet weak var img_idCardSingle: UIImageView!
-				
+				@IBOutlet weak var img_phoneSingle: UIImageView!
+
 				var profileImg:UIImage?
 
 				var studentModel = StudentProfileModel()
@@ -34,19 +35,23 @@
 
 				var verifyIdCard:Bool = false
 				var identity:Bool = false //是否需要实名
+				var identityPhone:Bool = false //是否需要实名手机
 
-				init(type:ItemType,studentInfo:StudentProfile1Model? = nil,identity:Bool = false) {
+
+				init(type:ItemType,studentInfo:StudentProfile1Model? = nil,identity:Bool = false,identityPhone:Bool = false) {
 								super.init(nibName: nil, bundle: nil)
 								self.type = type
 								self.studentInfo = studentInfo
 								self.identity = identity
+								self.identityPhone = identityPhone
 				}
 
-				init(type:ItemType,activityDetailPartModel:ActivityDetailPartModel? = nil,identity:Bool = false) {
+				init(type:ItemType,activityDetailPartModel:ActivityDetailPartModel? = nil,identity:Bool = false,identityPhone:Bool = false) {
 								super.init(nibName: nil, bundle: nil)
 								self.type = type
 								self.activityDetailPartModel = activityDetailPartModel
 								self.identity = identity
+								self.identityPhone = identityPhone
 				}
 
 				required init?(coder: NSCoder) {
@@ -57,6 +62,7 @@
 								super.viewDidLoad()
 
 								img_idCardSingle.isHidden = !identity
+								img_phoneSingle.isHidden = !identityPhone
 
 								if type == .course{
 												title = "添加运动营成员"
@@ -134,7 +140,7 @@
 				@IBAction func completeAction(_ sender: UIButton) {
 
 								if !view_profile.isHidden{
-												guard profileImg != nil else {
+												guard profileImg != nil || !(studentInfo?.stuHeadImg.isEmpty ?? true) else {
 
 																if type == .course{
 																				alertError(msg: "请上传运动营成员头像");
@@ -155,7 +161,7 @@
 								guard tf_height.text != "0" else {alertError(msg: "请输入正确的身高");return}
 								guard tf_weight.text != "0" else {alertError(msg: "请输入正确的体重");return}
 
-								if !tf_phone.isEmpty{
+								if !tf_phone.isEmpty || identityPhone{
 												guard tf_phone.text!.jq_isPhone else {alertError(msg: "请输入正确的手机号");return}
 								}
 
@@ -163,7 +169,10 @@
 												guard tf_idCard.text!.jq_idCard() else {alertError(msg: "请输入正确的身份证号码");return}
 								}
 
-								studentModel.birthday = tf_birthday.text!
+								if let birthday = tf_idCard.text?.jq_idCardBirthday(){
+												studentModel.birthday = birthday
+								}
+
 								studentModel.name = tf_name.text!
 								studentModel.height = tf_height.text!.toDouble
 								studentModel.weight = tf_weight.text!.toDouble

--
Gitblit v1.7.1