杨锴
2024-11-06 63f7ed967433acee3ae8764c7a077e15c29c41f2
XQMuse/Root/Course/VC/CourseMenuVC.swift
@@ -7,6 +7,7 @@
import UIKit
import JQTools
import EmptyDataSet_Swift
class CourseMenuVC: BaseVC {
@@ -56,6 +57,15 @@
                                    make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(18)
                                    make.bottom.equalTo(tableView)
                        }
        collectionView.emptyDataSetSource = self
        collectionView.emptyDataSetDelegate = self
//        collectionView.emptyDataSetView { v in
//            let v = UIView()
//            v.backgroundColor = .red
//
//            return
//        }
            }
            func setTitleItem(_ items:[TitleItem],defaultSelectIndex:Int = 0){
@@ -95,8 +105,14 @@
            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{
            let vc = CourseDetialVC(courseId: model.id)
            push(vc: vc)
        }else{
            let vc = CourseDetialOfflineVC(courseId: model.id)
            push(vc: vc)
        }
            }
            func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
@@ -124,3 +140,25 @@
                        return CGSize(width: w, height: w * 1.313)
            }
}
extension CourseMenuVC:EmptyDataSetSource{
    func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
        return UIImage(named: "icon_empty")
    }
    func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
        return AttributedStringbuilder.build().add(string: "暂无数据", withFont: .systemFont(ofSize: 12, weight: .medium), withColor: .gray).mutableAttributedString
    }
    func verticalOffset(forEmptyDataSet scrollView: UIScrollView) -> CGFloat {
        return 300
    }
    func spaceHeight(forEmptyDataSet scrollView: UIScrollView) -> CGFloat {
        return 200
    }
}
extension CourseMenuVC:EmptyDataSetDelegate{
}