RQHomePageSubjectModuleCell.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // RQHomePageSubjectModuleCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/9/8.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHomePageSubjectModuleCell.h"
  9. #import "LightingAndSoundVC.h"
  10. @interface RQHomePageSubjectModuleCell ()
  11. @property (nonatomic, readwrite, strong) RQHomePageSubjectModuleItemViewModel *viewModel;
  12. @property (weak, nonatomic) IBOutlet UIView *subjectThreeView;
  13. @property (weak, nonatomic) IBOutlet UIView *lightView;
  14. @property (weak, nonatomic) IBOutlet UIView *soundView;
  15. @end
  16. @implementation RQHomePageSubjectModuleCell
  17. #pragma mark - PublicMethods
  18. + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
  19. static NSString *ID = @"RQHomePageSubjectModuleCell";
  20. [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID];
  21. RQHomePageSubjectModuleCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
  22. if (!cell) cell = [self rq_viewFromXib];
  23. return cell;
  24. }
  25. - (void)bindViewModel:(RQHomePageSubjectModuleItemViewModel *)viewModel {
  26. _viewModel = viewModel;
  27. _subjectThreeView.hidden = RQ_COMMON_MANAGER.APP_SWITCH;
  28. [_subjectThreeView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  29. [RQ_VIP_Module isVipWithSubject:0 complete:^(BOOL isVip) {
  30. if (RQ_VIP_Module.isVip) {
  31. [RQ_VIP_Module gotoVipCenter];
  32. } else {
  33. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  34. }
  35. }];
  36. }];
  37. [_lightView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  38. LightingAndSoundViewModel *lightingAndSoundViewModel = [[LightingAndSoundViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
  39. lightingAndSoundViewModel.styleTag = 4;
  40. [RQ_APPDELEGATE.services pushViewModel:lightingAndSoundViewModel animated:YES];
  41. }];
  42. [_soundView setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  43. LightingAndSoundViewModel *lightingAndSoundViewModel = [[LightingAndSoundViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:nil];
  44. lightingAndSoundViewModel.styleTag = 5;
  45. [RQ_APPDELEGATE.services pushViewModel:lightingAndSoundViewModel animated:YES];
  46. }];
  47. }
  48. #pragma mark - SystemMethods
  49. - (void)awakeFromNib {
  50. [super awakeFromNib];
  51. // Initialization code
  52. }
  53. @end