TrainSummaryHoursRequirementsCell.m 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //
  2. // TrainSummaryHoursRequirementsCell.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/28.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "TrainSummaryHoursRequirementsCell.h"
  9. @interface TrainSummaryHoursRequirementsCell ()
  10. @property (nonatomic, readwrite, strong) UILabel *stageLabel;
  11. @property (nonatomic, readwrite, strong) UILabel *totalHoursLabel;
  12. @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
  13. @property (nonatomic, readwrite, strong) UILabel *theoryHoursLabel;
  14. @property (nonatomic, readwrite, strong) UILabel *practicalOperationHoursLabel;
  15. @property (nonatomic, readwrite, strong) UILabel *simulateHoursLabel;
  16. @property (nonatomic, readwrite, strong) UILabel *assessmentHoursLabel;
  17. @end
  18. @implementation TrainSummaryHoursRequirementsCell
  19. #pragma mark - Life Cycle
  20. - (instancetype)initWithFrame:(CGRect)frame {
  21. self = [super initWithFrame:frame];
  22. if (self) {
  23. self.contentView.backgroundColor = UIColor.whiteColor;
  24. [self.contentView addSubview:self.stageLabel];
  25. [self.contentView addSubview:self.totalHoursLabel];
  26. [self.contentView addSubview:self.centerLineView];
  27. [self.contentView addSubview:self.theoryHoursLabel];
  28. [self.contentView addSubview:self.practicalOperationHoursLabel];
  29. [self.contentView addSubview:self.simulateHoursLabel];
  30. [self.contentView addSubview:self.assessmentHoursLabel];
  31. }
  32. return self;
  33. }
  34. - (void)layoutSubviews {
  35. [super layoutSubviews];
  36. [_stageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.top.left.mas_offset(16);
  38. make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * 0.5, (self.bounds.size.height - 5 * 16) / 3.f));
  39. }];
  40. [_totalHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.top.mas_equalTo(_stageLabel);
  42. make.right.mas_offset(-16);
  43. make.size.mas_equalTo(_stageLabel);
  44. }];
  45. [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.mas_equalTo(_stageLabel.mas_bottom).mas_offset(16);
  47. make.left.mas_equalTo(_stageLabel);
  48. make.right.mas_offset(0);
  49. make.height.mas_equalTo(1);
  50. }];
  51. [_theoryHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.top.mas_equalTo(_centerLineView.mas_bottom).mas_offset(16);
  53. make.left.mas_equalTo(_stageLabel);
  54. make.size.mas_equalTo(_stageLabel);
  55. }];
  56. [_practicalOperationHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.top.mas_equalTo(_theoryHoursLabel);
  58. make.right.mas_offset(-16);
  59. make.size.mas_equalTo(_stageLabel);
  60. }];
  61. [_simulateHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.top.mas_equalTo(_theoryHoursLabel.mas_bottom).mas_offset(16);
  63. make.left.mas_equalTo(_stageLabel);
  64. make.size.mas_equalTo(_stageLabel);
  65. }];
  66. [_assessmentHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.top.mas_equalTo(_simulateHoursLabel);
  68. make.right.mas_offset(-16);
  69. make.size.mas_equalTo(_stageLabel);
  70. }];
  71. }
  72. #pragma mark - HDUpdateUIProtocol
  73. - (void)updateCellUI:(__kindof HDCellModel *)model {
  74. // TrainRecordModel *trainRecordModel = model.orgData;
  75. // [self.headImageView sd_setImageWithURL:[NSURL URLWithString:trainRecordModel.url? : @""] placeholderImage:[UIImage imageNamed:@"HeaderPlacehold"]];
  76. // self.timeLabel.text = [NSString stringWithFormat:@"时间:%@",trainRecordModel.time];
  77. // self.stageLabel.text = [NSString stringWithFormat:@"阶段:%@",trainRecordModel.stage];
  78. // self.driverObjectLabel.text = [NSString stringWithFormat:@"类型:%@",trainRecordModel.object];
  79. // self.driverHoursLabel.text = [NSString stringWithFormat:@"学时:%@",trainRecordModel.hour];
  80. }
  81. #pragma mark - Lazy Load
  82. - (UILabel *)stageLabel {
  83. if (!_stageLabel) {
  84. _stageLabel = [[UILabel alloc] init];
  85. _stageLabel.text = @"阶段三";
  86. _stageLabel.textAlignment = NSTextAlignmentLeft;
  87. _stageLabel.textColor = RQSubColor;
  88. _stageLabel.numberOfLines = 0;
  89. _stageLabel.font = [UIFont systemFontOfSize:16];
  90. }
  91. return _stageLabel;
  92. }
  93. - (UILabel *)totalHoursLabel {
  94. if (!_totalHoursLabel) {
  95. _totalHoursLabel = [[UILabel alloc] init];
  96. _totalHoursLabel.text = @"合计:100";
  97. _totalHoursLabel.textAlignment = NSTextAlignmentRight;
  98. _totalHoursLabel.textColor = RQGreenColor;
  99. _totalHoursLabel.numberOfLines = 0;
  100. _totalHoursLabel.font = [UIFont systemFontOfSize:16];
  101. }
  102. return _totalHoursLabel;
  103. }
  104. - (UIImageView *)centerLineView {
  105. if (!_centerLineView) {
  106. _centerLineView = [[UIImageView alloc] init];
  107. _centerLineView.backgroundColor = RQBackGroundColor;
  108. }
  109. return _centerLineView;
  110. }
  111. - (UILabel *)theoryHoursLabel {
  112. if (!_theoryHoursLabel) {
  113. _theoryHoursLabel = [[UILabel alloc] init];
  114. _theoryHoursLabel.text = @"理论:25";
  115. _theoryHoursLabel.textAlignment = NSTextAlignmentLeft;
  116. _theoryHoursLabel.textColor = RQTitleTextColor;
  117. _theoryHoursLabel.numberOfLines = 0;
  118. _theoryHoursLabel.font = [UIFont systemFontOfSize:16];
  119. }
  120. return _theoryHoursLabel;
  121. }
  122. - (UILabel *)practicalOperationHoursLabel {
  123. if (!_practicalOperationHoursLabel) {
  124. _practicalOperationHoursLabel = [[UILabel alloc] init];
  125. _practicalOperationHoursLabel.text = @"实操:25";
  126. _practicalOperationHoursLabel.textAlignment = NSTextAlignmentRight;
  127. _practicalOperationHoursLabel.textColor = RQTitleTextColor;
  128. _practicalOperationHoursLabel.numberOfLines = 0;
  129. _practicalOperationHoursLabel.font = [UIFont systemFontOfSize:16];
  130. }
  131. return _practicalOperationHoursLabel;
  132. }
  133. - (UILabel *)simulateHoursLabel {
  134. if (!_simulateHoursLabel) {
  135. _simulateHoursLabel = [[UILabel alloc] init];
  136. _simulateHoursLabel.text = @"模拟:25";
  137. _simulateHoursLabel.textAlignment = NSTextAlignmentLeft;
  138. _simulateHoursLabel.textColor = RQTitleTextColor;
  139. _simulateHoursLabel.numberOfLines = 0;
  140. _simulateHoursLabel.font = [UIFont systemFontOfSize:16];
  141. }
  142. return _simulateHoursLabel;
  143. }
  144. - (UILabel *)assessmentHoursLabel {
  145. if (!_assessmentHoursLabel) {
  146. _assessmentHoursLabel = [[UILabel alloc] init];
  147. _assessmentHoursLabel.text = @"考核:25";
  148. _assessmentHoursLabel.textAlignment = NSTextAlignmentRight;
  149. _assessmentHoursLabel.textColor = RQTitleTextColor;
  150. _assessmentHoursLabel.numberOfLines = 0;
  151. _assessmentHoursLabel.font = [UIFont systemFontOfSize:16];
  152. }
  153. return _assessmentHoursLabel;
  154. }
  155. @end