VideoCourseArrangeCell.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // VideoCourseArrangeCell.m
  3. // KulexiuForStudent
  4. //
  5. // Created by 王智 on 2024/11/19.
  6. //
  7. #import "VideoCourseArrangeCell.h"
  8. @interface VideoCourseArrangeCell ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
  10. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  11. @property (weak, nonatomic) IBOutlet UILabel *courseNameLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *courseTag;
  13. @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
  14. @property (weak, nonatomic) IBOutlet UILabel *courseCount;
  15. @property (weak, nonatomic) IBOutlet UIView *musicView;
  16. @property (weak, nonatomic) IBOutlet UILabel *musicLabel;
  17. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicRight;
  18. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelLeft;
  19. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelRight;
  20. @property (weak, nonatomic) IBOutlet UIImageView *teacherAvatar;
  21. @property (weak, nonatomic) IBOutlet UILabel *teacherName;
  22. @end
  23. @implementation VideoCourseArrangeCell
  24. - (void)awakeFromNib {
  25. [super awakeFromNib];
  26. // Initialization code
  27. self.selectionStyle = UITableViewCellSelectionStyleNone;
  28. }
  29. - (void)configWithSource:(ArrangeVideoCourseModel *)model {
  30. [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
  31. self.courseNameLabel.text = [NSString returnNoNullStringWithString:model.lessonName];
  32. if ([model.payType isEqualToString:@"VIP"]) {
  33. self.courseTag.hidden = YES;
  34. self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
  35. self.courseMessage.text = @"会员";
  36. self.courseMessage.textColor = HexRGB(0xC76E21);
  37. }
  38. else if ([model.payType isEqualToString:@"PAY"]) {
  39. if (model.lessonPrice > 0) {
  40. self.courseTag.hidden = NO;
  41. self.courseMessage.textColor = HexRGB(0xF44541);
  42. NSString *text = [NSString stringWithFormat:@"%.2f",model.lessonPrice];
  43. self.courseMessage.text = text;
  44. self.courseMessage.font = [UIFont fontWithName:@"DIN Alternate Bold" size:18.0f];
  45. }
  46. else {
  47. self.courseTag.hidden = YES;
  48. self.courseMessage.text = @"免费";
  49. self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
  50. self.courseMessage.textColor = HexRGB(0x18B99A);
  51. }
  52. }
  53. else {
  54. self.courseMessage.text = @"";
  55. }
  56. self.courseCount.text = [NSString stringWithFormat:@"%.0f课时",model.lessonCount];
  57. self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
  58. // 曲目
  59. if (model.musicNum > 0) {
  60. self.musicLabel.text = [NSString stringWithFormat:@"%zd首曲目", model.musicNum];
  61. self.musicRight.constant = 4.0f;
  62. self.musicLabelLeft.constant = 6.0f;
  63. self.musicLabelRight.constant = 6.0f;
  64. }
  65. else {
  66. self.musicView.hidden = YES;
  67. self.musicLabel.text = @"";
  68. self.musicRight.constant = 0.0f;
  69. self.musicLabelLeft.constant = 0.0f;
  70. self.musicLabelRight.constant = 0.0f;
  71. }
  72. self.teacherName.text = [NSString returnNoNullStringWithString:model.realName];
  73. [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlFileName]] placeholderImage:[UIImage imageNamed:TEACHER_AVATAR]];
  74. }
  75. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  76. [super setSelected:selected animated:animated];
  77. // Configure the view for the selected state
  78. }
  79. @end