// // StudentTableCell.m // jiaPeiC // // Created by apple on 16/3/7. // Copyright © 2016年 JCZ. All rights reserved. // #import "StudentTableCell.h" @implementation StudentTableCell - (void)awakeFromNib { [super awakeFromNib]; _headImg.contentMode = UIViewContentModeScaleAspectFill; _headImg.clipsToBounds = YES; _headImg.layer.borderWidth = 1; _headImg.layer.borderColor = defGreen.CGColor; CGFloat x,y,w,h,bd; 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]; bd = 15; x = 10; y = 140 + bd; h = 25; w = kSize.width - 20; _baoMingLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w * 15/32.0, h)]; [self addSubview:_baoMingLabel]; x += w * 15/32.0 + 5; _tongGuoLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w * 17/32.0 + 10, h)]; [self addSubview:_tongGuoLabel]; y += bd + h + 3; _learnTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w * 17/32.0 + 10, h)]; [self addSubview:_learnTimeLabel]; x = 10; _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w * 15/32.0, 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 { //NSLog(@"---->%@",model); NSString *headString = model[@"TSO_PHOTO"]; if (!headString || headString.length == 0) { headString = model[@"HEADIMG"]; if (headString && ![headString hasPrefix:@"http"]){ headString = [imgPreFix stringByAppendingString:headString]; } }else{ NSString *photoString = @"http://fj.jppt.com.cn"; if (headString && ![headString hasPrefix:@"http"]){ headString = [photoString stringByAppendingString:headString]; } } 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]; _stateLabel.text = [NSString stringWithFormat:@"学习状态:科三%@",model[@"TRAIN_STATE"]]; _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