123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // RQVipContentNewCell.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/10/12.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQVipContentNewCell.h"
- @interface RQVipContentNewCell ()
- @property (nonatomic, readwrite, strong) RQVipContentNewItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIImageView *bgImageView;
- @property (weak, nonatomic) IBOutlet UILabel *oneStepLabel;
- @property (weak, nonatomic) IBOutlet UILabel *twoStepLabel;
- @property (weak, nonatomic) IBOutlet UILabel *threeStepLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *headerBgImageView;
- @property (weak, nonatomic) IBOutlet UIImageView *jxbj_imageview;
- @property (weak, nonatomic) IBOutlet UILabel *jx_titlelabel;
- @end
- @implementation RQVipContentNewCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
- static NSString *ID = @"RQVipContentNewCell";
- [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
- RQVipContentNewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
- if (!cell) cell = [self rq_viewFromXib];
- // [cell borderColor:RQColorFromHexString(@"#E0B279") width:1 cornorRadius:5];
- // cell.bgImageView.layer.shadowColor = [UIColor qmui_colorWithHexString:@"#D8928B"].CGColor;
- return cell;
- }
- - (void)bindViewModel:(RQVipContentNewItemViewModel *)viewModel {
- // @weakify(self)
- _viewModel = viewModel;
- if ([viewModel.typeModel.dictLabel containsString:@"一"] && [viewModel.typeModel.dictLabel containsString:@"四"]) {
- self.myTitleLabel.text = @"科一科四怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科一科四";
- self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
- self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
- } else if ([viewModel.typeModel.dictLabel containsString:@"一"] && ![viewModel.typeModel.dictLabel containsString:@"四"]) {
- self.myTitleLabel.text = @"科一怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科一";
- self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
- self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
- } else if ([viewModel.typeModel.dictLabel containsString:@"四"] && ![viewModel.typeModel.dictLabel containsString:@"一"]) {
- self.myTitleLabel.text = @"科四怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科四";
- self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
- self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
- self.jxbj_imageview.image = RQImageNamed(@"精选300题背景");
- self.jx_titlelabel.text = @"精简300题";
- } else if ([viewModel.typeModel.dictLabel containsString:@"全"]) {
- if (viewModel.isSubjectFour) {
- self.myTitleLabel.text = @"科四怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科四";
- self.headerBgImageView.image = RQImageNamed(@"科四怎么学");
- self.bgImageView.image = RQImageNamed(@"科四怎么学背景");
- self.jxbj_imageview.image = RQImageNamed(@"精选300题背景");
- self.jx_titlelabel.text = @"精简300题";
- } else {
- self.myTitleLabel.text = @"科一怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科一";
- self.headerBgImageView.image = RQImageNamed(@"科一怎么学");
- self.bgImageView.image = RQImageNamed(@"科一怎么学背景");
- }
- }
- }
- - (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows {
- // self.backgroundColor = RQColorFromHexString(@"#252531");
- }
- #pragma mark - SystemMethods
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- 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")];
- [self.oneStepLabel updateCornerRadius:^(QQCorner *corner) {
- corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
- }];
-
- 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")];
- [self.twoStepLabel updateCornerRadius:^(QQCorner *corner) {
- corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
- }];
-
- 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")];
- [self.threeStepLabel updateCornerRadius:^(QQCorner *corner) {
- corner.radius = QQRadiusMake(0.f, 25 / 2.f, 0.f, 25 / 2.f);
- }];
-
-
- }
- #pragma mark - PrivateMethods
- @end
|