RQHomePageSimulationExamItemViewModel.m 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // RQHomePageSimulationExamItemViewModel.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/6/10.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHomePageSimulationExamItemViewModel.h"
  9. @interface RQHomePageSimulationExamItemViewModel ()
  10. @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType;
  11. @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType;
  12. @end
  13. @implementation RQHomePageSimulationExamItemViewModel
  14. /// init
  15. - (instancetype)initWithRQHomePageCarType:(RQHomePageCarType)homePageCarType homePageSubjectType:(RQHomePageSubjectType)homePageSubjectType {
  16. if (self = [super init]) {
  17. self.homePageCarType = homePageCarType;
  18. self.homePageSubjectType = homePageSubjectType;
  19. self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(189.f));
  20. self.operation = ^{
  21. if(myDelegate.isTrain&&RQ_USER_MANAGER.currentUser.isNotGcbd){//在计时-同时需要过程照片-提示
  22. ShowMsg(@"请先结束理论计时在进行真实考场!");
  23. return;
  24. }
  25. [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
  26. if (isVip) {
  27. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  28. 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];
  29. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  30. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  31. webViewModel.prefersNavigationBarHidden = YES;
  32. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  33. }else{
  34. //显示真实考场
  35. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  36. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  37. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  38. }
  39. } else {
  40. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  41. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  42. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  43. 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];
  44. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  45. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  46. webViewModel.prefersNavigationBarHidden = YES;
  47. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  48. }else{
  49. //显示真实考场
  50. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  51. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  52. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  53. }
  54. RQ_VIP_Module.freeLookSimExamNum = 0;
  55. } else {
  56. if(!RQ_COMMON_MANAGER.APP_SWITCH){
  57. // 修改后的弹窗调用逻辑
  58. NSString *ukey = [NSString stringWithFormat:@"%@%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue];
  59. if (![NYTools hasUserWatchedAdToday:ukey]) {
  60. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等5到10秒。" confirmTitle:@"充值使用" cancelTitle:@"看广告解锁" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  61. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  62. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  63. [RQ_AD_Module loadRewardvodAd];
  64. [NYTools saveUWatchedAdToday:ukey];
  65. }];
  66. }else{
  67. //显示真实考场
  68. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  69. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  70. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  71. }
  72. }
  73. }
  74. }
  75. }];
  76. };
  77. }
  78. return self;
  79. }
  80. - (NSString *)itemClassName {
  81. return @"RQHomePageSimulationExamCell";
  82. }
  83. @end