NYLIHomePageSimulationExamItemViewModel.m 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // NYLIHomePageSimulationExamItemViewModel.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2025/2/14.
  6. // Copyright © 2025 JCZ. All rights reserved.
  7. //
  8. #import "NYLIHomePageSimulationExamItemViewModel.h"
  9. @interface NYLIHomePageSimulationExamItemViewModel ()
  10. @property (nonatomic, readwrite, assign) RQHomePageCarType homePageCarType;
  11. @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType;
  12. @end
  13. @implementation NYLIHomePageSimulationExamItemViewModel
  14. /// init
  15. - (instancetype)initWithRQHomePageCarType:(RQHomePageCarType)homePageCarType homePageSubjectType:(RQHomePageSubjectType)homePageSubjectType {
  16. if (self = [super init]) {
  17. @weakify(self)
  18. self.homePageCarType = homePageCarType;
  19. self.homePageSubjectType = homePageSubjectType;
  20. self.itemSize = CGSizeMake(RQ_SCREEN_WIDTH, RQ_FIT_HORIZONTAL(303.f));
  21. self.operationLI = ^{
  22. RQHomePageSubjectType subType = RQHomePageSubjectType_SubjectOne_LI;
  23. NSString *ftv = @"1";
  24. NSString *examName = @"科一专项精品课";
  25. if(homePageSubjectType == RQHomePageSubjectType_SubjectFour){
  26. ftv = @"4";
  27. examName = @"科四专项精品课";
  28. subType = RQHomePageSubjectType_SubjectFour_LI;
  29. }
  30. [MBProgressHUD rq_showProgressHUD:@""];
  31. [[RQ_HTTP_Service getFiveTeachingList:ftv] subscribeNext:^(NSArray *fiveModels) {
  32. [MBProgressHUD rq_hideHUD];
  33. @strongify(self)
  34. RQPlaceVideoListModel *placeVideoListModel = [[RQPlaceVideoListModel alloc] init];
  35. placeVideoListModel.examName = examName;
  36. placeVideoListModel.items = fiveModels;
  37. NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:0];
  38. NYLIVideoDetailViewModel *videoDetailViewModel = [[NYLIVideoDetailViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  39. RQViewModelUtilKey : placeVideoListModel,
  40. RQVideoItemIndexKey : @(0),
  41. RQVideoItemIndexPathKey : indexPath,
  42. RQHomePageSubjectTypeKey : @(subType),
  43. }];
  44. [RQ_APPDELEGATE.services pushViewModel:videoDetailViewModel animated:YES];
  45. } error:^(NSError * _Nullable error) {
  46. [MBProgressHUD rq_hideHUD];
  47. [MBProgressHUD rq_showErrorTips:error];
  48. }];
  49. };
  50. self.operation = ^{
  51. [RQ_VIP_Module isVipWithSubject:RQ_YDTQuestion_Module.subject + 1 complete:^(BOOL isVip) {
  52. if (isVip) {
  53. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  54. 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];
  55. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  56. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  57. webViewModel.prefersNavigationBarHidden = YES;
  58. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  59. }else{
  60. //显示真实考场
  61. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  62. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  63. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  64. }
  65. } else {
  66. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  67. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  68. if(RQ_COMMON_MANAGER.APP_SWITCH){//审核状态走web 页
  69. 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];
  70. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  71. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  72. webViewModel.prefersNavigationBarHidden = YES;
  73. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  74. }else{
  75. //显示真实考场
  76. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  77. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  78. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  79. }
  80. RQ_VIP_Module.freeLookSimExamNum = 0;
  81. } else {
  82. if(!RQ_COMMON_MANAGER.APP_SWITCH){
  83. // 修改后的弹窗调用逻辑
  84. NSString *ukey = [NSString stringWithFormat:@"%@%d",RQ_USER_MANAGER.currentUser.loginCode,RQ_YDTQuestion_Module.subjectStr.intValue];
  85. if (![NYTools hasUserWatchedAdToday:ukey]) {
  86. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  87. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  88. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  89. [RQ_AD_Module loadRewardvodAd];
  90. [NYTools saveUWatchedAdToday:ukey];
  91. }];
  92. }else{
  93. //显示真实考场
  94. NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  95. examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  96. [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  97. }
  98. }
  99. }
  100. }
  101. }];
  102. };
  103. }
  104. return self;
  105. }
  106. - (NSString *)itemClassName {
  107. return @"NYLIHomePageSimulationExamCell";
  108. }
  109. @end