1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- //
- // MyProgramCourseGroupCell.m
- // KulexiuForTeacher
- //
- // Created by 王智 on 2024/11/20.
- //
- #import "MyProgramCourseGroupCell.h"
- @interface MyProgramCourseGroupCell ()
- @property (weak, nonatomic) IBOutlet UILabel *programTitle;
- @property (weak, nonatomic) IBOutlet UILabel *courseStatus;
- @property (weak, nonatomic) IBOutlet UIImageView *avatar;
- @property (weak, nonatomic) IBOutlet UILabel *nameLabel;
- @property (weak, nonatomic) IBOutlet UIView *subjectView;
- @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
- @property (weak, nonatomic) IBOutlet UILabel *courseDesc;
- @end
- @implementation MyProgramCourseGroupCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- - (void)configWithSource:(ProgramCourseGroupModel *)model isVipCourse:(BOOL)isVipCourse {
-
- self.programTitle.text = [NSString returnNoNullStringWithString:model.courseGroupName];
- /// 状态
- [self evaluateGroupStatus:model.status];
-
- [self.avatar sd_setImageWithURL:[NSURL URLWithString:[model.teacherAvatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:STUDENT_AVATAR]];
-
- self.nameLabel.text = [NSString returnNoNullStringWithString:model.teacherName];
-
- self.subjectLabel.text = [NSString returnNoNullStringWithString:model.subjectName];
-
- // 课程描述
- NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:@"已上课时 " attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightRegular],NSForegroundColorAttributeName:HexRGB(0x999999)}];
- NSAttributedString *finishNumAttr = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%.0f", model.completeCourseNum] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightSemibold],NSForegroundColorAttributeName:THEMECOLOR}];
- [attrs appendAttributedString:finishNumAttr];
-
- NSAttributedString *totalDescAttr = [[NSAttributedString alloc] initWithString:@" /总课时 " attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightRegular],NSForegroundColorAttributeName:HexRGB(0x999999)}];
- [attrs appendAttributedString:totalDescAttr];
- NSAttributedString *totalNumAttr = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%.0f", model.courseNum] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightSemibold],NSForegroundColorAttributeName:THEMECOLOR}];
- [attrs appendAttributedString:totalNumAttr];
- self.courseDesc.attributedText = attrs;
- }
- - (void)evaluateGroupStatus:(NSString *)status {
- if ([status isEqualToString:@"ING"]) {
- self.courseStatus.text = @"已开课";
- self.courseStatus.textColor = THEMECOLOR;
- }
- else if ([status isEqualToString:@"NOT_START"]) {
- self.courseStatus.text = @"未开课";
- self.courseStatus.textColor = HexRGB(0xFF802C);
- }
- else if ([status isEqualToString:@"COMPLETE"]) {
- self.courseStatus.text = @"已结课";
- self.courseStatus.textColor = HexRGB(0x999999);
- }
- else if ([status isEqualToString:@"CANCEL"]) {
- self.courseStatus.text = @"已取消";
- self.courseStatus.textColor = HexRGB(0x999999);
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|