RQHomePageSimulationExamItemViewModel.m 5.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
  22. if (isVip) {
  23. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  24. 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];
  25. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  26. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  27. webViewModel.prefersNavigationBarHidden = YES;
  28. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  29. }else{
  30. //显示真实考场
  31. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  32. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  33. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  34. }
  35. } else {
  36. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  37. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  38. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  39. 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];
  40. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  41. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  42. webViewModel.prefersNavigationBarHidden = YES;
  43. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  44. }else{
  45. //显示真实考场
  46. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  47. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  48. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  49. }
  50. RQ_VIP_Module.freeLookSimExamNum = 0;
  51. } else {
  52. if(!RQ_COMMON_MANAGER.APP_SWITCH){
  53. // 修改后的弹窗调用逻辑
  54. NSString *ukey = [NSString stringWithFormat:@"%@%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue];
  55. if (![NYTools hasUserWatchedAdToday:ukey]) {
  56. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  57. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  58. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  59. [RQ_AD_Module loadRewardvodAd];
  60. [NYTools saveUWatchedAdToday:ukey];
  61. }];
  62. }else{
  63. //显示真实考场
  64. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  65. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  66. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  67. }
  68. }
  69. }
  70. }
  71. }];
  72. };
  73. }
  74. return self;
  75. }
  76. - (NSString *)itemClassName {
  77. return @"RQHomePageSimulationExamCell";
  78. }
  79. @end