From 1cc03dff6006c235686f87fe0f80af2fde97abf4 Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期四, 14 十一月 2024 16:10:13 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Me/VC/StudyListVC.swift |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/XQMuse/Root/Me/VC/StudyListVC.swift b/XQMuse/Root/Me/VC/StudyListVC.swift
index ad7fa1d..351d3d2 100644
--- a/XQMuse/Root/Me/VC/StudyListVC.swift
+++ b/XQMuse/Root/Me/VC/StudyListVC.swift
@@ -92,6 +92,8 @@
 												let count = datas?.courseList.count ?? 0
 												if count == 0{
 																let cell	= collectionView.dequeueReusableCell(withReuseIdentifier: "_EmptyCCell", for: indexPath) as! EmptyCCell
+                cell.btn_call.isHidden = false
+                cell.label_hint.text = "你还没有购买课程"
 																return cell
 												}else{
 																let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_1_CCell", for: indexPath) as! HomeRelaxBanner_2_1_CCell
@@ -103,6 +105,14 @@
 																return cell
 												}
 								}else{
+             let count = datas?.freeCourseList.count ?? 0
+            if count == 0{
+                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_EmptyCCell", for: indexPath) as! EmptyCCell
+                cell.btn_call.isHidden = true
+                cell.label_hint.text = "暂无推荐"
+                return cell
+            }
+
 												let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_1_CCell", for: indexPath) as! HomeRelaxBanner_2_1_CCell
 												cell.setCourseModel(datas!.freeCourseList[indexPath.row])
             cell.view_price.isHidden = true
@@ -114,12 +124,15 @@
 				}
 
 				func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+
 								if section == 0{
 												let count = datas?.courseList.count ?? 0
 												if count > 0{return count}
 												return 1
 								}else {
-												return datas?.freeCourseList.count ?? 0
+            let count = datas?.freeCourseList.count ?? 0
+            if count > 0{return count}
+												return 1
 								}
 				}
 }
@@ -153,14 +166,21 @@
 
 				func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
 
-								let count = datas?.courseList.count ?? 0
 
-								if indexPath.section == 0 && count == 0{
-												return CGSize(width: JQ_ScreenW, height: 279)
-								}
+        var count = 0
+        if indexPath.section == 0{
+            count = datas?.courseList.count ?? 0
+        }else{
+            count = datas?.freeCourseList.count ?? 0
+        }
 
-								let w = (JQ_ScreenW - 18 * 3) / 2
-								return CGSize(width: w, height: w * 1.319)
+
+        if count == 0{
+            return CGSize(width: JQ_ScreenW, height: 279)
+        }else{
+            let w = (JQ_ScreenW - 18 * 3) / 2
+            return CGSize(width: w, height: w * 1.319)
+        }
 				}
 }
 

--
Gitblit v1.7.1