// // NYLIHomePageSimulationExamItemViewModel.m // jiaPei // // Created by Ning.ge on 2025/2/14. // Copyright © 2025 JCZ. All rights reserved. // #import "NYLIHomePageSimulationExamItemViewModel.h" @interface NYLIHomePageSimulationExamItemViewModel () @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType; @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType; @end @implementation NYLIHomePageSimulationExamItemViewModel /// init - (instancetype)initWithRQHomePageCarType:(RQHomePageCarType)homePageCarType homePageSubjectType:(RQHomePageSubjectType)homePageSubjectType { if (self = [super init]) { @weakify(self) self.homePageCarType = homePageCarType; self.homePageSubjectType = homePageSubjectType; self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(303.f)); self.operationLI = ^{ RQHomePageSubjectType subType = RQHomePageSubjectType_SubjectOne_LI; NSString *ftv = @"1"; NSString *examName = @"科一专项精品课"; if(homePageSubjectType == RQHomePageSubjectType_SubjectFour){ ftv = @"4"; examName = @"科四专项精品课"; subType = RQHomePageSubjectType_SubjectFour_LI; } [MBProgressHUD rq_showProgressHUD:@""]; [[RQ_HTTP_Service getFiveTeachingList:ftv] subscribeNext:^(NSArray *fiveModels) { [MBProgressHUD rq_hideHUD]; @strongify(self) RQPlaceVideoListModel *placeVideoListModel = [[RQPlaceVideoListModel alloc] init]; placeVideoListModel.examName = examName; placeVideoListModel.items = fiveModels; NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:0]; NYLIVideoDetailViewModel *videoDetailViewModel = [[NYLIVideoDetailViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQViewModelUtilKey : placeVideoListModel, RQVideoItemIndexKey : @(0), RQVideoItemIndexPathKey : indexPath, RQHomePageSubjectTypeKey : @(subType), }]; [RQ_APPDELEGATE.services pushViewModel:videoDetailViewModel animated:YES]; } error:^(NSError * _Nullable error) { [MBProgressHUD rq_hideHUD]; [MBProgressHUD rq_showErrorTips:error]; }]; }; self.operation = ^{ if(myDelegate.isTrain&&RQ_USER_MANAGER.currentUser.isNotGcbd){//在计时-同时需要过程照片-提示 ShowMsg(@"请先结束理论计时在进行真实考场!"); return; } [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:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等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{ //显示真实考场 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 @"NYLIHomePageSimulationExamCell"; } @end