123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- //
- // VideoCourseArrangeCell.m
- // KulexiuForStudent
- //
- // Created by 王智 on 2024/11/19.
- //
- #import "VideoCourseArrangeCell.h"
- @interface VideoCourseArrangeCell ()
- @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
- @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
- @property (weak, nonatomic) IBOutlet UILabel *courseNameLabel;
- @property (weak, nonatomic) IBOutlet UILabel *courseTag;
- @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
- @property (weak, nonatomic) IBOutlet UILabel *courseCount;
- @property (weak, nonatomic) IBOutlet UIView *musicView;
- @property (weak, nonatomic) IBOutlet UILabel *musicLabel;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicRight;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelLeft;
- @property (weak, nonatomic) IBOutlet NSLayoutConstraint *musicLabelRight;
- @property (weak, nonatomic) IBOutlet UIImageView *teacherAvatar;
- @property (weak, nonatomic) IBOutlet UILabel *teacherName;
- @end
- @implementation VideoCourseArrangeCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- - (void)configWithSource:(ArrangeVideoCourseModel *)model {
-
- [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
- self.courseNameLabel.text = [NSString returnNoNullStringWithString:model.lessonName];
- if ([model.payType isEqualToString:@"VIP"]) {
- self.courseTag.hidden = YES;
- self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
- self.courseMessage.text = @"会员";
- self.courseMessage.textColor = HexRGB(0xC76E21);
- }
- else if ([model.payType isEqualToString:@"PAY"]) {
- if (model.lessonPrice > 0) {
- self.courseTag.hidden = NO;
- self.courseMessage.textColor = HexRGB(0xF44541);
- NSString *text = [NSString stringWithFormat:@"%.2f",model.lessonPrice];
- self.courseMessage.text = text;
- self.courseMessage.font = [UIFont fontWithName:@"DIN Alternate Bold" size:18.0f];
- }
- else {
- self.courseTag.hidden = YES;
- self.courseMessage.text = @"免费";
- self.courseMessage.font = [UIFont systemFontOfSize:15.0f weight:UIFontWeightMedium];
- self.courseMessage.textColor = HexRGB(0x18B99A);
- }
- }
- else {
- self.courseMessage.text = @"";
- }
- self.courseCount.text = [NSString stringWithFormat:@"%.0f课时",model.lessonCount];
- self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
- // 曲目
- if (model.musicNum > 0) {
- self.musicLabel.text = [NSString stringWithFormat:@"%zd首曲目", model.musicNum];
- self.musicRight.constant = 4.0f;
- self.musicLabelLeft.constant = 6.0f;
- self.musicLabelRight.constant = 6.0f;
- }
- else {
- self.musicView.hidden = YES;
- self.musicLabel.text = @"";
- self.musicRight.constant = 0.0f;
- self.musicLabelLeft.constant = 0.0f;
- self.musicLabelRight.constant = 0.0f;
- }
-
- self.teacherName.text = [NSString returnNoNullStringWithString:model.realName];
- [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlFileName]] placeholderImage:[UIImage imageNamed:TEACHER_AVATAR]];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|