123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //
- // MinePageVideoCell.m
- // KulexiuForTeacher
- //
- // Created by 王智 on 2022/4/2.
- //
- #import "MinePageVideoCell.h"
- @interface MinePageVideoCell ()
- @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
- @property (weak, nonatomic) IBOutlet UILabel *courseTitle;
- @property (weak, nonatomic) IBOutlet UILabel *courseMessage;
- @property (weak, nonatomic) IBOutlet UILabel *courseCount;
- @property (weak, nonatomic) IBOutlet UILabel *descLabel;
- @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
- @property (weak, nonatomic) IBOutlet UIView *statusView;
- @end
- @implementation MinePageVideoCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- [self setupRadius];
- }
- - (void)setupRadius {
- _statusView.layer.cornerRadius = 8.5f;
- _statusView.layer.maskedCorners = kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner;
- }
- - (void)configSourceModel:(VideoCourseModel *)model {
- [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.lessonCoverUrl getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
- self.courseTitle.text = [NSString returnNoNullStringWithString:model.lessonName];
-
- 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];
- self.subjectLabel.text = [NSString returnNoNullStringWithString:model.lessonSubjectName];
- }
- @end
|