// // RQHomePageSimulationExamItemViewModel.m // jiaPei // // Created by 张嵘 on 2022/6/10. // Copyright © 2022 JCZ. All rights reserved. // #import "RQHomePageSimulationExamItemViewModel.h" @interface RQHomePageSimulationExamItemViewModel () @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType; @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType; @end @implementation RQHomePageSimulationExamItemViewModel /// init - (instancetype)initWithRQHomePageCarType:(RQHomePageCarType)homePageCarType homePageSubjectType:(RQHomePageSubjectType)homePageSubjectType { if (self = [super init]) { self.homePageCarType = homePageCarType; self.homePageSubjectType = homePageSubjectType; self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(189.f)); self.operation = ^{ [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) { if (isVip) { if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页 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{ //显示真实考场 NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}]; examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue; [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES]; } } else { if (RQ_VIP_Module.freeLookSimExamNum == 1|| RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告 if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页 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{ //显示真实考场 NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}]; examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue; [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES]; } RQ_VIP_Module.freeLookSimExamNum = 0; } else { if(!RQ_COMMON_MANAGER.APP_SWITCH){ // 修改后的弹窗调用逻辑 NSString *ukey = [NSString stringWithFormat:@"%@%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue]; if (![NYTools hasUserWatchedAdToday:ukey]) { [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]; [NYTools saveUWatchedAdToday:ukey]; }]; }else{ //显示真实考场 NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}]; examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue; [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES]; } } } } }]; }; } return self; } - (NSString *)itemClassName { return @"RQHomePageSimulationExamCell"; } @end