ContractListCell.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // ContractListCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by Kyle on 2022/3/24.
  6. //
  7. #import "ContractListCell.h"
  8. #import "FriendListModel.h"
  9. @interface ContractListCell ()
  10. @property (weak, nonatomic) IBOutlet UIImageView *friendAvatar;
  11. @property (weak, nonatomic) IBOutlet UILabel *friendName;
  12. @property (weak, nonatomic) IBOutlet UIImageView *roleType;
  13. @end
  14. @implementation ContractListCell
  15. - (void)awakeFromNib {
  16. [super awakeFromNib];
  17. // Initialization code
  18. self.selectionStyle = UITableViewCellSelectionStyleNone;
  19. }
  20. - (void)configWithSource:(id)sourceModel {
  21. if ([sourceModel isKindOfClass:[FriendListModel class]]) {
  22. FriendListModel *model = sourceModel;
  23. [self.friendAvatar sd_setImageWithURL:[NSURL URLWithString:[model.friendAvatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:CHAT_USER_DEFAULT_LOGO]];
  24. if ([NSString isEmptyString:model.friendNickname]) {
  25. self.friendName.text = [NSString stringWithFormat:@"游客%@",model.friendId];
  26. }
  27. else {
  28. self.friendName.text = model.friendNickname;
  29. }
  30. self.friendName.text = [NSString returnNoNullStringWithString:model.friendNickname];
  31. if ([model.roleType isEqualToString:@"TEACHER"]) {
  32. self.roleType.hidden = NO;
  33. }
  34. else {
  35. self.roleType.hidden = YES;
  36. }
  37. }
  38. }
  39. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  40. [super setSelected:selected animated:animated];
  41. // Configure the view for the selected state
  42. }
  43. @end