123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- //
- // LiveCourseCell.m
- // KulexiuForTeacher
- //
- // Created by 王智 on 2022/4/2.
- //
- #import "LiveCourseCell.h"
- @interface LiveCourseCell ()
- @property (weak, nonatomic) IBOutlet UIView *statusView;
- @property (weak, nonatomic) IBOutlet UILabel *statusLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *coverImage;
- @property (weak, nonatomic) IBOutlet UILabel *courseName;
- @property (weak, nonatomic) IBOutlet UILabel *orderUser;
- @property (weak, nonatomic) IBOutlet UILabel *courseTime;
- @property (weak, nonatomic) IBOutlet UILabel *priceLabel;
- @property (weak, nonatomic) IBOutlet UILabel *courseCount;
- @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
- @end
- @implementation LiveCourseCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- [self setupRadius];
- }
- - (void)setupRadius {
- _statusView.layer.cornerRadius = 10.0f;
- _statusView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner;
- }
- - (void)configCellWithSource:(LiveCourseModel *)model groupStatus:(COURSERSTATUS)status hideStatusView:(BOOL)hideStatusView {
- [self.coverImage sd_setImageWithURL:[NSURL URLWithString:[model.backgroundPic getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
- self.courseName.text = [NSString returnNoNullStringWithString:model.courseGroupName];
-
- if (model.coursePrice > 0) {
- self.orderUser.text = [NSString stringWithFormat:@"%.0f人已购买",model.studentCount];
- }
- else {
- self.orderUser.text = [NSString stringWithFormat:@"%.0f人已领取",model.studentCount];
- }
-
- if (model.coursePrice > 0) {
- self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",model.coursePrice];
-
- }
- else {
- self.priceLabel.text = [NSString stringWithFormat:@"免费"];
- }
-
- self.courseCount.text = [NSString stringWithFormat:@"/ %.0f课时",model.courseNum];
- // time
- NSDateFormatter *formatter = [NSObject getDateformatter];
- [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
- NSDate *startDate = [formatter dateFromString:model.courseStartTime];
- [formatter setDateFormat:@"yyyy/MM/dd HH:mm"];
- NSString *courseBegin = [formatter stringFromDate:startDate];
- self.courseTime.text = [NSString returnNoNullStringWithString:courseBegin];
- self.subjectLabel.text = [NSString returnNoNullStringWithString:model.subjectName];
- switch (status) {
- case COURSERSTATUS_ING:
- {
- self.statusView.backgroundColor = HexRGB(0xd5fff7);
- self.statusLabel.textColor = HexRGB(0x2dc7aa);
- self.statusLabel.text = @"进行中";
- self.orderUser.hidden = NO;
- self.statusView.hidden = NO;
- }
- break;
- case COURSERSTATUS_NOTSALE:
- {
- self.statusView.backgroundColor = HexRGB(0xFFEEE3);
- self.statusLabel.textColor = HexRGB(0xFF4E19);
- self.statusLabel.text = @"未上架";
- self.orderUser.hidden = YES;
- }
- break;
- case COURSERSTATUS_APPLY:
- {
- self.statusView.backgroundColor = HexRGB(0xFFE7E7);
- self.statusLabel.textColor = HexRGB(0xFF1919);
- self.statusLabel.text = @"销售中";
- self.orderUser.hidden = NO;
- }
- break;
- case COURSERSTATUS_COMPLETE:
- {
- self.statusView.backgroundColor = HexRGB(0xDEF2FF);
- self.statusLabel.textColor = HexRGB(0x008AE0);
- self.statusLabel.text = @"已完成";
- self.orderUser.hidden = NO;
-
- }
- break;
- case COURSERSTATUS_CANCLE:
- {
- self.statusView.backgroundColor = HexRGB(0xF0F0F0);
- self.statusLabel.textColor = HexRGB(0x666666);
- self.statusLabel.text = @"已取消";
- self.orderUser.hidden = NO;
- }
- break;
- case COURSERSTATUS_OUTSALE:
- {
- self.statusView.backgroundColor = HexRGB(0xF0F0F0);
- self.statusLabel.textColor = HexRGB(0x666666);
- self.statusLabel.text = @"已下架";
- self.orderUser.hidden = NO;
- }
- break;
- default:
- break;
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|