// // RQHoursBeforeExamHomeViewController.m // jiaPei // // Created by 张嵘 on 2022/6/21. // Copyright © 2022 JCZ. All rights reserved. // #import "RQHoursBeforeExamHomeViewController.h" @interface RQHoursBeforeExamHomeViewController () /// viewModel @property (nonatomic, readonly, strong) RQHoursBeforeExamHomeViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIButton *miJuanOneBtn; @property (weak, nonatomic) IBOutlet UIButton *miJuanTwoBtn; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *stackViewBottomToSuperView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *backBtnTopToSuperView; @property (weak, nonatomic) IBOutlet UIStackView *stackview; @property (weak, nonatomic) IBOutlet UIView *stview_4; @property (weak, nonatomic) IBOutlet UIImageView *bg_imageview; @end @implementation RQHoursBeforeExamHomeViewController @dynamic viewModel; - (void)viewDidLoad { [super viewDidLoad]; _stackViewBottomToSuperView.constant = RQ_FIT_VERTICAL(100.f) ; _backBtnTopToSuperView.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT; if(RQ_YDTQuestion_Module.subject==RQHomePageSubjectType_SubjectOne){ self.bg_imageview.image = [UIImage imageNamed:@"秘卷图一"]; self.stackview.hidden = NO; self.stview_4.hidden = YES; }else if(RQ_YDTQuestion_Module.subject==RQHomePageSubjectType_SubjectFour){ self.bg_imageview.image = [UIImage imageNamed:@"秘卷图四"]; self.stackview.hidden = YES; self.stview_4.hidden = NO; } } - (IBAction)backBtnAction:(id)sender { [self.viewModel.services popViewModelAnimated:YES]; } - (IBAction)miJuanOneBtnAction:(id)sender { [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) { NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Mi_One ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) { return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel]; }].toArray; if (isVip) { RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_One), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } else { if (RQ_VIP_Module.freeLookSimExamNum == 1|| RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告 RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_One), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; RQ_VIP_Module.freeLookSimExamNum = 0; } else { // 修改后的弹窗调用逻辑 NSString *ukey = [NSString stringWithFormat:@"%@%d%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue,1]; if (![NYTools hasUserWatchedAdToday:ukey]) { [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD_MI title:@"" message:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等5到10秒。" confirmTitle:@"充值使用" cancelTitle:@"看广告解锁" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) { [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full]; } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) { [RQ_AD_Module loadRewardvodAd]; [NYTools saveUWatchedAdToday:ukey]; }]; }else{ RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_One), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } } } }]; } - (IBAction)miJuanTwoBtnAction:(id)sender { [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) { NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Mi_Two ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) { return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel]; }].toArray; if (isVip) { RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_Two), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } else { if (RQ_VIP_Module.freeLookSimExamNum == 1|| RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告 RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_Two), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; RQ_VIP_Module.freeLookSimExamNum = 0; } else { // 修改后的弹窗调用逻辑 NSString *ukey = [NSString stringWithFormat:@"%@%d%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue,2]; if (![NYTools hasUserWatchedAdToday:ukey]) { [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD_MI title:@"" message:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等5到10秒。" confirmTitle:@"充值使用" cancelTitle:@"看广告解锁" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) { [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full]; } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) { [RQ_AD_Module loadRewardvodAd]; [NYTools saveUWatchedAdToday:ukey]; }]; }else{ RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType), RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject), RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination), RQViewModelIDKey : @"", RQExerciseTypeKey : @(RQExerciseType_Mi_Two), RQViewModelUtilKey : arr, }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } } } }]; } @end