// // RQVideoListCell.m // JSJP // // Created by 张嵘 on 2021/11/3. // #import "RQVideoListCell.h" @interface RQVideoListCell () @property (nonatomic, readwrite, strong) CGXVerticalMenuMoreListSectionItemModel *model; @property (weak, nonatomic) IBOutlet UIImageView *videoImageView; @property (weak, nonatomic) IBOutlet UILabel *videoTitleLabel; @property (weak, nonatomic) IBOutlet UILabel *videoDurationLabel; @property (weak, nonatomic) IBOutlet QMUIButton *tryLookBtn; @property (weak, nonatomic) IBOutlet UIButton *vipBtn; @property (nonatomic, readwrite, strong) RQVideoPermissionStateModel *videoPermissionStateModel; @end @implementation RQVideoListCell #pragma mark - Public Method + (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath { static NSString *ID = @"RQVideoListCell"; [collectionView registerNib:[UINib nibWithNibName:ID bundle:nil] forCellWithReuseIdentifier:ID]; RQVideoListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath]; if (!cell) cell = [self rq_viewFromXib]; return cell; } - (void)awakeFromNib { [super awakeFromNib]; _tryLookBtn.spacingBetweenImageAndTitle = 3; [_tryLookBtn setBackgroundColor:[UIColor rq_colorGradientChangeWithFrame:_tryLookBtn.frame startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) startColor:RQColorFromHexString(@"#FF4C52") endColor:RQColorFromHexString(@"#FC8269")]]; } - (void)reloadData:(CGXVerticalMenuMoreListSectionItemModel *)model { @weakify(self) self.model = model; VideosItem *videosItem = (VideosItem *)model.dataModel; self.videoTitleLabel.text = videosItem.title; // if (!RQ_COMMON_MANAGER.APP_SWITCH) { [[RACSignal combineLatest:@[RACObserve(RQ_VIP_Module, isSubject2Vip), RACObserve(RQ_VIP_Module, isSubject3Vip)] reduce:^id (NSNumber *isSubjectTwoVip, NSNumber *isSubjectThreeVip) { @strongify(self) if ((videosItem.subject == 1 && RQ_VIP_Module.isSubject2Vip) || (videosItem.subject == 2 && RQ_VIP_Module.isSubject3Vip)) { self.videoPermissionStateModel.tryLookShow = NO; self.videoPermissionStateModel.vipShow = NO; } else { self.videoPermissionStateModel.tryLookShow = (videosItem.permission == 1); self.videoPermissionStateModel.vipShow = (videosItem.permission == 2); } return self.videoPermissionStateModel; }] subscribeNext:^(RQVideoPermissionStateModel *videoPermissionStateModel) { @strongify(self) self.tryLookBtn.hidden = !videoPermissionStateModel.tryLookShow; self.vipBtn.hidden = !videoPermissionStateModel.vipShow; }]; // } [self.videoImageView yy_setImageWithURL:[NSURL URLWithString:videosItem.coverFileUrl] placeholder:[UIImage imageNamed:@"videoPlaceholder"]]; self.videoDurationLabel.text = [NSString getMMSSFromSS:videosItem.videoDuration]; } - (RQVideoPermissionStateModel *)videoPermissionStateModel { if (!_videoPermissionStateModel) { _videoPermissionStateModel = [[RQVideoPermissionStateModel alloc] init]; } return _videoPermissionStateModel; } @end