From 63f7ed967433acee3ae8764c7a077e15c29c41f2 Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期三, 06 十一月 2024 21:17:19 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/Course/VC/CourseMenuVC.swift | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 40 insertions(+), 2 deletions(-) diff --git a/XQMuse/Root/Course/VC/CourseMenuVC.swift b/XQMuse/Root/Course/VC/CourseMenuVC.swift index 65b7fcc..56a2a8d 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,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{ + +} -- Gitblit v1.7.1