HomeLiveCouseCell.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // HomeLiveCouseCell.m
  3. // KulexiuForStudent
  4. //
  5. // Created by 王智 on 2022/4/22.
  6. //
  7. #import "HomeLiveCouseCell.h"
  8. @interface HomeLiveCouseCell ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
  10. @property (weak, nonatomic) IBOutlet UILabel *courseName;
  11. @property (weak, nonatomic) IBOutlet UILabel *teacherName;
  12. @property (weak, nonatomic) IBOutlet UILabel *courseBegin;
  13. @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *courseCountLabel;
  15. @property (weak, nonatomic) IBOutlet UILabel *descLabel;
  16. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  17. @end
  18. @implementation HomeLiveCouseCell
  19. - (void)awakeFromNib {
  20. [super awakeFromNib];
  21. // Initialization code
  22. self.selectionStyle = UITableViewCellSelectionStyleNone;
  23. }
  24. - (void)configWithSource:(HomeLiveGroupModel *)source {
  25. [self.coverImage sd_setImageWithURL:[NSURL URLWithString:source.avatar] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
  26. self.courseName.text = [NSString returnNoNullStringWithString:source.courseGroupName];
  27. self.teacherName.text = [NSString stringWithFormat:@"老师:%@",[NSString returnNoNullStringWithString:source.teacherName]];
  28. self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",source.courseGroupPrice];
  29. self.courseCountLabel.text = [NSString stringWithFormat:@"%zd课时",source.courseNum];
  30. self.descLabel.text = [NSString stringWithFormat:@"%zd人已购买",source.buyCount];
  31. // 时间
  32. if ([NSString isEmptyString:source.courseStartTime]) {
  33. self.courseBegin.text = @"";
  34. }
  35. else {
  36. NSDateFormatter *dateFormatter = [NSObject getDateformatter];
  37. [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
  38. NSDate *beginDate = [dateFormatter dateFromString:source.courseStartTime];
  39. [dateFormatter setDateFormat:@"yyyy年MM月dd日 HH:mm"];
  40. self.courseBegin.text = [NSString returnNoNullStringWithString:[dateFormatter stringFromDate:beginDate]];
  41. }
  42. self.subjectLabel.text = [NSString returnNoNullStringWithString:source.subjectName];
  43. }
  44. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  45. [super setSelected:selected animated:animated];
  46. // Configure the view for the selected state
  47. }
  48. @end