From 93783809cfb18ae273bd3a78c8dbca91facd10d9 Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期三, 29 十一月 2023 11:49:49 +0800
Subject: [PATCH] fix bug

---
 WanPai/Root/Course/VC/CourseDetailApplyVC.swift |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
index f61bdc7..f1fd851 100644
--- a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
+++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift
@@ -66,12 +66,17 @@
 			label_vaild.text = m.time
 			label_courseType.text = m.type.strTitle
 
-			//默认选择传递过来的课时数
-			for (index,clas) in m.list.enumerated(){
-				if clas.classHours == classHours{
-					selectClassIndex = index;break
-				}
+			if classHours != nil{
+				let temp = detailModel?.list.filter({$0.classHours == classHours!}) ?? []
+				detailModel?.list = temp
 			}
+
+//			//默认选择传递过来的课时数
+//			for (index,clas) in m.list.enumerated(){
+//				if clas.classHours == classHours{
+//					selectClassIndex = index;break
+//				}
+//			}
 
 			switch m.type {
 				case .vocation:
@@ -109,15 +114,9 @@
 			view_banner.setItems(items: items)
 		}
 
-		if let m = signUpModel{
+		if var m = signUpModel{
 			classHours = m.chooseHours
-
-				//默认选择传递过来的课时数
-			for (index,clas) in m.list.enumerated(){
-				if clas.classHours == classHours{
-					selectClassIndex = index;break
-				}
-			}
+			detailModel?.list = m.list.filter({$0.classHours == classHours})
 
 			if m.payStatus == .unPayment{
 				btn_handleBtn.setTitle("待支付", for: .normal)

--
Gitblit v1.7.1