VideoCourseCell.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
  25. self.courseTitle.text = [NSString returnNoNullStringWithString:model.lessonName];
  26. [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlEndcodeString]] 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. if (model.lessonPrice > 0) {
  34. self.courseMessage.text = [NSString stringWithFormat:@"¥%.2f/%.0f课时",model.lessonPrice,model.lessonCount];
  35. }
  36. else {
  37. self.courseMessage.text = [NSString stringWithFormat:@"免费/%.0f课时",model.lessonCount];
  38. }
  39. if (isCheck) {
  40. self.descView.hidden = YES;
  41. self.descLabel.text = @"";
  42. }
  43. else {
  44. self.descView.hidden = NO;
  45. if (model.lessonPrice > 0) {
  46. self.descLabel.text = [NSString stringWithFormat:@"%.0f人已购买",model.countStudent];
  47. }
  48. else {
  49. self.descLabel.text = [NSString stringWithFormat:@"%.0f人已领取",model.countStudent];
  50. }
  51. }
  52. self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
  53. }
  54. @end