NYLIVideoDetailViewModel.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // NYLIVideoDetailViewModel.m
  3. // jiaPei
  4. //
  5. // Created by Ning.ge on 2025/2/8.
  6. // Copyright © 2025 JCZ. All rights reserved.
  7. //
  8. #import "NYLIVideoDetailViewModel.h"
  9. @interface NYLIVideoDetailViewModel ()
  10. @property (nonatomic, readwrite, strong) RQTreeListModel *treeListModel;
  11. @property (nonatomic, readwrite, strong) RQPlaceVideoListModel *placeVideoListModel;
  12. @property (nonatomic, readwrite, assign) NSInteger index;
  13. @property (nonatomic, readwrite, strong) NSIndexPath *indexPath;
  14. @property (nonatomic, readwrite, assign) RQHomePageSubjectType homePageSubjectType;
  15. @property (nonatomic, readwrite, strong) VideosItem *videosItem;
  16. @end
  17. @implementation NYLIVideoDetailViewModel
  18. #pragma mark - Public Method
  19. - (instancetype)initWithServices:(id<RQViewModelServices>)services params:(NSDictionary *)params {
  20. if (self = [super initWithServices:services params:params]) {
  21. // if ([params[RQViewModelUtilKey] isKindOfClass:[RQPlaceVideoListModel class]]) {
  22. self.placeVideoListModel = params[RQViewModelUtilKey];
  23. // } else {
  24. // self.treeListModel = params[RQViewModelUtilKey];
  25. // }
  26. self.index = [params[RQVideoItemIndexKey] integerValue];
  27. self.indexPath = params[RQVideoItemIndexPathKey];
  28. self.homePageSubjectType = [params[RQHomePageSubjectTypeKey] integerValue];
  29. self.videosItem = params[RQPlayVideoItemKey];
  30. }
  31. return self;
  32. }
  33. - (void)initialize {
  34. [super initialize];
  35. self.prefersNavigationBarHidden = YES;
  36. // RQ_YDTQuestion_Module.subject = self.homePageSubjectType;
  37. //通知
  38. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getLIFiveReload:) name:NYLI_FIVEDB_CHANGEDO object:nil];
  39. }
  40. - (void)dealloc{
  41. [[NSNotificationCenter defaultCenter] removeObserver:self];
  42. }
  43. - (void)getLIFiveReload:(NSNotification *)sender {
  44. NSString *type = sender.object;
  45. self.homePageSubjectType = [type isEqualToString:@"1"]? RQHomePageSubjectType_SubjectOne_LI : RQHomePageSubjectType_SubjectFour_LI;
  46. self.placeVideoListModel.examName = [type isEqualToString:@"1"]? @"科一专项精品课" :@"科四专项精品课";
  47. }
  48. @end