EstuLogPhotoListViewController.swift 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. //
  2. // EstuLogPhotoListViewController.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/8/30.
  6. //
  7. import UIKit
  8. import RxSwift
  9. import RxCocoa
  10. import ReusableKit
  11. import Dollar
  12. final class EstuLogPhotoListViewController: BaseCollectionViewController {
  13. let cellIdentifier:String = "_EstuLogListCell"
  14. // MARK: 服务属性
  15. private let cocahService: CoachServiceType = CoachService(networking: CoachNetworking())
  16. private struct Reusable {
  17. static let ephotoCell = ReusableCell<EstuLogPhotoCell>()
  18. static let headerView = ReusableView<EstuLogPhotoHeaderView>()
  19. }
  20. // MARK: UI let
  21. let statusBar = UIView().then {
  22. $0.backgroundColor = UIColor.db_theme
  23. }
  24. let navBar = MeTraineeNavBar.loadFromNib().then {
  25. $0.search_button.isHidden = true
  26. }
  27. let estuLogHeaderView = EstuLogHeaderView.loadFromNib()
  28. var selectPath = -1;
  29. override func setupConstraints() {
  30. statusBar.snp.makeConstraints { (make) in
  31. make.left.right.top.equalToSuperview()
  32. make.height.equalTo(Metric.statusBarHeight)
  33. }
  34. navBar.snp.remakeConstraints { (make) in
  35. make.left.right.equalToSuperview()
  36. make.height.equalTo(Metric.navBarHeight)
  37. make.top.equalTo(statusBar.snp.bottom)
  38. }
  39. collectionView.snp.remakeConstraints { make in
  40. make.top.equalTo(self.navBar.snp.bottom)
  41. make.left.right.bottom.equalTo(self.view)
  42. }
  43. self.loadViewIfNeeded()
  44. }
  45. // MARK: StatusBar
  46. override func viewWillAppear(_ animated: Bool) {
  47. super.viewWillAppear(animated)
  48. self.navigationController?.setNavigationBarHidden(true, animated: true)
  49. }
  50. init(type:TraineeType) {
  51. super.init()
  52. navBar.title_label.text = "电子教学日志"
  53. }
  54. required convenience init?(coder aDecoder: NSCoder) {
  55. fatalError("init(coder:) has not been implemented")
  56. }
  57. override func viewDidLoad() {
  58. super.viewDidLoad()
  59. configureMagicController()
  60. setupUI()
  61. biandView()
  62. }
  63. // MARK: 私有方法
  64. func setupUI(){
  65. self.navBar.back_button.addTarget(self, action: #selector(actionBackdo), for: .touchUpInside)
  66. }
  67. func configureMagicController(){
  68. self.view.addSubview(navBar)
  69. self.view.addSubview(statusBar)
  70. }
  71. func biandView(){
  72. collectionView.backgroundColor = UIColor.db_theme
  73. // collectionView.frame = self.view.bounds
  74. collectionView.register(Reusable.ephotoCell)
  75. collectionView.register(Reusable.headerView, kind: UICollectionView.elementKindSectionHeader)
  76. collectionView.delegate = self
  77. collectionView.dataSource = self
  78. self.isEmptyDisplay = false
  79. self.hideLoadAnimation()
  80. // if !isRcmd {
  81. //
  82. // setupRefreshHeader(collectionView,.rabbit) {[unowned self] in
  83. // self.netRequest()
  84. // }
  85. //
  86. // self.autoSetRefreshStatus(header: collectionView.header).disposed(by: disposeBag)
  87. // }
  88. //
  89. // netRequest()
  90. }
  91. }
  92. extension EstuLogPhotoListViewController: UICollectionViewDataSource {
  93. func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
  94. return 10 //self.datasources.count
  95. }
  96. func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
  97. let cell = collectionView.dequeue(Reusable.ephotoCell, for: indexPath)
  98. // cell.reactor = datasources[indexPath.item]
  99. return cell
  100. }
  101. func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
  102. collectionView.deselectItem(at: indexPath, animated: true)
  103. }
  104. // Provide header view for each section
  105. func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
  106. let headerView = collectionView.dequeue(Reusable.headerView, kind: kind, for: indexPath)
  107. // (ofKind: kind, withReuseIdentifier: Reusable.headerView, for: indexPath)
  108. return headerView
  109. }
  110. }
  111. extension EstuLogPhotoListViewController: UICollectionViewDelegateFlowLayout {
  112. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
  113. // let cellReactor = datasources[indexPath.item]
  114. return CGSize(width: NYFitReal.screenWidth*0.5, height: 172) //Reusable.rcmdCell.class.cellSize(reactor: cellReactor)
  115. }
  116. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
  117. return UIEdgeInsets.zero
  118. }
  119. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
  120. return 0.f
  121. }
  122. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
  123. return 0.f
  124. }
  125. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
  126. return CGSize(width: NYFitReal.screenWidth, height: 99.f) //branchSectionDelegate.headerSize(collectionView: collectionView,section: dataSource[section])
  127. }
  128. }