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. // reactor.state.map{$0.title}
  48. // .distinctUntilChanged()
  49. // .bind(to: titleLabel.rx.text)
  50. // .disposed(by: disposeBag)
  51. //
  52. // reactor.state.map{$0.badge}
  53. // .filterNil()
  54. // .distinctUntilChanged()
  55. // .bind(to: badgeButton.rx.title(for: .normal))
  56. // .disposed(by: disposeBag)
  57. //
  58. // reactor.state.map{$0.latestUpdate}
  59. // .distinctUntilChanged()
  60. // .bind(to: latestUpdateLabel.rx.text)
  61. // .disposed(by: disposeBag)
  62. //
  63. // reactor.state.map{$0.tagDesc}
  64. // .filterNil()
  65. // .distinctUntilChanged()
  66. // .bind(to: tagLabel.rx.text)
  67. // .disposed(by: disposeBag)
  68. //
  69. // reactor.state.map{$0.latestUpdateColor}
  70. // .distinctUntilChanged()
  71. // .bind(to: latestUpdateLabel.rx.textColor)
  72. // .disposed(by: disposeBag)
  73. //
  74. // reactor.state.map{$0.badge == nil}
  75. // .distinctUntilChanged()
  76. // .bind(to: badgeButton.rx.isHidden)
  77. // .disposed(by: disposeBag)
  78. //
  79. // reactor.state.map{$0.tagDesc == nil}
  80. // .distinctUntilChanged()
  81. // .bind(to: tagLabel.rx.isHidden)
  82. // .disposed(by: disposeBag)
  83. //
  84. // reactor.state.map{!$0.isRcmd}
  85. // .distinctUntilChanged()
  86. // .bind(to: dramaButton.rx.isHidden)
  87. // .disposed(by: disposeBag)
  88. //
  89. // reactor.state.map{$0.isHiddenLine}
  90. // .distinctUntilChanged()
  91. // .bind(to: bottomLine.rx.isHidden)
  92. // .disposed(by: disposeBag)
  93. //
  94. // reactor.state.map{$0.favourites}
  95. // .filterNil()
  96. // .distinctUntilChanged()
  97. // .bind(to: favouriteLabel.rx.text)
  98. // .disposed(by: disposeBag)
  99. //
  100. // reactor.state.map{$0.watchProgress}
  101. // .filterNil()
  102. // .distinctUntilChanged()
  103. // .bind(to: favouriteLabel.rx.text)
  104. // .disposed(by: disposeBag)
  105. //
  106. //
  107. // dramaButton.rx.tap.subscribe(onNext: {[unowned self] (_) in
  108. //
  109. // self.dramaButton.isSelected = !self.dramaButton.isSelected
  110. // self.dramaButton.backgroundColor = self.dramaButton.isSelected ? UIColor.db_darkGray : UIColor.db_pink
  111. // guard let season_id = reactor.currentState.season_id,
  112. // let season_type = reactor.currentState.season_type
  113. // else { return }
  114. //
  115. // if self.dramaButton.isSelected {
  116. // reactor.action.onNext(.follow(season_id: season_id, season_type: season_type))
  117. // }else{
  118. // reactor.action.onNext(.unFollow(season_id: season_id, season_type: season_type))
  119. // }
  120. // }).disposed(by: disposeBag)
  121. //
  122. }
  123. class func cellSize(reactor:EstuLogPhotoCellReactor) -> CGSize {
  124. // var cellHeight = reactor.currentState.isRcmd ? Metric.coverRcmdHeight : Metric.coverDramaHeight
  125. // cellHeight += 2 * kCollectionItemPadding
  126. //
  127. return CGSize(width: NYFitReal.screenWidth*0.5, height: 172.0)
  128. }
  129. override func layoutSubviews() {
  130. super.layoutSubviews()
  131. coverImageView.snp.makeConstraints { (make) in
  132. make.left.equalTo(kCollectionItemPadding)
  133. make.top.equalTo(10)
  134. make.right.equalTo(-kCollectionItemPadding)
  135. make.height.equalTo(112)
  136. }
  137. timeLabel.snp.makeConstraints { (make) in
  138. make.left.right.equalToSuperview()
  139. make.top.equalTo(coverImageView.snp.bottom).offset(10)
  140. make.height.equalTo(20)
  141. }
  142. titleLabel.snp.makeConstraints { (make) in
  143. make.left.right.equalToSuperview()
  144. make.top.equalTo(timeLabel.snp.bottom)
  145. make.height.equalTo(20)
  146. }
  147. }
  148. }