123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- //
- // TrainSummaryHoursCell.m
- // LN_School
- //
- // Created by 张嵘 on 2019/7/28.
- // Copyright © 2019 Danson. All rights reserved.
- //
- #import "TrainSummaryHoursCell.h"
- #import "ShowPhotoesViewController.h"
- @interface TrainSummaryHoursCell ()
- @property (nonatomic, readwrite, strong) UILabel *stageLabel;
- @property (nonatomic, readwrite, strong) UIImageView *centerLineView;
- @property (nonatomic, readwrite, strong) UILabel *theoryHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *practicalOperationHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *mileageHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *simulateHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *assessmentHoursLabel;
- @property (nonatomic, readwrite, strong) UILabel *classTrainingHoursLabel;
- @property (nonatomic, readwrite, strong) UIImageView *bottomLineView;
- @property (nonatomic, readwrite, strong) UIButton *showPhotoesBtn;
- @property (nonatomic, readwrite, strong) UILabel *totalHoursLabel;
- @end
- @implementation TrainSummaryHoursCell
- #pragma mark - Life Cycle
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.contentView.backgroundColor = UIColor.whiteColor;
- [self.contentView addSubview:self.stageLabel];
- [self.contentView addSubview:self.centerLineView];
- [self.contentView addSubview:self.theoryHoursLabel];
- [self.contentView addSubview:self.practicalOperationHoursLabel];
- [self.contentView addSubview:self.mileageHoursLabel];
- [self.contentView addSubview:self.simulateHoursLabel];
- [self.contentView addSubview:self.assessmentHoursLabel];
- [self.contentView addSubview:self.classTrainingHoursLabel];
- [self.contentView addSubview:self.bottomLineView];
- [self.contentView addSubview:self.showPhotoesBtn];
- [self.contentView addSubview:self.totalHoursLabel];
- }
- return self;
- }
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [_stageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.mas_offset(16);
- make.size.mas_equalTo(CGSizeMake((self.bounds.size.width - 16 * 5) * (1.f / 3.f), (self.bounds.size.height - 7 * 16) / 4.f));
- }];
-
- [_centerLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_stageLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.right.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
-
- [_theoryHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_centerLineView.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_practicalOperationHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_theoryHoursLabel);
- make.centerX.mas_equalTo(self.contentView);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_mileageHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_theoryHoursLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_simulateHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_theoryHoursLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_assessmentHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_simulateHoursLabel);
- make.centerX.mas_equalTo(self.contentView);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_classTrainingHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_simulateHoursLabel);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
-
- [_bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_simulateHoursLabel.mas_bottom).mas_offset(16);
- make.left.mas_equalTo(_stageLabel);
- make.right.mas_offset(0);
- make.height.mas_equalTo(1);
- }];
-
- [_showPhotoesBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_bottomLineView.mas_bottom).mas_offset(12);
- make.left.mas_equalTo(_stageLabel);
- make.size.mas_equalTo(CGSizeMake(90, (self.bounds.size.height - 5 * 16) / 4.f));
- }];
-
- [_totalHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(_bottomLineView.mas_bottom).mas_offset(16);
- make.right.mas_offset(-16);
- make.size.mas_equalTo(_stageLabel);
- }];
- }
- #pragma mark - HDUpdateUIProtocol
- - (void)updateCellUI:(__kindof HDCellModel *)model {
- // TrainRecordModel *trainRecordModel = model.orgData;
- // [self.headImageView sd_setImageWithURL:[NSURL URLWithString:trainRecordModel.url? : @""] placeholderImage:[UIImage imageNamed:@"HeaderPlacehold"]];
- // self.timeLabel.text = [NSString stringWithFormat:@"时间:%@",trainRecordModel.time];
- // self.stageLabel.text = [NSString stringWithFormat:@"阶段:%@",trainRecordModel.stage];
- // self.driverObjectLabel.text = [NSString stringWithFormat:@"类型:%@",trainRecordModel.object];
- // self.driverHoursLabel.text = [NSString stringWithFormat:@"学时:%@",trainRecordModel.hour];
- }
- #pragma mark - Private Functions
- - (void)showPhotoesBtnAction {
- ShowPhotoesViewController *vc = [[ShowPhotoesViewController alloc] init];
- [[RQ_SHARE_FUNCTION getCurrentVC] navPushHideTabbarToVC:vc];
- }
- #pragma mark - Lazy Load
- - (UILabel *)stageLabel {
- if (!_stageLabel) {
- _stageLabel = [[UILabel alloc] init];
- _stageLabel.text = @"阶段三";
- _stageLabel.textAlignment = NSTextAlignmentLeft;
- _stageLabel.textColor = RQSubColor;
- _stageLabel.numberOfLines = 0;
- _stageLabel.font = [UIFont systemFontOfSize:16];
- }
- return _stageLabel;
- }
- - (UIImageView *)centerLineView {
- if (!_centerLineView) {
- _centerLineView = [[UIImageView alloc] init];
- _centerLineView.backgroundColor = RQBackGroundColor;
- }
- return _centerLineView;
- }
- - (UILabel *)theoryHoursLabel {
- if (!_theoryHoursLabel) {
- _theoryHoursLabel = [[UILabel alloc] init];
- _theoryHoursLabel.text = @"理论:25";
- _theoryHoursLabel.textAlignment = NSTextAlignmentLeft;
- _theoryHoursLabel.textColor = RQTitleTextColor;
- _theoryHoursLabel.numberOfLines = 0;
- _theoryHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _theoryHoursLabel;
- }
- - (UILabel *)practicalOperationHoursLabel {
- if (!_practicalOperationHoursLabel) {
- _practicalOperationHoursLabel = [[UILabel alloc] init];
- _practicalOperationHoursLabel.text = @"实操:25";
- _practicalOperationHoursLabel.textAlignment = NSTextAlignmentCenter;
- _practicalOperationHoursLabel.textColor = RQTitleTextColor;
- _practicalOperationHoursLabel.numberOfLines = 0;
- _practicalOperationHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _practicalOperationHoursLabel;
- }
- - (UILabel *)mileageHoursLabel {
- if (!_mileageHoursLabel) {
- _mileageHoursLabel = [[UILabel alloc] init];
- _mileageHoursLabel.text = @"里程:25";
- _mileageHoursLabel.textAlignment = NSTextAlignmentRight;
- _mileageHoursLabel.textColor = RQTitleTextColor;
- _mileageHoursLabel.numberOfLines = 0;
- _mileageHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _mileageHoursLabel;
- }
- - (UILabel *)simulateHoursLabel {
- if (!_simulateHoursLabel) {
- _simulateHoursLabel = [[UILabel alloc] init];
- _simulateHoursLabel.text = @"模拟:25";
- _simulateHoursLabel.textAlignment = NSTextAlignmentLeft;
- _simulateHoursLabel.textColor = RQTitleTextColor;
- _simulateHoursLabel.numberOfLines = 0;
- _simulateHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _simulateHoursLabel;
- }
- - (UILabel *)assessmentHoursLabel {
- if (!_assessmentHoursLabel) {
- _assessmentHoursLabel = [[UILabel alloc] init];
- _assessmentHoursLabel.text = @"考核:25";
- _assessmentHoursLabel.textAlignment = NSTextAlignmentCenter;
- _assessmentHoursLabel.textColor = RQTitleTextColor;
- _assessmentHoursLabel.numberOfLines = 0;
- _assessmentHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _assessmentHoursLabel;
- }
- - (UILabel *)classTrainingHoursLabel {
- if (!_classTrainingHoursLabel) {
- _classTrainingHoursLabel = [[UILabel alloc] init];
- _classTrainingHoursLabel.text = @"堂训:25";
- _classTrainingHoursLabel.textAlignment = NSTextAlignmentRight;
- _classTrainingHoursLabel.textColor = RQTitleTextColor;
- _classTrainingHoursLabel.numberOfLines = 0;
- _classTrainingHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _classTrainingHoursLabel;
- }
- - (UIImageView *)bottomLineView {
- if (!_bottomLineView) {
- _bottomLineView = [[UIImageView alloc] init];
- _bottomLineView.backgroundColor = RQBackGroundColor;
- }
- return _bottomLineView;
- }
- - (UIButton *)showPhotoesBtn {
- if (!_showPhotoesBtn) {
- _showPhotoesBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _showPhotoesBtn.layer.borderWidth = 1;
- _showPhotoesBtn.layer.borderColor = RQGreenColor.CGColor;
- _showPhotoesBtn.layer.cornerRadius = 5;
- _showPhotoesBtn.layer.masksToBounds = YES;
- _showPhotoesBtn.titleLabel.font = [UIFont systemFontOfSize:16];
- _showPhotoesBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- [_showPhotoesBtn setTitle:@"查看照片" forState:UIControlStateNormal];
- [_showPhotoesBtn setTitleColor:RQGreenColor forState:UIControlStateNormal];
- [_showPhotoesBtn addTarget:self action:@selector(showPhotoesBtnAction) forControlEvents:UIControlEventTouchUpInside];
- }
- return _showPhotoesBtn;
- }
- - (UILabel *)totalHoursLabel {
- if (!_totalHoursLabel) {
- _totalHoursLabel = [[UILabel alloc] init];
- _totalHoursLabel.text = @"合计:150";
- _totalHoursLabel.textAlignment = NSTextAlignmentRight;
- _totalHoursLabel.textColor = RQGreenColor;
- _totalHoursLabel.numberOfLines = 0;
- _totalHoursLabel.font = [UIFont systemFontOfSize:16];
- }
- return _totalHoursLabel;
- }
- @end
|