// // RQSimulationTestTopicsCell.m // SDJK // // Created by 张嵘 on 2021/8/10. // #import "RQSimulationTestTopicsCell.h" @interface RQSimulationTestTopicsCell () @property (weak, nonatomic) IBOutlet UIView *myContentView; @property (nonatomic, readwrite, strong) RQSimulationTestTopicsItemViewModel *viewModel; @property (weak, nonatomic) IBOutlet UIButton *beginBtn; @property (weak, nonatomic) IBOutlet UILabel *subjectLabel; @property (weak, nonatomic) IBOutlet UILabel *carTypeLabel; @property (weak, nonatomic) IBOutlet UILabel *ruleLabel; @property (weak, nonatomic) IBOutlet UILabel *passStandardLabel; @end @implementation RQSimulationTestTopicsCell #pragma mark - PublicMethods + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"RQSimulationTestTopicsCell"; RQSimulationTestTopicsCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [self rq_viewFromXib]; cell.selectionStyle = UITableViewCellSelectionStyleNone; } return cell; } - (void)bindViewModel:(RQSimulationTestTopicsItemViewModel *)viewModel { _viewModel = viewModel; switch (_viewModel.homePageSubjectType) { case RQHomePageSubjectType_SubjectOne: { _subjectLabel.text = @"科目一"; _passStandardLabel.text = @"90分及格"; switch (_viewModel.homePageCarType) { case RQHomePageCarType_Car: _carTypeLabel.text = @"小车C1/C2/C3"; _ruleLabel.text = @"100题,45分钟"; break; case RQHomePageCarType_Bus: _carTypeLabel.text = @"客车A1/A3/B1"; _ruleLabel.text = @"100题,45分钟"; break; case RQHomePageCarType_Truck: _carTypeLabel.text = @"货车A2/B2"; _ruleLabel.text = @"100题,45分钟"; break; case RQHomePageCarType_Motorcycle: _carTypeLabel.text = @"摩托车"; _ruleLabel.text = @"50题,30分钟"; break; default: break; } break; } case RQHomePageSubjectType_SubjectFour: { _subjectLabel.text = @"科目四"; _passStandardLabel.text = @"90分及格"; switch (_viewModel.homePageCarType) { case RQHomePageCarType_Car: _carTypeLabel.text = @"小车C1/C2/C3"; _ruleLabel.text = @"50题,45分钟"; break; case RQHomePageCarType_Bus: _carTypeLabel.text = @"客车A1/A3/B1"; _ruleLabel.text = @"50题,45分钟"; break; case RQHomePageCarType_Truck: _carTypeLabel.text = @"货车A2/B2"; _ruleLabel.text = @"50题,45分钟"; break; case RQHomePageCarType_Motorcycle: _carTypeLabel.text = @"摩托车"; _ruleLabel.text = @"50题,30分钟"; break; default: break; } break; } default: break; } } #pragma mark - SystemMethods - (void)awakeFromNib { [super awakeFromNib]; // Initialization code _beginBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(40.f) / 2.f; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; _myContentView.layer.shadowColor = [UIColor colorWithHexString:@"#7C8188" alpha:0.2f].CGColor; // Configure the view for the selected state } - (IBAction)brginExamBtnAction:(id)sender { RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{ RQHomePageCarTypeKey : @(_viewModel.homePageCarType), RQHomePageSubjectTypeKey : @(_viewModel.homePageSubjectType), RQHomeSubPageTypeKey : @(_viewModel.homeSubPageType), RQExerciseTypeKey : @(RQExerciseType_Exam), RQViewCommonValueKey : @(0), }]; [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES]; } @end