RQSimulationTestTopicsCell.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // RQSimulationTestTopicsCell.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2021/8/10.
  6. //
  7. #import "RQSimulationTestTopicsCell.h"
  8. @interface RQSimulationTestTopicsCell ()
  9. @property (weak, nonatomic) IBOutlet UIView *myContentView;
  10. @property (nonatomic, readwrite, strong) RQSimulationTestTopicsItemViewModel *viewModel;
  11. @property (weak, nonatomic) IBOutlet UIButton *beginBtn;
  12. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  13. @property (weak, nonatomic) IBOutlet UILabel *carTypeLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *ruleLabel;
  15. @property (weak, nonatomic) IBOutlet UILabel *passStandardLabel;
  16. @end
  17. @implementation RQSimulationTestTopicsCell
  18. #pragma mark - PublicMethods
  19. + (instancetype)cellWithTableView:(UITableView *)tableView {
  20. static NSString *ID = @"RQSimulationTestTopicsCell";
  21. RQSimulationTestTopicsCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  22. if (!cell) {
  23. cell = [self rq_viewFromXib];
  24. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  25. }
  26. return cell;
  27. }
  28. - (void)bindViewModel:(RQSimulationTestTopicsItemViewModel *)viewModel {
  29. _viewModel = viewModel;
  30. switch (_viewModel.homePageSubjectType) {
  31. case RQHomePageSubjectType_SubjectOne: {
  32. _subjectLabel.text = @"科目一";
  33. _passStandardLabel.text = @"90分及格";
  34. switch (_viewModel.homePageCarType) {
  35. case RQHomePageCarType_Car:
  36. _carTypeLabel.text = @"小车C1/C2/C3";
  37. _ruleLabel.text = @"100题,45分钟";
  38. break;
  39. case RQHomePageCarType_Bus:
  40. _carTypeLabel.text = @"客车A1/A3/B1";
  41. _ruleLabel.text = @"100题,45分钟";
  42. break;
  43. case RQHomePageCarType_Truck:
  44. _carTypeLabel.text = @"货车A2/B2";
  45. _ruleLabel.text = @"100题,45分钟";
  46. break;
  47. case RQHomePageCarType_Motorcycle:
  48. _carTypeLabel.text = @"摩托车";
  49. _ruleLabel.text = @"50题,30分钟";
  50. break;
  51. default:
  52. break;
  53. }
  54. break;
  55. }
  56. case RQHomePageSubjectType_SubjectFour: {
  57. _subjectLabel.text = @"科目四";
  58. _passStandardLabel.text = @"90分及格";
  59. switch (_viewModel.homePageCarType) {
  60. case RQHomePageCarType_Car:
  61. _carTypeLabel.text = @"小车C1/C2/C3";
  62. _ruleLabel.text = @"50题,45分钟";
  63. break;
  64. case RQHomePageCarType_Bus:
  65. _carTypeLabel.text = @"客车A1/A3/B1";
  66. _ruleLabel.text = @"50题,45分钟";
  67. break;
  68. case RQHomePageCarType_Truck:
  69. _carTypeLabel.text = @"货车A2/B2";
  70. _ruleLabel.text = @"50题,45分钟";
  71. break;
  72. case RQHomePageCarType_Motorcycle:
  73. _carTypeLabel.text = @"摩托车";
  74. _ruleLabel.text = @"50题,30分钟";
  75. break;
  76. default:
  77. break;
  78. }
  79. break;
  80. }
  81. default:
  82. break;
  83. }
  84. }
  85. #pragma mark - SystemMethods
  86. - (void)awakeFromNib {
  87. [super awakeFromNib];
  88. // Initialization code
  89. _beginBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(40.f) / 2.f;
  90. }
  91. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  92. [super setSelected:selected animated:animated];
  93. _myContentView.layer.shadowColor = [UIColor colorWithHexString:@"#7C8188" alpha:0.2f].CGColor;
  94. // Configure the view for the selected state
  95. }
  96. - (IBAction)brginExamBtnAction:(id)sender {
  97. RQExerciseViewModel *exerciseViewModel = [[RQExerciseViewModel alloc] initWithServices:RQ_APPDELEGATE.services params:@{
  98. RQHomePageCarTypeKey : @(_viewModel.homePageCarType),
  99. RQHomePageSubjectTypeKey : @(_viewModel.homePageSubjectType),
  100. RQHomeSubPageTypeKey : @(_viewModel.homeSubPageType),
  101. RQExerciseTypeKey : @(RQExerciseType_Exam),
  102. RQViewCommonValueKey : @(0),
  103. }];
  104. [RQ_APPDELEGATE.services pushViewModel:exerciseViewModel animated:YES];
  105. }
  106. @end