RQExerciseVideoExplainCell.m 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // RQExerciseVideoExplainCell.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/11/23.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQExerciseVideoExplainCell.h"
  9. @interface RQExerciseVideoExplainCell ()
  10. @property (nonatomic, readwrite, strong) RQExerciseVideoExplainItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIImageView *videoCoverImageView;
  12. @property (weak, nonatomic) IBOutlet UIView *videoView;
  13. @end
  14. @implementation RQExerciseVideoExplainCell
  15. #pragma mark - PublicMethods
  16. + (instancetype)cellWithTableView:(UITableView *)tableView {
  17. static NSString *ID = @"RQExerciseVideoExplainCell";
  18. RQExerciseVideoExplainCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  19. if (!cell) {
  20. cell = [self rq_viewFromXib];
  21. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  22. }
  23. return cell;
  24. }
  25. - (void)bindViewModel:(RQExerciseVideoExplainItemViewModel *)viewModel {
  26. @weakify(self)
  27. _viewModel = viewModel;
  28. [_videoCoverImageView yy_setImageWithURL:[NSURL URLWithString:viewModel.ydtJSModel.ydt_video_pic] placeholder:RQWebImagePlaceholder() options:RQWebImageOptionAutomatic completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
  29. }];
  30. RAC(self.tryLookLabel, text) = [[RACObserve(RQ_USER_MANAGER, tryLookCount) takeUntil:self.rac_prepareForReuseSignal] map:^id _Nullable(id _Nullable value) {
  31. @strongify(self)
  32. // if ((RQ_VIP_Module.isSubject1Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"1"]) || (RQ_VIP_Module.isSubject4Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"4"])) {
  33. if ((RQ_VIP_Module.isSubject1Vip) || (RQ_VIP_Module.isSubject4Vip)) {
  34. self.tryLookView.hidden = YES;
  35. self.tryLookCoverImageView.hidden = YES;
  36. self.tryLookBottomView.hidden = YES;
  37. self.tryLookBgImageView.hidden = YES;
  38. } else {
  39. self.tryLookBottomView.hidden = NO;
  40. self.tryLookBgImageView.hidden = NO;
  41. if (RQ_USER_MANAGER.tryLookCount == 0) {
  42. self.tryLookView.hidden = NO;
  43. self.tryLookCoverImageView.hidden = NO;
  44. } else {
  45. self.tryLookView.hidden = YES;
  46. self.tryLookCoverImageView.hidden = YES;
  47. }
  48. }
  49. return [NSString stringWithFormat:@"第%ld题",RQ_USER_MANAGER.tryLookCount];
  50. }];
  51. }
  52. - (IBAction)playBtnAvtion:(id)sender {
  53. RQExplainVideoViewModel *explainVideoViewModel = [[RQExplainVideoViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelUtilKey : self.viewModel.ydtJSModel }];
  54. [RQ_APPDELEGATE.services presentViewModel:explainVideoViewModel animated:YES completion:nil];
  55. }
  56. - (IBAction)openBtnAction:(id)sender {
  57. [RQ_VIP_Module isVipWithSubject:0 complete:^(BOOL isVip) {
  58. if (RQ_VIP_Module.isVip) {
  59. [RQ_VIP_Module gotoVipCenter];
  60. } else {
  61. [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
  62. }
  63. }];
  64. }
  65. #pragma mark - SystemMethods
  66. - (void)awakeFromNib {
  67. [super awakeFromNib];
  68. _openVipBtn.layer.cornerRadius = _openVipBtn.rq_height / 2.f;
  69. }
  70. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  71. [super setSelected:selected animated:animated];
  72. // Configure the view for the selected state
  73. }
  74. @end