StudentTableCell.m 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //
  2. // StudentTableCell.m
  3. // jiaPeiC
  4. //
  5. // Created by apple on 16/3/7.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "StudentTableCell.h"
  9. #import "UIImageView+WebCache.h"
  10. @implementation StudentTableCell
  11. - (void)awakeFromNib {
  12. [super awakeFromNib];
  13. _xxBtn.hidden = YES;//2018/2/5 屏蔽添加休学(辽宁无休学)
  14. _headImg.contentMode = UIViewContentModeScaleAspectFill;
  15. _headImg.clipsToBounds = YES;
  16. _headImg.layer.borderWidth = 1;
  17. _headImg.layer.borderColor = defGreen.CGColor;
  18. CGFloat x,y,w,h;
  19. x = 9;
  20. y = 125;
  21. w = 20;
  22. h = 20;
  23. UIImageView *xxImg = [[UIImageView alloc] setxywh];
  24. xxImg.image = [UIImage imageNamed:@"xiuxue"];
  25. [self addSubview:xxImg];
  26. x = 25;
  27. y = 125;
  28. w = 70;
  29. _xxBtn = [[UIButton alloc] setxywh];
  30. [self addSubview:_xxBtn];
  31. x = 10;
  32. y = 150;
  33. h = 25;
  34. w = kSize.width - 20;
  35. _tongGuoLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
  36. [self addSubview:_tongGuoLabel];
  37. y +=h;
  38. _learnTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
  39. [self addSubview:_learnTimeLabel];
  40. y +=h;
  41. _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(x, y, w, h)];
  42. [self addSubview:_stateLabel];
  43. _baoMingLabel.textAlignment = NSTextAlignmentLeft;
  44. _tongGuoLabel.textAlignment = NSTextAlignmentLeft;
  45. _learnTimeLabel.textAlignment = NSTextAlignmentLeft;
  46. _stateLabel.textAlignment = NSTextAlignmentLeft;
  47. _baoMingLabel.textColor = contentTextColor;
  48. _tongGuoLabel.textColor = contentTextColor;
  49. _learnTimeLabel.textColor = contentTextColor;
  50. _stateLabel.textColor = contentTextColor;
  51. [_baoMingLabel setFont:[UIFont systemFontOfSize:Font14]];
  52. [_tongGuoLabel setFont:[UIFont systemFontOfSize:Font14]];
  53. [_stateLabel setFont:[UIFont systemFontOfSize:Font14]];
  54. [_learnTimeLabel setFont:[UIFont systemFontOfSize:Font14]];
  55. if (kSize.width > 350.0)
  56. {
  57. [_nameLabel setFont:[UIFont scaleSize:Font16]];
  58. [_sexLabel setFont:[UIFont scaleSize:Font16]];
  59. [_telLabel setFont:[UIFont scaleSize:Font16]];
  60. [_sfzhmLabel setFont:[UIFont scaleSize:Font16]];
  61. [_baoMingLabel setFont:[UIFont scaleSize:Font16]];
  62. [_tongGuoLabel setFont:[UIFont scaleSize:Font16]];
  63. [_stateLabel setFont:[UIFont scaleSize:Font16]];
  64. [_learnTimeLabel setFont:[UIFont scaleSize:Font16]];
  65. }
  66. }
  67. -(void)setModel:(NSDictionary *)model
  68. {
  69. NSString *headString = model[@"TSO_PHOTO_PATH"];//2018/2/1更改原TSO_PHOTO
  70. if (!headString || headString.length == 0) {
  71. headString = model[@"HEADIMG"];
  72. }
  73. if (!headString) {
  74. headString = @"";
  75. }
  76. [_headImg sd_setImageWithURL:[NSURL URLWithString:headString] placeholderImage:[UIImage imageNamed:@"noHeadImg.png"]];
  77. //学员信息在这里改动
  78. _nameLabel.text = [NSString stringWithFormat:@"学员姓名:%@",model[@"TSO_NAME"]];
  79. _sexLabel.text = [NSString stringWithFormat:@"性别:%@",[model[@"TSO_SEX"] isEqualToString: @"1"] ? @"男" : @"女"];
  80. [_telBtn setTitle:model[@"TSO_PHONE"] textColor:defGreen font:Font16 fotState:UIControlStateNormal];
  81. _sfzhmLabel.text = [NSString stringWithFormat:@"证件号码:%@",model[@"TSO_IDCARD"]];
  82. NSString *kString = model[@"CRDATE"];
  83. if ([kString containsString:@"-"]) {
  84. kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."];
  85. }
  86. _baoMingLabel.text = [NSString stringWithFormat:@"报名日期:%@",kString];
  87. int time = [model[@"FINISH_TRAIN"] intValue];
  88. if (_studeState == 1) {
  89. _tongGuoLabel.text = [NSString stringWithFormat:@"科一暂未通过%@",@""];
  90. _learnTimeLabel.text = [NSString stringWithFormat:@"科一完成学时:%d小时%d分",time/60,time%60];
  91. _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科一"];
  92. }else if (_studeState == 2) {
  93. kString = model[@"KSRQ"];
  94. if ([kString containsString:@"-"]) {
  95. kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."];
  96. }
  97. if (kString.length > 10) {
  98. kString = [kString substringToIndex:10];
  99. }
  100. _tongGuoLabel.text = [NSString stringWithFormat:@"科一通过日期:%@",kString];
  101. _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科二"];//[model[@"TRAIN_STATE"] isEqualToString:@"0"] ? @"未通过" : @"已通过"
  102. _learnTimeLabel.text = [NSString stringWithFormat:@"科二完成学时:%d小时%d分",time/60,time%60];
  103. }else if(_studeState == 3){
  104. kString = model[@"KSRQ"];
  105. if ([kString containsString:@"-"]) {
  106. kString = [kString stringByReplacingOccurrencesOfString:@"-" withString:@"."];
  107. }
  108. _tongGuoLabel.text = [NSString stringWithFormat:@"科二通过日期:%@",kString];
  109. NSString *strzz = @"";
  110. switch ([[NSString stringWithFormat:@"%@",model[@"TRAIN_STATE"]] integerValue]) {
  111. case 0:
  112. strzz = @"不允许送审";
  113. break;
  114. case 1:
  115. strzz = @"允许送审";
  116. break;
  117. case 2:
  118. strzz = @"审核通过";
  119. break;
  120. case 3:
  121. strzz = @"退回";
  122. break;
  123. default:
  124. break;
  125. }
  126. _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科三%@",@""];//strzz
  127. _learnTimeLabel.text = [NSString stringWithFormat:@"科三完成学时:%d小时%d分",time/60,time%60];
  128. }else if (_studeState == 4){
  129. _tongGuoLabel.text = [NSString stringWithFormat:@"科三通过日期:%@",kString];
  130. _learnTimeLabel.text = [NSString stringWithFormat:@"科四完成学时:%d小时%d分",time/60,time%60];
  131. _stateLabel.text = [NSString stringWithFormat:@"学习阶段:科四"];
  132. }
  133. }
  134. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  135. [super setSelected:selected animated:animated];
  136. // Configure the view for the selected state
  137. }
  138. - (IBAction)clickToTel:(id)sender {
  139. //拨打电话
  140. NSString* tel = _model[@"TSO_PHONE"];
  141. if (tel && ![tel isEqualToString:@""]) {
  142. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",tel]]];
  143. }
  144. }
  145. @end