1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // RQExerciseVideoExplainCell.m
- // jiaPei
- //
- // Created by 张嵘 on 2022/11/23.
- // Copyright © 2022 JCZ. All rights reserved.
- //
- #import "RQExerciseVideoExplainCell.h"
- @interface RQExerciseVideoExplainCell ()
- @property (nonatomic, readwrite, strong) RQExerciseVideoExplainItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIImageView *videoCoverImageView;
- @property (weak, nonatomic) IBOutlet UIView *videoView;
- @end
- @implementation RQExerciseVideoExplainCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *ID = @"RQExerciseVideoExplainCell";
- RQExerciseVideoExplainCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (!cell) {
- cell = [self rq_viewFromXib];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
- }
- - (void)bindViewModel:(RQExerciseVideoExplainItemViewModel *)viewModel {
- @weakify(self)
- _viewModel = viewModel;
-
-
- [_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) {
- }];
-
- RAC(self.tryLookLabel, text) = [[RACObserve(RQ_USER_MANAGER, tryLookCount) takeUntil:self.rac_prepareForReuseSignal] map:^id _Nullable(id _Nullable value) {
- @strongify(self)
- // if ((RQ_VIP_Module.isSubject1Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"1"]) || (RQ_VIP_Module.isSubject4Vip && [viewModel.ydtJSModel.kemu isEqualToString:@"4"])) {
- if ((RQ_VIP_Module.isSubject1Vip) || (RQ_VIP_Module.isSubject4Vip)) {
- self.tryLookView.hidden = YES;
- self.tryLookCoverImageView.hidden = YES;
- self.tryLookBottomView.hidden = YES;
- self.tryLookBgImageView.hidden = YES;
- } else {
- self.tryLookBottomView.hidden = NO;
- self.tryLookBgImageView.hidden = NO;
- if (RQ_USER_MANAGER.tryLookCount == 0) {
- self.tryLookView.hidden = NO;
- self.tryLookCoverImageView.hidden = NO;
- } else {
- self.tryLookView.hidden = YES;
- self.tryLookCoverImageView.hidden = YES;
- }
- }
- return [NSString stringWithFormat:@"第%ld题",RQ_USER_MANAGER.tryLookCount];
- }];
- }
- - (IBAction)playBtnAvtion:(id)sender {
- RQExplainVideoViewModel *explainVideoViewModel = [[RQExplainVideoViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{RQViewModelUtilKey : self.viewModel.ydtJSModel }];
- [RQ_APPDELEGATE.services presentViewModel:explainVideoViewModel animated:YES completion:nil];
- }
- - (IBAction)openBtnAction:(id)sender {
- [RQ_VIP_Module isVipWithSubject:0 complete:^(BOOL isVip) {
- if (RQ_VIP_Module.isVip) {
- [RQ_VIP_Module gotoVipCenter];
- } else {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- }];
- }
- #pragma mark - SystemMethods
- - (void)awakeFromNib {
- [super awakeFromNib];
- _openVipBtn.layer.cornerRadius = _openVipBtn.rq_height / 2.f;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|