EstuLogPhotoCell.swift 5.1 KB

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