123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- //
- // RQVipContentCell.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/3/1.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQVipContentCell.h"
- @interface RQVipContentCell ()
- @property (nonatomic, readwrite, strong) RQVipContentItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIImageView *leftHeaderIcon;
- @property (weak, nonatomic) IBOutlet UIImageView *rightHederIcon;
- @property (weak, nonatomic) IBOutlet UILabel *oneStepLabel;
- @property (weak, nonatomic) IBOutlet UILabel *twoStepLabel;
- @property (weak, nonatomic) IBOutlet UILabel *threeStepLabel;
- @property (weak, nonatomic) IBOutlet UILabel *oneTitleLabel;
- @property (weak, nonatomic) IBOutlet UILabel *oneContent1Label;
- @property (weak, nonatomic) IBOutlet UILabel *oneContent2Label;
- @property (weak, nonatomic) IBOutlet UILabel *twoTitleLabel;
- @property (weak, nonatomic) IBOutlet UILabel *twoContent1Label;
- @property (weak, nonatomic) IBOutlet UILabel *twoContent2Label;
- @property (weak, nonatomic) IBOutlet UILabel *threeTitleLabel;
- @property (weak, nonatomic) IBOutlet UILabel *threeContentLabel;
- @property (weak, nonatomic) IBOutlet UILabel *threeContent2Label;
- @property (weak, nonatomic) IBOutlet UIStackView *jingxuan500View;
- @property (weak, nonatomic) IBOutlet UIStackView *zhenshimoniView;
- @property (weak, nonatomic) IBOutlet UIStackView *chongcijuanView;
- @end
- @implementation RQVipContentCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
- static NSString *ID = @"RQVipContentCell";
- [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
- RQVipContentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
- if (!cell) cell = [self rq_viewFromXib];
- [cell borderColor:RQColorFromHexString(@"#E0B279") width:1 cornorRadius:5];
-
- return cell;
- }
- - (void)bindViewModel:(RQVipContentItemViewModel *)viewModel {
- // @weakify(self)
- _viewModel = viewModel;
- if (viewModel.isCenter) {
- self.leftHeaderIcon.image = RQImageNamed(@"标题左3");
- self.rightHederIcon.image = RQImageNamed(@"标题右3");
- self.backgroundColor = RQColorFromHexString(@"#FFFAF5");
- self.oneTitleLabel.textColor = RQColorFromHexString(@"#0A1A33");
- self.oneContent1Label.textColor = RQColorFromHexString(@"#8A9099");
- self.oneContent2Label.textColor = RQColorFromHexString(@"#8A9099");
- self.twoTitleLabel.textColor = RQColorFromHexString(@"#0A1A33");
- self.twoContent1Label.textColor = RQColorFromHexString(@"#8A9099");
- self.twoContent2Label.textColor = RQColorFromHexString(@"#8A9099");
- self.threeTitleLabel.textColor = RQColorFromHexString(@"#0A1A33");
- self.threeContentLabel.textColor = RQColorFromHexString(@"#8A9099");
- self.threeContent2Label.textColor = RQColorFromHexString(@"#8A9099");
- if (viewModel.homePageSubjectType == RQHomePageSubjectType_SubjectOne) {
- self.myTitleLabel.text = @"科一怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科一";
- } else if (viewModel.homePageSubjectType == RQHomePageSubjectType_SubjectFour) {
- self.myTitleLabel.text = @"科四怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科四";
- }
- } else {
- self.leftHeaderIcon.image = RQImageNamed(@"标题左2");
- self.rightHederIcon.image = RQImageNamed(@"标题右2");
- self.backgroundColor = RQColorFromHexString(@"#252531");
- self.oneTitleLabel.textColor = RQColorFromHexString(@"#DEA461");
- self.oneContent1Label.textColor = RQColorFromHexString(@"#F8DEB8");
- self.oneContent2Label.textColor = RQColorFromHexString(@"#F8DEB8");
- self.twoTitleLabel.textColor = RQColorFromHexString(@"#DEA461");
- self.twoContent1Label.textColor = RQColorFromHexString(@"#F8DEB8");
- self.twoContent2Label.textColor = RQColorFromHexString(@"#F8DEB8");
- self.threeTitleLabel.textColor = RQColorFromHexString(@"#DEA461");
- self.threeContentLabel.textColor = RQColorFromHexString(@"#F8DEB8");
- self.threeContent2Label.textColor = RQColorFromHexString(@"#F8DEB8");
- if ([viewModel.typeModel.dictLabel containsString:@"一"]) {
- self.myTitleLabel.text = @"科一怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科一";
- } else if ([viewModel.typeModel.dictLabel containsString:@"四"]) {
- self.myTitleLabel.text = @"科四怎么学";
- self.mySubTitleLabel.text = @"只需三步,轻松学科四";
- }
- }
-
-
- }
- - (void)setIndexPath:(NSIndexPath *)indexPath rowsInSection:(NSInteger)rows {
- self.backgroundColor = self.viewModel.isCenter? RQColorFromHexString(@"#FFFAF5") : RQColorFromHexString(@"#252531");
- }
- #pragma mark - SystemMethods
- - (void)awakeFromNib {
- [super awakeFromNib];
- CGFloat width = (69.f / 375.f) * (RQ_SCREEN_WIDTH - 32.f);
- CGFloat height = (25.f / 375.f) * (RQ_SCREEN_WIDTH - 32.f);
- CGFloat corner = height / 2.f;
-
- self.oneStepLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage qmui_imageWithGradientColors:@[RQColorFromHexString(@"#DBA05C"),RQColorFromHexString(@"#F3C085")] type:QMUIImageGradientTypeTopLeftToBottomRight locations:nil size:CGSizeMake(width, height) cornerRadiusArray:@[@0,@0,[NSNumber numberWithFloat:corner],[NSNumber numberWithFloat:corner]]]];
-
- self.twoStepLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage qmui_imageWithGradientColors:@[RQColorFromHexString(@"#DBA05C"),RQColorFromHexString(@"#F3C085")] type:QMUIImageGradientTypeTopLeftToBottomRight locations:nil size:CGSizeMake(width, height) cornerRadiusArray:@[@0,@0,[NSNumber numberWithFloat:corner],[NSNumber numberWithFloat:corner]]]];
- self.threeStepLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage qmui_imageWithGradientColors:@[RQColorFromHexString(@"#DBA05C"),RQColorFromHexString(@"#F3C085")] type:QMUIImageGradientTypeTopLeftToBottomRight locations:nil size:CGSizeMake(width, height) cornerRadiusArray:@[@0,@0,[NSNumber numberWithFloat:corner],[NSNumber numberWithFloat:corner]]]];
- [self.jingxuan500View setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
- [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
- if (isVip) {
- NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_HandPick ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
- return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
- }].toArray;
- RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
- RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
- RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
- RQHomeSubPageTypeKey : @(RQHomeSubPageType_SequentialPractice),
- RQViewModelIDKey : @"精选500题",
- RQExerciseTypeKey : @(RQExerciseType_HandPick),
- RQViewModelUtilKey : arr,
- }];
- [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
- } else {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- }];
- }];
-
- [self.zhenshimoniView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
- [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
- if (isVip) {
- NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&model=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStrNew,RQ_USER_MANAGER.currentUser.photo];
- NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
- RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
- webViewModel.prefersNavigationBarHidden = YES;
- [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
- } else {
- if (RQ_VIP_Module.freeLookSimExamNum == 1) {
- NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&model=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStrNew,RQ_USER_MANAGER.currentUser.photo];
- NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
- RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
- webViewModel.prefersNavigationBarHidden = YES;
- [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
- RQ_VIP_Module.freeLookSimExamNum = 0;
- } else {
- [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
- [RQ_AD_Module loadRewardvodAd];
- }];
- }
- }
- }];
- }];
-
- [self.chongcijuanView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
- [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
- if (isVip) {
- RQHoursBeforeExamHomeViewModel *hoursBeforeExamHomeViewModel = [[RQHoursBeforeExamHomeViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
- [RQ_APPDELEGATE.services pushViewModel:hoursBeforeExamHomeViewModel animated:YES];
- } else {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- }];
- }];
- }
- #pragma mark - PrivateMethods
- @end
|