RQVipAuthoritySmallCell.m 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // RQVipAuthoritySmallCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/3/1.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQVipAuthoritySmallCell.h"
  9. @interface RQVipAuthoritySmallCell ()
  10. @property (nonatomic, readwrite, strong) RQVipAuthoritySmallItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIStackView *adView;
  12. @end
  13. @implementation RQVipAuthoritySmallCell
  14. #pragma mark - PublicMethods
  15. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  16. static NSString *ID = @"RQVipAuthoritySmallCell";
  17. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  18. RQVipAuthoritySmallCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  19. if (!cell) cell = [self rq_viewFromXib];
  20. return cell;
  21. }
  22. - (void)bindViewModel:(RQVipAuthoritySmallItemViewModel *)viewModel {
  23. // @weakify(self)
  24. _viewModel = viewModel;
  25. if ([viewModel.typeModel.remark containsString:@"1"]) {
  26. self.adView.hidden = NO;
  27. self.oneIconImageView.image = RQImageNamed(@"科目一永久");
  28. self.oneTitleLabel.text = @"科一专项VIP";
  29. self.twoIconImageView.image = RQImageNamed(@"科目二永久");
  30. self.twoTitleLabel.text = @"科二专项VIP";
  31. self.threeIconImageView.image = RQImageNamed(@"科目三永久");
  32. self.threeTitleLabel.text = @"科三专项VIP";
  33. self.fourIconImageView.image = RQImageNamed(@"科目四永久");
  34. self.fourTitleLabel.text = @"科四专项VIP";
  35. } else {
  36. self.adView.hidden = YES;
  37. if ([viewModel.typeModel.dictLabel containsString:@"一"] || [viewModel.typeModel.dictLabel containsString:@"四"]) {
  38. self.oneIconImageView.image = RQImageNamed(@"精选500题-Alert");
  39. self.oneTitleLabel.text = @"精选500题";
  40. self.twoIconImageView.image = RQImageNamed(@"真实考试模拟-Alert");
  41. self.twoTitleLabel.text = @"真实考试模拟";
  42. self.threeIconImageView.image = RQImageNamed(@"冲刺考前券-Alert");
  43. self.threeTitleLabel.text = @"冲刺考前卷";
  44. self.fourIconImageView.image = RQImageNamed(@"去广告-Alert");
  45. self.fourTitleLabel.text = @"去广告";
  46. } else {
  47. self.oneIconImageView.image = RQImageNamed(@"考试项目讲解-Alert");
  48. self.oneTitleLabel.text = @"考试项目讲解";
  49. self.twoIconImageView.image = RQImageNamed(@"考试点位讲解-Alert");
  50. self.twoTitleLabel.text = @"考试点位讲解";
  51. self.threeIconImageView.image = RQImageNamed(@"基础操作讲解-Alert");
  52. self.threeTitleLabel.text = @"基础操作讲解";
  53. self.fourIconImageView.image = RQImageNamed(@"去广告-Alert");
  54. self.fourTitleLabel.text = @"去广告";
  55. }
  56. }
  57. }
  58. - (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows {
  59. self.backgroundColor = UIColor.clearColor;
  60. }
  61. #pragma mark - SystemMethods
  62. - (void)awakeFromNib {
  63. [super awakeFromNib];
  64. }
  65. #pragma mark - PrivateMethods
  66. @end