// // EstuLogPhotoListViewController.swift // JiaPeiManage // // Created by Ning.ge on 2023/8/30. // import UIKit import RxSwift import RxCocoa import ReusableKit import Dollar final class EstuLogPhotoListViewController: BaseCollectionViewController { let cellIdentifier:String = "_EstuLogListCell" // MARK: 服务属性 private let cocahService: CoachServiceType = CoachService(networking: CoachNetworking()) private struct Reusable { static let ephotoCell = ReusableCell() static let headerView = ReusableView() } // MARK: UI let let statusBar = UIView().then { $0.backgroundColor = UIColor.db_theme } let navBar = MeTraineeNavBar.loadFromNib().then { $0.search_button.isHidden = true } let estuLogHeaderView = EstuLogHeaderView.loadFromNib() var selectPath = -1; override func setupConstraints() { statusBar.snp.makeConstraints { (make) in make.left.right.top.equalToSuperview() make.height.equalTo(Metric.statusBarHeight) } navBar.snp.remakeConstraints { (make) in make.left.right.equalToSuperview() make.height.equalTo(Metric.navBarHeight) make.top.equalTo(statusBar.snp.bottom) } collectionView.snp.remakeConstraints { make in make.top.equalTo(self.navBar.snp.bottom) make.left.right.bottom.equalTo(self.view) } self.loadViewIfNeeded() } // MARK: StatusBar override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.navigationController?.setNavigationBarHidden(true, animated: true) } init(type:TraineeType) { super.init() navBar.title_label.text = "电子教学日志" } required convenience init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() configureMagicController() setupUI() biandView() } // MARK: 私有方法 func setupUI(){ self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside) } func configureMagicController(){ self.view.addSubview(navBar) self.view.addSubview(statusBar) } func biandView(){ collectionView.backgroundColor = UIColor.db_theme // collectionView.frame = self.view.bounds collectionView.register(Reusable.ephotoCell) collectionView.register(Reusable.headerView, kind: UICollectionView.elementKindSectionHeader) collectionView.delegate = self collectionView.dataSource = self self.isEmptyDisplay = false self.hideLoadAnimation() // if !isRcmd { // // setupRefreshHeader(collectionView,.rabbit) {[unowned self] in // self.netRequest() // } // // self.autoSetRefreshStatus(header: collectionView.header).disposed(by: disposeBag) // } // // netRequest() } } extension EstuLogPhotoListViewController: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 10 //self.datasources.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeue(Reusable.ephotoCell, for: indexPath) // cell.reactor = datasources[indexPath.item] return cell } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { collectionView.deselectItem(at: indexPath, animated: true) } // Provide header view for each section func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { let headerView = collectionView.dequeue(Reusable.headerView, kind: kind, for: indexPath) // (ofKind: kind, withReuseIdentifier: Reusable.headerView, for: indexPath) return headerView } } extension EstuLogPhotoListViewController: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { // let cellReactor = datasources[indexPath.item] return CGSize(width: NYFitReal.screenWidth*0.5, height: 172) //Reusable.rcmdCell.class.cellSize(reactor: cellReactor) } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { return UIEdgeInsets.zero } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { return 0.f } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { return 0.f } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSize(width: NYFitReal.screenWidth, height: 99.f) //branchSectionDelegate.headerSize(collectionView: collectionView,section: dataSource[section]) } }