RQHomePageSimulationExamItemViewModel.m 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. 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];
  24. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  25. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  26. webViewModel.prefersNavigationBarHidden = YES;
  27. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  28. // NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  29. // examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  30. // [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  31. } else {
  32. if (RQ_VIP_Module.freeLookSimExamNum == 1||
  33. RQ_COMMON_MANAGER.APP_SWITCH) {//审核状态不用看广告
  34. 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];
  35. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  36. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  37. webViewModel.prefersNavigationBarHidden = YES;
  38. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  39. // NYExaminationViewModel *examinationViewModel = [[NYExaminationViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{}];
  40. // examinationViewModel.km = RQ_YDTQuestion_Module.subjectStr.intValue;
  41. // [RQ_APPDELEGATE.services pushViewModel:examinationViewModel animated:YES];
  42. RQ_VIP_Module.freeLookSimExamNum = 0;
  43. } else {
  44. if(!RQ_COMMON_MANAGER.APP_SWITCH){
  45. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  46. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  47. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  48. [RQ_AD_Module loadRewardvodAd];
  49. }];
  50. }
  51. }
  52. }
  53. }];
  54. };
  55. }
  56. return self;
  57. }
  58. - (NSString *)itemClassName {
  59. return @"RQHomePageSimulationExamCell";
  60. }
  61. @end