// // 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) { NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&gs=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStr,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=%@&gs=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStr,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]; }]; } } }]; }; } return self; } - (NSString *)itemClassName { return @"RQHomePageSimulationExamCell"; } @end