GroupApplyMemberCell.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // GroupApplyMemberCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by Kyle on 2022/3/25.
  6. //
  7. #import "GroupApplyMemberCell.h"
  8. @interface GroupApplyMemberCell ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *userAvatal;
  10. @property (weak, nonatomic) IBOutlet UILabel *userName;
  11. @property (weak, nonatomic) IBOutlet UILabel *descLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *timeLabel;
  13. @end
  14. @implementation GroupApplyMemberCell
  15. - (void)awakeFromNib {
  16. [super awakeFromNib];
  17. // Initialization code
  18. self.selectionStyle = UITableViewCellSelectionStyleNone;
  19. }
  20. - (void)configWithSource:(ApplyMemberModel *)source {
  21. if ([NSString isEmptyString:source.avatar]) {
  22. [self.userAvatal setImage:[UIImage imageNamed:CHAT_USER_DEFAULT_LOGO]];
  23. }
  24. else {
  25. [self.userAvatal sd_setImageWithURL:[NSURL URLWithString:[source.avatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:CHAT_USER_DEFAULT_LOGO]];
  26. }
  27. if ([NSString isEmptyString:source.username]) {
  28. self.userName.text = [NSString stringWithFormat:@"用户:%@",source.userId];
  29. }
  30. else {
  31. self.userName.text = source.username;
  32. }
  33. if ([NSString isEmptyString:source.updateTime]) {
  34. self.timeLabel.text = @"";
  35. }
  36. else {
  37. NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
  38. dateFormatter.timeZone = [NSTimeZone systemTimeZone];
  39. [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  40. NSDate *messageDate = [dateFormatter dateFromString:source.updateTime];
  41. [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
  42. NSString *dateStr = [dateFormatter stringFromDate:messageDate];
  43. self.timeLabel.text = dateStr;
  44. }
  45. }
  46. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  47. [super setSelected:selected animated:animated];
  48. // Configure the view for the selected state
  49. }
  50. @end