RQHoursBeforeExamHomeViewController.m 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. //
  2. // RQHoursBeforeExamHomeViewController.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/6/21.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHoursBeforeExamHomeViewController.h"
  9. @interface RQHoursBeforeExamHomeViewController ()
  10. /// viewModel
  11. @property (nonatomic, readonly, strong) RQHoursBeforeExamHomeViewModel *viewModel;
  12. @property (weak, nonatomic) IBOutlet UIButton *miJuanOneBtn;
  13. @property (weak, nonatomic) IBOutlet UIButton *miJuanTwoBtn;
  14. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *stackViewBottomToSuperView;
  15. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *backBtnTopToSuperView;
  16. @property (weak, nonatomic) IBOutlet UIStackView *stackview;
  17. @property (weak, nonatomic) IBOutlet UIView *stview_4;
  18. @property (weak, nonatomic) IBOutlet UIImageView *bg_imageview;
  19. @end
  20. @implementation RQHoursBeforeExamHomeViewController
  21. @dynamic viewModel;
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. _stackViewBottomToSuperView.constant = RQ_FIT_VERTICAL(100.f) ;
  25. _backBtnTopToSuperView.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT;
  26. if(RQ_YDTQuestion_Module.subject==RQHomePageSubjectType_SubjectOne){
  27. self.bg_imageview.image = [UIImage imageNamed:@"秘卷图一"];
  28. self.stackview.hidden = NO;
  29. self.stview_4.hidden = YES;
  30. }else if(RQ_YDTQuestion_Module.subject==RQHomePageSubjectType_SubjectFour){
  31. self.bg_imageview.image = [UIImage imageNamed:@"秘卷图四"];
  32. self.stackview.hidden = YES;
  33. self.stview_4.hidden = NO;
  34. }
  35. }
  36. - (IBAction)backBtnAction:(id)sender {
  37. [self.viewModel.services popViewModelAnimated:YES];
  38. }
  39. - (IBAction)miJuanOneBtnAction:(id)sender {
  40. [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
  41. NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Mi_One ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
  42. return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
  43. }].toArray;
  44. if (isVip) {
  45. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  46. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  47. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  48. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  49. RQViewModelIDKey : @"",
  50. RQExerciseTypeKey : @(RQExerciseType_Mi_One),
  51. RQViewModelUtilKey : arr,
  52. }];
  53. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  54. } else {
  55. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  56. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  57. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  58. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  59. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  60. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  61. RQViewModelIDKey : @"",
  62. RQExerciseTypeKey : @(RQExerciseType_Mi_One),
  63. RQViewModelUtilKey : arr,
  64. }];
  65. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  66. RQ_VIP_Module.freeLookSimExamNum = 0;
  67. } else {
  68. // 修改后的弹窗调用逻辑
  69. NSString *ukey = [NSString stringWithFormat:@"%@%d%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue,1];
  70. if (![NYTools hasUserWatchedAdToday:ukey]) {
  71. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD_MI title:@"" message:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等5到10秒。" confirmTitle:@"充值使用" cancelTitle:@"看广告解锁" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  72. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  73. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  74. [RQ_AD_Module loadRewardvodAd];
  75. [NYTools saveUWatchedAdToday:ukey];
  76. }];
  77. }else{
  78. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  79. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  80. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  81. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  82. RQViewModelIDKey : @"",
  83. RQExerciseTypeKey : @(RQExerciseType_Mi_One),
  84. RQViewModelUtilKey : arr,
  85. }];
  86. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  87. }
  88. }
  89. }
  90. }];
  91. }
  92. - (IBAction)miJuanTwoBtnAction:(id)sender {
  93. [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
  94. NSArray *arr = [[RQ_YDTQuestion_Module getQuestionWithSubject:RQ_YDTQuestion_Module.subject exerciseType:RQExerciseType_Mi_Two ].rac_sequence.signal map:^id _Nullable(RQYDTQuestionModel *ydtQuestionModel) {
  95. return [RQExerciseModel exerciseModelWithRQYDTQuestionModel:ydtQuestionModel];
  96. }].toArray;
  97. if (isVip) {
  98. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  99. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  100. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  101. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  102. RQViewModelIDKey : @"",
  103. RQExerciseTypeKey : @(RQExerciseType_Mi_Two),
  104. RQViewModelUtilKey : arr,
  105. }];
  106. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  107. } else {
  108. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  109. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  110. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  111. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  112. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  113. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  114. RQViewModelIDKey : @"",
  115. RQExerciseTypeKey : @(RQExerciseType_Mi_Two),
  116. RQViewModelUtilKey : arr,
  117. }];
  118. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  119. RQ_VIP_Module.freeLookSimExamNum = 0;
  120. } else {
  121. // 修改后的弹窗调用逻辑
  122. NSString *ukey = [NSString stringWithFormat:@"%@%d%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue,2];
  123. if (![NYTools hasUserWatchedAdToday:ukey]) {
  124. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD_MI title:@"" message:@"车管所实题,为防恶意刷屏,每日须观看一次广告,即可正常使用。点击观看无反应。请稍等5到10秒。" confirmTitle:@"充值使用" cancelTitle:@"看广告解锁" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  125. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  126. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  127. [RQ_AD_Module loadRewardvodAd];
  128. [NYTools saveUWatchedAdToday:ukey];
  129. }];
  130. }else{
  131. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  132. RQHomePageCarTypeKey : @(RQ_YDTQuestion_Module.carType),
  133. RQHomePageSubjectTypeKey : @(RQ_YDTQuestion_Module.subject),
  134. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  135. RQViewModelIDKey : @"",
  136. RQExerciseTypeKey : @(RQExerciseType_Mi_Two),
  137. RQViewModelUtilKey : arr,
  138. }];
  139. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  140. }
  141. }
  142. }
  143. }];
  144. }
  145. @end