123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- //
- // NYTestingCentreCell.m
- // jiaPei
- //
- // Created by Ning.ge on 2023/8/21.
- // Copyright © 2023 JCZ. All rights reserved.
- //
- #import "NYTestingCentreCell.h"
- @interface NYTestingCentreCell ()
- @property (nonatomic, readwrite, strong) NYExerciseTestingCentreItemViewModel *viewModel;
- @property (weak, nonatomic) IBOutlet UIImageView *videoCoverImageView;
- @property (weak, nonatomic) IBOutlet UIView *videoView;
- @end
- @implementation NYTestingCentreCell
- #pragma mark - PublicMethods
- + (instancetype)cellWithTableView:(UITableView *)tableView {
- static NSString *ID = @"NYTestingCentreCell-ID";
- NYTestingCentreCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (!cell) {
- cell = [self rq_viewFromXib];
- [cell setupUI];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return cell;
- }
- - (void)setupUI{
- self.bottom_imageview.image = [UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
- graColor.fromColor = [UIColor colorWithHexString:@"#F2F3F5" alpha:0.4];
- graColor.toColor = [UIColor colorWithHexString:@"#F2F3F5" alpha:1.f];
- graColor.type = QQGradualChangeTypeUpToDown;
- } size:CGSizeMake(self.bottom_view.width,self.bottom_view.height)cornerRadius:QQRadiusZero];
- }
- - (void)bindViewModel:(NYExerciseTestingCentreItemViewModel *)viewModel {
- _viewModel = viewModel;
-
- @weakify(self)
-
- RAC(self.title_label, text) = [[RACObserve(viewModel.ydtJSModel, sec_title) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
- if(RQStringIsNotEmpty(viewModel.ydtJSModel.word)){
- NSArray *words = [viewModel.ydtJSModel.word componentsSeparatedByString:@";"];
- self.word_label_01.text = words[0];
- self.word_label_02.text = words[1];
- self.word_label_03.text = words[2];
- // RAC(self.word_label_01, text) = [[RACObserve(words, words[0]) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
- }
-
- [[[[RACObserve(viewModel, ydtJSModel) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread] distinctUntilChanged] subscribeNext:^(RQYDTJSModel *ydtJSModel) {
- @strongify(self)
- int tryCount = RQ_USER_MANAGER.tryLookCount;
- if(RQ_Exercise_Module.currentExerciseType == RQExerciseType_Recitation){//背题模式
- tryCount = 0;
- }
- if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne) {
- if (RQ_VIP_Module.isSubject1Vip||tryCount>0) {
- self.bottom_view.hidden = YES;
- } else {
- self.bottom_view.hidden = NO;
- }
- } else if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour) {
- if (RQ_VIP_Module.isSubject4Vip||tryCount>0) {
- self.bottom_view.hidden = YES;
- } else {
- self.bottom_view.hidden = NO;
- }
- } else if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectOne_LI) {
- if (RQ_VIP_Module.isSpSubject1Vip||tryCount>0) {
- self.bottom_view.hidden = YES;
- } else {
- self.bottom_view.hidden = NO;
- }
- } else if (RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour_LI) {
- if (RQ_VIP_Module.isSpSubject4Vip||tryCount>0) {
- self.bottom_view.hidden = YES;
- } else {
- self.bottom_view.hidden = NO;
- }
- }else {
- self.bottom_view.hidden = YES;
- }
- // self.skillLabel.hidden = RQObjectIsNil(ydtJSModel);
- }];
-
- }
- - (IBAction)showSkillAction:(id)sender {
- [RQ_VIP_Module gotoBuyVipWithVipPageType:RQVIPPageType_Full];
- }
- #pragma mark - SystemMethods
- - (void)awakeFromNib {
- [super awakeFromNib];
- self.lock_jq_button.imagePosition = QMUIButtonImagePositionRight;
- self.lock_jq_button.spacingBetweenImageAndTitle = 8;
- [self.lock_jq_button setBackgroundImage:[UIImage imageWithGradualChangingColor:^(QQGradualChangingColor *graColor) {
- graColor.fromColor = [UIColor qmui_colorWithHexString:@"#FF7E4D"];
- graColor.toColor = [UIColor qmui_colorWithHexString:@"#FF4D53"];
- graColor.type = QQGradualChangeTypeLeftToRight;
- } size:CGSizeMake(RQ_FIT_HORIZONTAL(128.f), RQ_FIT_HORIZONTAL(34.f)) cornerRadius:QQRadiusMakeSame(RQ_FIT_HORIZONTAL(34.f) / 2.f)] forState:UIControlStateNormal];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- @end
|