TeachLogCell.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // TeachLogCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/4/12.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "TeachLogCell.h"
  9. @implementation TeachLogCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. -(void)setDataWithDic:(NSDictionary *)dic{
  14. _classId.text = [NSString stringWithFormat:@"%@",dic[@"CRI_CLASSID"]];
  15. _startTime.text = [NSString stringWithFormat:@"%@",dic[@"CRI_STARTTIME"]];
  16. _endTime.text = [NSString stringWithFormat:@"%@",dic[@"CRI_ENDTIME"]];
  17. _stuNum.text = [NSString stringWithFormat:@"%@",dic[@"STUSIM"]];
  18. //二次审核相关
  19. _checkMan.text = [NSString stringWithFormat:@"审核人 : %@",dic[@"CRI_AUDIT_USERNAME"]];
  20. _reason.text = [NSString stringWithFormat:@"审核原因: %@",dic[@"CRI_SECOND_AUDIT_REASON"]];
  21. _checkTime.text = [NSString stringWithFormat:@"审核时间: %@",dic[@"CRI_AUDIT_TIME"]];
  22. _status.text = [NSString stringWithFormat:@"%@",dic[@"CRI_SECOND_AUDIT_RESULT"]];
  23. if ([_status.text isEqualToString:@"1"]) {
  24. //@"审核不通过";
  25. self.kemuTop.constant = 0;
  26. _checkMan.hidden = NO;
  27. _status.hidden = NO;
  28. _reason.hidden = NO;
  29. _checkTime.hidden = NO;
  30. _status.text = @"审核不通过";
  31. _status.textColor = [UIColor redColor];
  32. }else{
  33. self.kemuTop.constant = -75;
  34. _checkMan.hidden = YES;
  35. _status.hidden = YES;
  36. _reason.hidden = YES;
  37. _checkTime.hidden = YES;
  38. if ([_status.text isEqualToString:@"0"]) {
  39. _status.text = @"审核通过";
  40. _status.textColor = defGreen;
  41. }else if ([_status.text isEqualToString:@"2"]) {
  42. _status.text = @"待审核";
  43. _status.textColor = [UIColor lightGrayColor];
  44. }
  45. }
  46. _kumu.text = @"";
  47. switch ([[NSString stringWithFormat:@"%@",dic[@"CRI_TRAIN_SUBJECT"]] integerValue]) {
  48. case 1:
  49. _kumu.text = @"科目:科目一";
  50. break;
  51. case 2:
  52. _kumu.text = @"科目:科目二";
  53. break;
  54. case 3:
  55. _kumu.text = @"科目:科目三";
  56. break;
  57. case 4:
  58. _kumu.text = @"科目:科目四";
  59. break;
  60. default:
  61. break;
  62. }
  63. _trainTime.text = [NSString stringWithFormat:@"训练时长:%@分钟",dic[@"CRI_VAILD_TIME"]];
  64. _trainKMeters.text = [NSString stringWithFormat:@"训练里程:%.2fKM",[dic[@"CRI_MILEAGE"] floatValue]/1000];
  65. }
  66. + (CGFloat)heightForDic:(NSDictionary *)dic
  67. {
  68. // 而高度是动态返回
  69. if (![[NSString stringWithFormat:@"%@",dic[@"CRI_SECOND_AUDIT_RESULT"]] isEqualToString:@"1"]) {
  70. return 131;
  71. }
  72. CGRect bounds = [[NSString stringWithFormat:@"审核原因:%@",dic[@"CRI_SECOND_AUDIT_REASON"]] boundingRectWithSize:CGSizeMake(kSize.width-36, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:15] forKey:NSFontAttributeName] context:nil];
  73. return 181 + (bounds.size.height > 25 ? bounds.size.height : 25);
  74. }
  75. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  76. [super setSelected:selected animated:animated];
  77. // Configure the view for the selected state
  78. }
  79. @end