EstuLogPhotoCell.swift 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //
  2. // EstuLogPhotoCell.swift
  3. // JiaPeiManage
  4. //
  5. // Created by Ning.ge on 2023/8/30.
  6. //
  7. import UIKit
  8. import ReactorKit
  9. import RxSwift
  10. final class EstuLogPhotoCell: BaseCollectionViewCell,View {
  11. let coverImageView = UIImageView().then{
  12. $0.contentMode = .scaleToFill
  13. }
  14. let timeLabel = UILabel().then{
  15. $0.textColor = UIColor.db_fontSelColor
  16. $0.font = NYFont.SysFont.sys_15
  17. $0.text = " 2023-08-24 13:18:07"
  18. $0.textAlignment = .center
  19. }
  20. let titleLabel = UILabel().then{
  21. $0.textColor = UIColor.db_fontSelColor
  22. $0.font = NYFont.SysFont.sys_15
  23. $0.text = "签退照片"
  24. $0.textAlignment = .center
  25. }
  26. var rowInfo:ETeachLogPhotoInfo?
  27. override func initialize() {
  28. let backgroundView = UIView()
  29. backgroundView.backgroundColor = UIColor("#0B2B4D")
  30. self.backgroundColor = UIColor("#0B2B4D")
  31. selectedBackgroundView = backgroundView
  32. coverImageView.image = UIImage(named: "矩形B")
  33. contentView.addSubview(coverImageView)
  34. contentView.addSubview(timeLabel)
  35. contentView.addSubview(titleLabel)
  36. }
  37. func setRowInfo(rowInfo:ETeachLogPhotoInfo){
  38. self.rowInfo = rowInfo
  39. coverImageView.sd_setImage(with:rowInfo.filepath?.urlValue)
  40. timeLabel.text = rowInfo.ptime
  41. titleLabel.text = rowInfo.eventStr
  42. }
  43. func bind(reactor: EstuLogPhotoCellReactor) {
  44. // reactor.state.map{$0.coverURL}
  45. // .bind(to: coverImageView.rx.image(placeholder: .placeholderImage(bgSize:placeholderSize)))
  46. // .disposed(by: disposeBag)
  47. //
  48. // reactor.state.map{$0.title}
  49. // .distinctUntilChanged()
  50. // .bind(to: titleLabel.rx.text)
  51. // .disposed(by: disposeBag)
  52. //
  53. // reactor.state.map{$0.badge}
  54. // .filterNil()
  55. // .distinctUntilChanged()
  56. // .bind(to: badgeButton.rx.title(for: .normal))
  57. // .disposed(by: disposeBag)
  58. //
  59. // reactor.state.map{$0.latestUpdate}
  60. // .distinctUntilChanged()
  61. // .bind(to: latestUpdateLabel.rx.text)
  62. // .disposed(by: disposeBag)
  63. //
  64. // reactor.state.map{$0.tagDesc}
  65. // .filterNil()
  66. // .distinctUntilChanged()
  67. // .bind(to: tagLabel.rx.text)
  68. // .disposed(by: disposeBag)
  69. //
  70. // reactor.state.map{$0.latestUpdateColor}
  71. // .distinctUntilChanged()
  72. // .bind(to: latestUpdateLabel.rx.textColor)
  73. // .disposed(by: disposeBag)
  74. //
  75. // reactor.state.map{$0.badge == nil}
  76. // .distinctUntilChanged()
  77. // .bind(to: badgeButton.rx.isHidden)
  78. // .disposed(by: disposeBag)
  79. //
  80. // reactor.state.map{$0.tagDesc == nil}
  81. // .distinctUntilChanged()
  82. // .bind(to: tagLabel.rx.isHidden)
  83. // .disposed(by: disposeBag)
  84. //
  85. // reactor.state.map{!$0.isRcmd}
  86. // .distinctUntilChanged()
  87. // .bind(to: dramaButton.rx.isHidden)
  88. // .disposed(by: disposeBag)
  89. //
  90. // reactor.state.map{$0.isHiddenLine}
  91. // .distinctUntilChanged()
  92. // .bind(to: bottomLine.rx.isHidden)
  93. // .disposed(by: disposeBag)
  94. //
  95. // reactor.state.map{$0.favourites}
  96. // .filterNil()
  97. // .distinctUntilChanged()
  98. // .bind(to: favouriteLabel.rx.text)
  99. // .disposed(by: disposeBag)
  100. //
  101. // reactor.state.map{$0.watchProgress}
  102. // .filterNil()
  103. // .distinctUntilChanged()
  104. // .bind(to: favouriteLabel.rx.text)
  105. // .disposed(by: disposeBag)
  106. //
  107. //
  108. // dramaButton.rx.tap.subscribe(onNext: {[unowned self] (_) in
  109. //
  110. // self.dramaButton.isSelected = !self.dramaButton.isSelected
  111. // self.dramaButton.backgroundColor = self.dramaButton.isSelected ? UIColor.db_darkGray : UIColor.db_pink
  112. // guard let season_id = reactor.currentState.season_id,
  113. // let season_type = reactor.currentState.season_type
  114. // else { return }
  115. //
  116. // if self.dramaButton.isSelected {
  117. // reactor.action.onNext(.follow(season_id: season_id, season_type: season_type))
  118. // }else{
  119. // reactor.action.onNext(.unFollow(season_id: season_id, season_type: season_type))
  120. // }
  121. // }).disposed(by: disposeBag)
  122. //
  123. }
  124. class func cellSize(reactor:EstuLogPhotoCellReactor) -> CGSize {
  125. // var cellHeight = reactor.currentState.isRcmd ? Metric.coverRcmdHeight : Metric.coverDramaHeight
  126. // cellHeight += 2 * kCollectionItemPadding
  127. //
  128. return CGSize(width: NYFitReal.screenWidth*0.5, height: 172.0)
  129. }
  130. override func layoutSubviews() {
  131. super.layoutSubviews()
  132. coverImageView.snp.makeConstraints { (make) in
  133. make.left.equalTo(kCollectionItemPadding)
  134. make.top.equalTo(10)
  135. make.right.equalTo(-kCollectionItemPadding)
  136. make.height.equalTo(112)
  137. }
  138. timeLabel.snp.makeConstraints { (make) in
  139. make.left.right.equalToSuperview()
  140. make.top.equalTo(coverImageView.snp.bottom).offset(10)
  141. make.height.equalTo(20)
  142. }
  143. titleLabel.snp.makeConstraints { (make) in
  144. make.left.right.equalToSuperview()
  145. make.top.equalTo(timeLabel.snp.bottom)
  146. make.height.equalTo(20)
  147. }
  148. }
  149. }