VideoCourseCell.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // VideoCourseCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by Kyle on 2022/3/29.
  6. //
  7. #import "VideoCourseCell.h"
  8. @interface VideoCourseCell ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
  10. @property (weak, nonatomic) IBOutlet UILabel *courseTitle;
  11. @property (weak, nonatomic) IBOutlet UIImageView *teacherAvatar;
  12. @property (weak, nonatomic) IBOutlet UILabel *teacherName;
  13. @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
  14. @property (weak, nonatomic) IBOutlet UIView *descView;
  15. @property (weak, nonatomic) IBOutlet UILabel *descLabel;
  16. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  17. @end
  18. @implementation VideoCourseCell
  19. - (void)awakeFromNib {
  20. [super awakeFromNib];
  21. // Initialization code
  22. }
  23. - (void)configSourceModel:(VideoCourseModel *)model isInCheck:(BOOL)isCheck {
  24. [self.coverImage sd_setImageWithURL:[NSURL URLWithString:model.lessonCoverUrl] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
  25. self.courseTitle.text = [NSString returnNoNullStringWithString:model.lessonName];
  26. [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:USERDEFAULT_LOGO]];
  27. if ([NSString isEmptyString:model.username]) {
  28. self.teacherName.text = [NSString stringWithFormat:@"游客%.0f",model.teacherId];
  29. }
  30. else {
  31. self.teacherName.text = model.username;
  32. }
  33. self.courseMessage.text = [NSString stringWithFormat:@"¥%.2f/%.0f课时",model.lessonPrice,model.lessonCount];
  34. if (isCheck) {
  35. self.descView.hidden = YES;
  36. self.descLabel.text = @"";
  37. }
  38. else {
  39. self.descView.hidden = NO;
  40. self.descLabel.text = [NSString stringWithFormat:@"%.0f人已购买",model.countStudent];
  41. }
  42. self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
  43. }
  44. @end