12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // VideoCourseCell.m
- // KulexiuForTeacher
- //
- // Created by Kyle on 2022/3/29.
- //
- #import "VideoCourseCell.h"
- @interface VideoCourseCell ()
- @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
- @property (weak, nonatomic) IBOutlet UILabel *courseTitle;
- @property (weak, nonatomic) IBOutlet UIImageView *teacherAvatar;
- @property (weak, nonatomic) IBOutlet UILabel *teacherName;
- @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
- @property (weak, nonatomic) IBOutlet UIView *descView;
- @property (weak, nonatomic) IBOutlet UILabel *descLabel;
- @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
- @property (weak, nonatomic) IBOutlet UILabel *courseCount;
- @end
- @implementation VideoCourseCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)configSourceModel:(VideoCourseModel *)model isInCheck:(BOOL)isCheck {
- [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
- self.courseTitle.text = [NSString returnNoNullStringWithString:model.lessonName];
- [self.teacherAvatar sd_setImageWithURL:[NSURL URLWithString:[model.avatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:TEACHER_AVATAR]];
- if ([NSString isEmptyString:model.username]) {
- self.teacherName.text = [NSString stringWithFormat:@"游客%.0f",model.teacherId];
- }
- else {
- self.teacherName.text = model.username;
- }
-
-
- self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
-
- if ([model.payType isEqualToString:@"VIP"]) {
- self.courseMessage.text = @"会员";
- self.courseMessage.textColor = HexRGB(0xC76E21);
- }
- else if ([model.payType isEqualToString:@"PAY"]) {
- if (model.lessonPrice > 0) {
- self.courseMessage.textColor = HexRGB(0xFF0000);
- NSString *text = [NSString stringWithFormat:@"¥%.2f",model.lessonPrice];
- NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium],NSForegroundColorAttributeName:HexRGB(0xFF0000)}];
- [attrs addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0f weight:UIFontWeightMedium]} range:[text rangeOfString:@"¥"]];
- self.courseMessage.attributedText = attrs;
- }
- else {
- self.courseMessage.text = @"免费";
- self.courseMessage.textColor = HexRGB(0x20BEA0);
- }
- }
- else {
- self.courseMessage.text = @"";
- }
-
- self.courseCount.text = [NSString stringWithFormat:@"/ %.0f课时",model.lessonCount];
- self.descLabel.text = [NSString stringWithFormat:@"%.0f人学习",model.countStudent];
- }
- @end
|