MinePageVideoCell.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // MinePageVideoCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2022/4/2.
  6. //
  7. #import "MinePageVideoCell.h"
  8. @interface MinePageVideoCell ()
  9. @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
  10. @property (weak, nonatomic) IBOutlet UILabel *courseTitle;
  11. @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
  12. @property (weak, nonatomic) IBOutlet UILabel *courseCount;
  13. @property (weak, nonatomic) IBOutlet UILabel *descLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  15. @property (weak, nonatomic) IBOutlet UIView *statusView;
  16. @end
  17. @implementation MinePageVideoCell
  18. - (void)awakeFromNib {
  19. [super awakeFromNib];
  20. // Initialization code
  21. [self setupRadius];
  22. }
  23. - (void)setupRadius {
  24. _statusView.layer.cornerRadius = 8.5f;
  25. _statusView.layer.maskedCorners = kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner;
  26. }
  27. - (void)configSourceModel:(VideoCourseModel *)model {
  28. [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
  29. self.courseTitle.text = [NSString returnNoNullStringWithString:model.lessonName];
  30. if ([model.payType isEqualToString:@"VIP"]) {
  31. self.courseMessage.text = @"会员";
  32. self.courseMessage.textColor = HexRGB(0xC76E21);
  33. }
  34. else if ([model.payType isEqualToString:@"PAY"]) {
  35. if (model.lessonPrice > 0) {
  36. self.courseMessage.textColor = HexRGB(0xFF0000);
  37. NSString *text = [NSString stringWithFormat:@"¥%.2f",model.lessonPrice];
  38. NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium],NSForegroundColorAttributeName:HexRGB(0xFF0000)}];
  39. [attrs addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f weight:UIFontWeightMedium]} range:[text rangeOfString:@"¥"]];
  40. self.courseMessage.attributedText = attrs;
  41. }
  42. else {
  43. self.courseMessage.text = @"免费";
  44. self.courseMessage.textColor = HexRGB(0x20BEA0);
  45. }
  46. }
  47. else {
  48. self.courseMessage.text = @"";
  49. }
  50. self.courseCount.text = [NSString stringWithFormat:@"/ %.0f课时",model.lessonCount];
  51. self.descLabel.text = [NSString stringWithFormat:@"%.0f人学习",model.countStudent];
  52. self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
  53. }
  54. @end