// // StudentTableCell.m // jiaPeiC // // Created by apple on 16/3/7. // Copyright © 2016年 JCZ. All rights reserved. // #import "StudentTableCell.h" #import "UIImageView+WebCache.h" @implementation StudentTableCell - (void)awakeFromNib { [super awakeFromNib]; _xxBtn.hidden = YES;//2018/2/5 屏蔽添加休学(辽宁无休学) _headImg.contentMode = UIViewContentModeScaleAspectFill; _headImg.clipsToBounds = YES; _headImg.layer.borderWidth = 1; _headImg.layer.borderColor = defGreen.CGColor; CGFloat x,y,w,h; x = 9; y = 125; w = 20; h = 20; UIImageView *xxImg = [[UIImageView alloc] setxywh]; xxImg.image = [UIImage imageNamed:@"xiuxue"]; [self addSubview:xxImg]; x = 25; y = 125; w = 70; _xxBtn = [[UIButton alloc] setxywh]; [self addSubview:_xxBtn]; x = 10; y = 150; h = 25; w = kSize.width - 20; _tongGuoLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)]; [self addSubview:_tongGuoLabel]; y +=h; _learnTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)]; [self addSubview:_learnTimeLabel]; y +=h; _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)]; [self addSubview:_stateLabel]; _baoMingLabel.textAlignment = NSTextAlignmentLeft; _tongGuoLabel.textAlignment = NSTextAlignmentLeft; _learnTimeLabel.textAlignment = NSTextAlignmentLeft; _stateLabel.textAlignment = NSTextAlignmentLeft; _baoMingLabel.textColor = contentTextColor; _tongGuoLabel.textColor = contentTextColor; _learnTimeLabel.textColor = contentTextColor; _stateLabel.textColor = contentTextColor; [_baoMingLabel setFont:[UIFont systemFontOfSize:Font14]]; [_tongGuoLabel setFont:[UIFont systemFontOfSize:Font14]]; [_stateLabel setFont:[UIFont systemFontOfSize:Font14]]; [_learnTimeLabel setFont:[UIFont systemFontOfSize:Font14]]; if (kSize.width > 350.0) { [_nameLabel setFont:[UIFont scaleSize:Font16]]; [_sexLabel setFont:[UIFont scaleSize:Font16]]; [_telLabel setFont:[UIFont scaleSize:Font16]]; [_sfzhmLabel setFont:[UIFont scaleSize:Font16]]; [_baoMingLabel setFont:[UIFont scaleSize:Font16]]; [_tongGuoLabel setFont:[UIFont scaleSize:Font16]]; [_stateLabel setFont:[UIFont scaleSize:Font16]]; [_learnTimeLabel setFont:[UIFont scaleSize:Font16]]; } } -(void)setModel:(NSDictionary *)model { NSString *headString = model[@"TSO_PHOTO_PATH"];//2018/2/1更改原TSO_PHOTO if (!headString || headString.length == 0) { headString = model[@"HEADIMG"]; } if (!headString) { headString = @""; } [_headImg sd_setImageWithURL:[NSURL URLWithString:headString] placeholderImage:[UIImage imageNamed:@"noHeadImg.png"]]; //学员信息在这里改动 _nameLabel.text = [NSString stringWithFormat:@"学员姓名:%@",model[@"TSO_NAME"]]; _sexLabel.text = [NSString stringWithFormat:@"性别:%@",[model[@"TSO_SEX"] isEqualToString: @"1"] ? @"男" : @"女"]; [_telBtn setTitle:model[@"TSO_PHONE"] textColor:defGreen font:Font16 fotState:UIControlStateNormal]; _sfzhmLabel.text = [NSString stringWithFormat:@"证件号码:%@",model[@"TSO_IDCARD"]]; NSString *kString = model[@"CRDATE"]; if ([kString containsString:@"-"]) { kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."]; } _baoMingLabel.text = [NSString stringWithFormat:@"报名日期:%@",kString]; int time = [model[@"FINISH_TRAIN"] intValue]; if (_studeState == 1) { _tongGuoLabel.text = [NSString stringWithFormat:@"科一暂未通过%@",@""]; _learnTimeLabel.text = [NSString stringWithFormat:@"科一完成学时:%d小时%d分",time/60,time%60]; _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科一"]; }else if (_studeState == 2) { kString = model[@"KSRQ"]; if ([kString containsString:@"-"]) { kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."]; } if (kString.length > 10) { kString = [kString substringToIndex:10]; } _tongGuoLabel.text = [NSString stringWithFormat:@"科一通过日期:%@",kString]; _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科二"];//[model[@"TRAIN_STATE"] isEqualToString:@"0"] ? @"未通过" : @"已通过" _learnTimeLabel.text = [NSString stringWithFormat:@"科二完成学时:%d小时%d分",time/60,time%60]; }else if(_studeState == 3){ kString = model[@"KSRQ"]; if ([kString containsString:@"-"]) { kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."]; } _tongGuoLabel.text = [NSString stringWithFormat:@"科二通过日期:%@",kString]; NSString *strzz = @""; switch ([[NSString stringWithFormat:@"%@",model[@"TRAIN_STATE"]] integerValue]) { case 0: strzz = @"不允许送审"; break; case 1: strzz = @"允许送审"; break; case 2: strzz = @"审核通过"; break; case 3: strzz = @"退回"; break; default: break; } _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科三%@",@""];//strzz _learnTimeLabel.text = [NSString stringWithFormat:@"科三完成学时:%d小时%d分",time/60,time%60]; }else if (_studeState == 4){ _tongGuoLabel.text = [NSString stringWithFormat:@"科三通过日期:%@",kString]; _learnTimeLabel.text = [NSString stringWithFormat:@"科四完成学时:%d小时%d分",time/60,time%60]; _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科四"]; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (IBAction)clickToTel:(id)sender { //拨打电话 NSString* tel = _model[@"TSO_PHONE"]; if (tel && ![tel isEqualToString:@""]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",tel]]]; } } @end