RQVipContentNewCell.m 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // RQVipContentNewCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/10/12.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQVipContentNewCell.h"
  9. @interface RQVipContentNewCell ()
  10. @property (nonatomic, readwrite, strong) RQVipContentNewItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
  12. @property (weak, nonatomic) IBOutlet UILabel *oneStepLabel;
  13. @property (weak, nonatomic) IBOutlet UILabel *twoStepLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *threeStepLabel;
  15. @property (weak, nonatomic) IBOutlet UIImageView *headerBgImageView;
  16. @end
  17. @implementation RQVipContentNewCell
  18. #pragma mark - PublicMethods
  19. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  20. static NSString *ID = @"RQVipContentNewCell";
  21. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  22. RQVipContentNewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  23. if (!cell) cell = [self rq_viewFromXib];
  24. // [cell borderColor:RQColorFromHexString(@"#E0B279") width:1 cornorRadius:5];
  25. // cell.bgImageView.layer.shadowColor = [UIColor qmui_colorWithHexString:@"#D8928B"].CGColor;
  26. return cell;
  27. }
  28. - (void)bindViewModel:(RQVipContentNewItemViewModel *)viewModel {
  29. // @weakify(self)
  30. _viewModel = viewModel;
  31. if ([viewModel.typeModel.dictLabel containsString:@"一"] && [viewModel.typeModel.dictLabel containsString:@"四"]) {
  32. self.myTitleLabel.text = @"科一科四怎么学";
  33. self.mySubTitleLabel.text = @"只需三步,轻松学科一科四";
  34. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  35. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  36. } else if ([viewModel.typeModel.dictLabel containsString:@"一"] && ![viewModel.typeModel.dictLabel containsString:@"四"]) {
  37. self.myTitleLabel.text = @"科一怎么学";
  38. self.mySubTitleLabel.text = @"只需三步,轻松学科一";
  39. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  40. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  41. } else if ([viewModel.typeModel.dictLabel containsString:@"四"] && ![viewModel.typeModel.dictLabel containsString:@"一"]) {
  42. self.myTitleLabel.text = @"科四怎么学";
  43. self.mySubTitleLabel.text = @"只需三步,轻松学科四";
  44. self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
  45. self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
  46. } else if ([viewModel.typeModel.dictLabel containsString:@"全"]) {
  47. if (viewModel.isSubjectFour) {
  48. self.myTitleLabel.text = @"科四怎么学";
  49. self.mySubTitleLabel.text = @"只需三步,轻松学科四";
  50. self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
  51. self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
  52. } else {
  53. self.myTitleLabel.text = @"科一怎么学";
  54. self.mySubTitleLabel.text = @"只需三步,轻松学科一";
  55. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  56. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  57. }
  58. }
  59. }
  60. - (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows {
  61. // self.backgroundColor = RQColorFromHexString(@"#252531");
  62. }
  63. #pragma mark - SystemMethods
  64. - (void)awakeFromNib {
  65. [super awakeFromNib];
  66. self.oneStepLabel.backgroundColor = [UIColor rq_colorGradientChangeWithFrame:CGRectMake(0, 0, RQ_FIT_HORIZONTAL(69.f), RQ_FIT_HORIZONTAL(25.f)) startPoint:CGPointMake(0.98, 0.5) endPoint:CGPointMake(0, 0.5) startColor:RQColorFromHexString(@"#F97467") endColor:RQColorFromHexString(@"#F9A192")];
  67. [self.oneStepLabel updateCornerRadius:^(QQCorner *corner) {
  68. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  69. }];
  70. self.twoStepLabel.backgroundColor = [UIColor rq_colorGradientChangeWithFrame:CGRectMake(0, 0, RQ_FIT_HORIZONTAL(69.f), RQ_FIT_HORIZONTAL(25.f)) startPoint:CGPointMake(0.98, 0.5) endPoint:CGPointMake(0, 0.5) startColor:RQColorFromHexString(@"#F97467") endColor:RQColorFromHexString(@"#F9A192")];
  71. [self.twoStepLabel updateCornerRadius:^(QQCorner *corner) {
  72. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  73. }];
  74. self.threeStepLabel.backgroundColor = [UIColor rq_colorGradientChangeWithFrame:CGRectMake(0, 0, RQ_FIT_HORIZONTAL(69.f), RQ_FIT_HORIZONTAL(25.f)) startPoint:CGPointMake(0.98, 0.5) endPoint:CGPointMake(0, 0.5) startColor:RQColorFromHexString(@"#F97467") endColor:RQColorFromHexString(@"#F9A192")];
  75. [self.threeStepLabel updateCornerRadius:^(QQCorner *corner) {
  76. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  77. }];
  78. }
  79. #pragma mark - PrivateMethods
  80. @end