From 09a372bc45fde16fd42257ab6f78b8deeecf720b Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期三, 16 四月 2025 16:38:05 +0800
Subject: [PATCH] fix bug

---
 XQMuse/Root/Course/VC/CourseMenuVC.swift |   69 +++++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/XQMuse/Root/Course/VC/CourseMenuVC.swift b/XQMuse/Root/Course/VC/CourseMenuVC.swift
index 3d992ff..3c06e1e 100644
--- a/XQMuse/Root/Course/VC/CourseMenuVC.swift
+++ b/XQMuse/Root/Course/VC/CourseMenuVC.swift
@@ -7,6 +7,7 @@
 
 import UIKit
 import JQTools
+import EmptyDataSet_Swift
 
 class CourseMenuVC: BaseVC {
 
@@ -56,6 +57,38 @@
 												make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(18)
 												make.bottom.equalTo(tableView)
 								}
+
+        collectionView.emptyDataSetSource = self
+        collectionView.emptyDataSetDelegate = self
+        collectionView.emptyDataSetView { v in
+
+            if let sub = v.viewWithTag(10010){
+
+
+            }else{
+                let v1 = UIView()
+                v1.tag = 10010
+                v1.bounds = CGRect(x: 0, y: 0, width: 100, height: 100)
+                v1.center = CGPoint(x: v.center.x - 20, y: v.center.y - 150)
+                v.addSubview(v1)
+
+                let image = UIImageView(image: UIImage(named: "bg_empty"))
+                image.contentMode = .scaleAspectFill
+                v1.addSubview(image)
+                image.snp.makeConstraints { make in
+                    make.top.left.right.equalToSuperview()
+                }
+
+                let label = UILabel(text: "暂未找到相关内容哦~")
+                label.font = .systemFont(ofSize: 14, weight: .medium)
+                label.textColor = .gray
+                v1.addSubview(label)
+                label.snp.makeConstraints { make in
+                    make.centerX.equalTo(image)
+                    make.top.equalTo(image.snp.bottom).offset(8)
+                }
+            }
+        }
 				}
 
 				func setTitleItem(_ items:[TitleItem],defaultSelectIndex:Int = 0){
@@ -95,14 +128,36 @@
 
 				func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
 								let model = viewModel.dataSource.value!.list[indexPath.row]
-								let vc = CourseDetialVC(courseId: model.id)
-								push(vc: vc)
+
+        if model.courseType == .online{
+
+            if model.chargeType == .payment || model.chargeType == .vipFree{
+                guard sceneDelegate!.checkisLoginState() else {return}
+            }
+
+            Services.getCourseDetail(courseId: model.id).subscribe(onNext: {data in
+                if let m = data.data{
+                    if m.isVip == .no && m.chargeType == .vipFree{
+                         let vc = VIPCenterVC()
+                        self.push(vc: vc)
+                    }else if m.courseType == .online{
+                        let vc = CourseDetialVC(courseModel: m)
+                        self.push(vc: vc)
+                    }else{
+                        let vc = CourseDetialOfflineVC(courseId: m.id)
+                        self.push(vc: vc)
+                    }
+                }
+            }).disposed(by: disposeBag)
+        }else{
+            let vc = CourseDetialOfflineVC(courseId: model.id)
+            push(vc: vc)
+        }
 				}
 
 				func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
 								let model = viewModel.dataSource.value!.list[indexPath.row]
 								let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_HomeRelaxBanner_2_1_CCell", for: indexPath) as! HomeRelaxBanner_2_1_CCell
-								cell.backgroundColor = .jq_randomColor
 								cell.setCourseModel(model)
 								return cell
 				}
@@ -125,3 +180,11 @@
 								return CGSize(width: w, height: w * 1.313)
 				}
 }
+
+extension CourseMenuVC:EmptyDataSetSource{
+
+}
+
+extension CourseMenuVC:EmptyDataSetDelegate{
+
+}

--
Gitblit v1.7.1