RQFreeTryItemViewModel.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // RQFreeTryItemViewModel.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2022/6/27.
  6. //
  7. #import "RQFreeTryItemViewModel.h"
  8. @implementation RQFreeTryItemViewModel
  9. - (instancetype)initWithTitle:(NSString *)title icon:(NSString *)icon {
  10. if (self = [super init]) {
  11. self.title = title;
  12. self.icon = icon;
  13. CGFloat imageWidth = (RQ_SCREEN_WIDTH - 32 - 11.f) / 2.f;
  14. CGFloat imageHeight = imageWidth * (70 / 167.f);
  15. self.itemSize = CGSizeMake(imageWidth, imageHeight);
  16. if ([self.title isEqualToString:@"免费试用"]) {
  17. self.operation = ^{
  18. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  19. RQHomePageCarTypeKey : @(RQ_COMMON_MANAGER.carType),
  20. RQHomePageSubjectTypeKey : @(RQ_COMMON_MANAGER.subject),
  21. RQHomeSubPageTypeKey : @(RQHomeSubPageType_FreeTry),
  22. RQExerciseTypeKey : @(RQExerciseType_Sequential),
  23. RQViewCommonValueKey : @(0),
  24. }];
  25. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  26. };
  27. } else if ([self.title isEqualToString:@"新规秘卷"]) {
  28. self.operation = ^{
  29. RQHoursBeforeExamHomeViewModel *hoursBeforeExamHomeViewModel = [[RQHoursBeforeExamHomeViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
  30. [RQ_APPDELEGATE.services pushViewModel:hoursBeforeExamHomeViewModel animated:YES];
  31. };
  32. }
  33. }
  34. return self;
  35. }
  36. - (NSString *)itemClassName {
  37. return @"RQFreeTryCell";
  38. }
  39. @end