RQHomePageSimulationExamItemViewModel.m 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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=%@&gs=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStr,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. NSString *urlStr = [NSString stringWithFormat:@"https://mn.zzxcx.net/#/exam/begin?username=%@&subject=%@&gs=%@&headimg=%@",[RQ_USER_MANAGER.currentUser.userName qmui_stringByEncodingUserInputQuery],RQ_YDTQuestion_Module.subjectStr,RQ_YDTQuestion_Module.carTypeStr,RQ_USER_MANAGER.currentUser.photo];
  31. NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:urlStr]];
  32. RQWebViewModel *webViewModel = [[RQWebViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelRequestKey:request, RQViewModelWebViewTypeKey:@(RQWebViewType_Exam)}];
  33. webViewModel.prefersNavigationBarHidden = YES;
  34. [RQ_APPDELEGATE.services pushViewModel:webViewModel animated:YES];
  35. RQ_VIP_Module.freeLookSimExamNum = 0;
  36. } else {
  37. [RQ_ALERTVIEW_MANAGER showAlertWithAlertType:RQAlertType_AD title:@"" message:@"" confirmTitle:@"充值会员无限使用" cancelTitle:@"看广告解锁使用" confirmAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  38. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  39. } cancelAction:^(__kindof QMUIDialogViewController * _Nonnull dialogViewController) {
  40. [RQ_AD_Module loadRewardvodAd];
  41. }];
  42. }
  43. }
  44. }];
  45. };
  46. }
  47. return self;
  48. }
  49. - (NSString *)itemClassName {
  50. return @"RQHomePageSimulationExamCell";
  51. }
  52. @end