// // HomeLiveCouseCell.m // KulexiuForStudent // // Created by 王智 on 2022/4/22. // #import "HomeLiveCouseCell.h" @interface HomeLiveCouseCell () @property (weak, nonatomic) IBOutlet UIImageView *coverImage; @property (weak, nonatomic) IBOutlet UILabel *courseName; @property (weak, nonatomic) IBOutlet UILabel *teacherName; @property (weak, nonatomic) IBOutlet UILabel *courseBegin; @property (weak, nonatomic) IBOutlet UILabel *priceLabel; @property (weak, nonatomic) IBOutlet UILabel *courseCountLabel; @property (weak, nonatomic) IBOutlet UILabel *descLabel; @property (weak, nonatomic) IBOutlet UILabel *subjectLabel; @end @implementation HomeLiveCouseCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code self.selectionStyle = UITableViewCellSelectionStyleNone; } - (void)configWithSource:(HomeLiveGroupModel *)source { [self.coverImage sd_setImageWithURL:[NSURL URLWithString:source.avatar] placeholderImage:[UIImage imageNamed:@"video_placeholder"]]; self.courseName.text = [NSString returnNoNullStringWithString:source.courseGroupName]; self.teacherName.text = [NSString stringWithFormat:@"老师:%@",[NSString returnNoNullStringWithString:source.teacherName]]; self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",source.courseGroupPrice]; self.courseCountLabel.text = [NSString stringWithFormat:@"%zd课时",source.courseNum]; self.descLabel.text = [NSString stringWithFormat:@"%zd人已购买",source.buyCount]; // 时间 if ([NSString isEmptyString:source.courseStartTime]) { self.courseBegin.text = @""; } else { NSDateFormatter *dateFormatter = [NSObject getDateformatter]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; NSDate *beginDate = [dateFormatter dateFromString:source.courseStartTime]; [dateFormatter setDateFormat:@"yyyy年MM月dd日 HH:mm"]; self.courseBegin.text = [NSString returnNoNullStringWithString:[dateFormatter stringFromDate:beginDate]]; } self.subjectLabel.text = [NSString returnNoNullStringWithString:source.subjectName]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end