RQHoursBeforeExamHomeViewController.m 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 *stackViewTopToImageView;
  15. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *backBtnTopToSuperView;
  16. @end
  17. @implementation RQHoursBeforeExamHomeViewController
  18. @dynamic viewModel;
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. _stackViewTopToImageView.constant = RQ_FIT_HORIZONTAL(414.5f) ;
  22. _backBtnTopToSuperView.constant = RQ_APPLICATION_STATUS_BAR_HEIGHT;
  23. }
  24. - (IBAction)backBtnAction:(id)sender {
  25. [self.viewModel.services popViewModelAnimated:YES];
  26. }
  27. - (IBAction)mijuanOneBtnAction:(id)sender {
  28. RQ_COMMON_MANAGER.miExamType = RQMiExamType_One;
  29. NSArray *questionArr = [RQ_QUESTION_DB_MANAGER getQuestionWithCarType:RQ_COMMON_MANAGER.carType subject:RQ_COMMON_MANAGER.subject pageType:RQHomeSubPageType_MockExamination name:@"" exerciseType:RQExerciseType_MiExam];
  30. [RQ_USER_MANAGER isShouldVipWithComplete:^(NSInteger isVip) {
  31. if (isVip > 0) {
  32. if (questionArr.count > 0) {
  33. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  34. RQHomePageCarTypeKey : @(RQ_COMMON_MANAGER.carType),
  35. RQHomePageSubjectTypeKey : @(RQ_COMMON_MANAGER.subject),
  36. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  37. RQExerciseTypeKey : @(RQExerciseType_Test),
  38. RQViewModelUtilKey : questionArr,
  39. RQViewCommonValueKey : @(0),
  40. RQViewModelIDKey : @"秘卷一",
  41. }];
  42. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  43. } else {
  44. [MBProgressHUD rq_showTips:@"秘卷题库为空!"];
  45. }
  46. }
  47. }];
  48. return;
  49. [RQ_USER_MANAGER isShouldVipWithComplete:^(NSInteger isVip) {
  50. if (isVip > 0) {
  51. if (self.viewModel.itemsOne.count > 0) {
  52. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  53. RQHomePageCarTypeKey : @(RQ_COMMON_MANAGER.carType),
  54. RQHomePageSubjectTypeKey : @(RQ_COMMON_MANAGER.subject),
  55. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  56. RQExerciseTypeKey : @(RQExerciseType_Test),
  57. RQViewModelUtilKey : self.viewModel.itemsOne,
  58. RQViewCommonValueKey : @(0),
  59. RQViewModelIDKey : @"秘卷一",
  60. }];
  61. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  62. } else {
  63. [MBProgressHUD rq_showTips:@"秘卷题库更新中!"];
  64. }
  65. }
  66. }];
  67. }
  68. - (IBAction)mijuanTwoBtnAction:(id)sender {
  69. RQ_COMMON_MANAGER.miExamType = RQMiExamType_Two;
  70. NSArray *questionArr = [RQ_QUESTION_DB_MANAGER getQuestionWithCarType:RQ_COMMON_MANAGER.carType subject:RQ_COMMON_MANAGER.subject pageType:RQHomeSubPageType_MockExamination name:@"" exerciseType:RQExerciseType_MiExam];
  71. [RQ_USER_MANAGER isShouldVipWithComplete:^(NSInteger isVip) {
  72. if (isVip > 0) {
  73. if (questionArr.count > 0) {
  74. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  75. RQHomePageCarTypeKey : @(RQ_COMMON_MANAGER.carType),
  76. RQHomePageSubjectTypeKey : @(RQ_COMMON_MANAGER.subject),
  77. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  78. RQExerciseTypeKey : @(RQExerciseType_Test),
  79. RQViewModelUtilKey : questionArr,
  80. RQViewCommonValueKey : @(0),
  81. RQViewModelIDKey : @"秘卷二",
  82. }];
  83. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  84. } else {
  85. [MBProgressHUD rq_showTips:@"秘卷题库为空!"];
  86. }
  87. }
  88. }];
  89. return;
  90. [RQ_USER_MANAGER isShouldVipWithComplete:^(NSInteger isVip) {
  91. if (isVip > 0) {
  92. if (self.viewModel.itemsOne.count > 0) {
  93. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  94. RQHomePageCarTypeKey : @(RQ_COMMON_MANAGER.carType),
  95. RQHomePageSubjectTypeKey : @(RQ_COMMON_MANAGER.subject),
  96. RQHomeSubPageTypeKey : @(RQHomeSubPageType_MockExamination),
  97. RQExerciseTypeKey : @(RQExerciseType_Test),
  98. RQViewModelUtilKey : self.viewModel.itemsTwo,
  99. RQViewCommonValueKey : @(0),
  100. RQViewModelIDKey : @"秘卷二",
  101. }];
  102. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  103. } else {
  104. [MBProgressHUD rq_showTips:@"秘卷题库更新中!"];
  105. }
  106. }
  107. }];
  108. }
  109. @end