AppointmentManageCell.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. //
  2. // AppointmentManageCell.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/31.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "AppointmentManageCell.h"
  9. #import "AppointmentManageModel.h"
  10. @interface AppointmentManageCell ()
  11. @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
  12. @property (nonatomic, readwrite, strong) UILabel *nameLabel;
  13. @property (nonatomic, readwrite, strong) YYLabel *statusLabel;
  14. @property (nonatomic, readwrite, strong) UILabel *timeLabel;
  15. @property (nonatomic, readwrite, strong) UILabel *objectLabel;
  16. @end
  17. @implementation AppointmentManageCell
  18. #pragma mark - Life Cycle
  19. - (instancetype)initWithFrame:(CGRect)frame {
  20. self = [super initWithFrame:frame];
  21. if (self) {
  22. self.contentView.backgroundColor = UIColor.whiteColor;
  23. [self.contentView addSubview:self.nameLabel];
  24. [self.contentView addSubview:self.statusLabel];
  25. [self.contentView addSubview:self.timeLabel];
  26. [self.contentView addSubview:self.objectLabel];
  27. }
  28. return self;
  29. }
  30. - (void)layoutSubviews {
  31. [super layoutSubviews];
  32. [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.top.left.mas_offset(16);
  34. make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 3) * (1.f / 2.f), (self.bounds.size.height - 3 * 16) / 2.f));
  35. }];
  36. [_statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.top.mas_equalTo(_nameLabel);
  38. make.right.mas_offset(-16);
  39. make.size.mas_equalTo(_nameLabel);
  40. }];
  41. [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.top.mas_equalTo(_nameLabel.mas_bottom).mas_offset(16);
  43. make.left.mas_equalTo(_nameLabel);
  44. make.size.mas_equalTo(_nameLabel);
  45. }];
  46. [_objectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.top.mas_equalTo(_statusLabel.mas_bottom).mas_offset(16);
  48. make.right.mas_equalTo(-16);
  49. make.size.mas_equalTo(_nameLabel);
  50. }];
  51. }
  52. #pragma mark - HDUpdateUIProtocol
  53. - (void)updateCellUI:(__kindof HDCellModel *)model {
  54. AppointmentManageModel *appointmentManageModel = model.orgData;
  55. self.nameLabel.text = [NSString stringWithFormat:@"学员:%@", appointmentManageModel.name];
  56. self.timeLabel.text = [NSString stringWithFormat:@"考试时间:%@", appointmentManageModel.date];
  57. self.objectLabel.text = [NSString stringWithFormat:@"科目:%@", appointmentManageModel.object];
  58. _statusLabel.text = [NSString stringWithFormat:@"状态:%@",appointmentManageModel.status];
  59. NSMutableAttributedString *remarkLabelAttStr = [[NSMutableAttributedString alloc] initWithString:_statusLabel.text];
  60. remarkLabelAttStr.yy_color = RQGreenColor;
  61. [remarkLabelAttStr yy_setColor:RQTitleTextColor range:[_statusLabel.text rangeOfString:@"状态:"]];
  62. remarkLabelAttStr.yy_font = [UIFont systemFontOfSize:16];
  63. remarkLabelAttStr.yy_alignment = NSTextAlignmentRight;
  64. _statusLabel.attributedText = remarkLabelAttStr;
  65. }
  66. #pragma mark - Lazy Load
  67. - (UILabel *)nameLabel {
  68. if (!_nameLabel) {
  69. _nameLabel = [[UILabel alloc] init];
  70. _nameLabel.text = @"学员:";
  71. _nameLabel.textAlignment = NSTextAlignmentLeft;
  72. _nameLabel.textColor = RQTitleTextColor;
  73. _nameLabel.numberOfLines = 0;
  74. _nameLabel.font = [UIFont systemFontOfSize:16];
  75. }
  76. return _nameLabel;
  77. }
  78. - (YYLabel *)statusLabel {
  79. if (!_statusLabel) {
  80. _statusLabel = [[YYLabel alloc] init];
  81. _statusLabel.text = @"状态:";
  82. _statusLabel.textAlignment = NSTextAlignmentRight;
  83. _statusLabel.textColor = RQTitleTextColor;
  84. _statusLabel.numberOfLines = 0;
  85. _statusLabel.font = [UIFont systemFontOfSize:16];
  86. }
  87. return _statusLabel;
  88. }
  89. - (UILabel *)timeLabel {
  90. if (!_timeLabel) {
  91. _timeLabel = [[UILabel alloc] init];
  92. _timeLabel.text = @"考试时间:2019-09-09";
  93. _timeLabel.textAlignment = NSTextAlignmentLeft;
  94. _timeLabel.textColor = RQTitleTextColor;
  95. _timeLabel.numberOfLines = 0;
  96. _timeLabel.font = [UIFont systemFontOfSize:16];
  97. }
  98. return _timeLabel;
  99. }
  100. - (UILabel *)objectLabel {
  101. if (!_objectLabel) {
  102. _objectLabel = [[UILabel alloc] init];
  103. _objectLabel.text = @"科目:";
  104. _objectLabel.textAlignment = NSTextAlignmentRight;
  105. _objectLabel.textColor = RQTitleTextColor;
  106. _objectLabel.numberOfLines = 0;
  107. _objectLabel.font = [UIFont systemFontOfSize:16];
  108. }
  109. return _objectLabel;
  110. }
  111. @end