RQHomePageSimulationExamItemViewModel.m 3.5 KB

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