RQVipContentNewCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. @property (weak, nonatomic) IBOutlet UIImageView *jxbj_imageview;
  17. @property (weak, nonatomic) IBOutlet UILabel *jx_titlelabel;
  18. @end
  19. @implementation RQVipContentNewCell
  20. #pragma mark - PublicMethods
  21. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  22. static NSString *ID = @"RQVipContentNewCell";
  23. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  24. RQVipContentNewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  25. if (!cell) cell = [self rq_viewFromXib];
  26. // [cell borderColor:RQColorFromHexString(@"#E0B279") width:1 cornorRadius:5];
  27. // cell.bgImageView.layer.shadowColor = [UIColor qmui_colorWithHexString:@"#D8928B"].CGColor;
  28. return cell;
  29. }
  30. - (void)bindViewModel:(RQVipContentNewItemViewModel *)viewModel {
  31. // @weakify(self)
  32. _viewModel = viewModel;
  33. if ([viewModel.typeModel.dictLabel containsString:@"一"] && [viewModel.typeModel.dictLabel containsString:@"四"]) {
  34. self.myTitleLabel.text = @"科一科四怎么学";
  35. self.mySubTitleLabel.text = @"只需三步,轻松学科一科四";
  36. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  37. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  38. } else if ([viewModel.typeModel.dictLabel containsString:@"一"] && ![viewModel.typeModel.dictLabel containsString:@"四"]) {
  39. self.myTitleLabel.text = @"科一怎么学";
  40. self.mySubTitleLabel.text = @"只需三步,轻松学科一";
  41. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  42. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  43. } else if ([viewModel.typeModel.dictLabel containsString:@"四"] && ![viewModel.typeModel.dictLabel containsString:@"一"]) {
  44. self.myTitleLabel.text = @"科四怎么学";
  45. self.mySubTitleLabel.text = @"只需三步,轻松学科四";
  46. self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
  47. self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
  48. self.jxbj_imageview.image = RQImageNamed(@"精选300题背景");
  49. self.jx_titlelabel.text = @"精简300题";
  50. } else if ([viewModel.typeModel.dictLabel containsString:@"全"]) {
  51. if (viewModel.isSubjectFour) {
  52. self.myTitleLabel.text = @"科四怎么学";
  53. self.mySubTitleLabel.text = @"只需三步,轻松学科四";
  54. self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
  55. self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
  56. self.jxbj_imageview.image = RQImageNamed(@"精选300题背景");
  57. self.jx_titlelabel.text = @"精简300题";
  58. } else {
  59. self.myTitleLabel.text = @"科一怎么学";
  60. self.mySubTitleLabel.text = @"只需三步,轻松学科一";
  61. self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
  62. self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
  63. }
  64. }
  65. }
  66. - (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows {
  67. // self.backgroundColor = RQColorFromHexString(@"#252531");
  68. }
  69. #pragma mark - SystemMethods
  70. - (void)awakeFromNib {
  71. [super awakeFromNib];
  72. 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")];
  73. [self.oneStepLabel updateCornerRadius:^(QQCorner *corner) {
  74. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  75. }];
  76. 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")];
  77. [self.twoStepLabel updateCornerRadius:^(QQCorner *corner) {
  78. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  79. }];
  80. 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")];
  81. [self.threeStepLabel updateCornerRadius:^(QQCorner *corner) {
  82. corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
  83. }];
  84. }
  85. #pragma mark - PrivateMethods
  86. @end