MyProgramCourseGroupCell.m 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // MyProgramCourseGroupCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2024/11/20.
  6. //
  7. #import "MyProgramCourseGroupCell.h"
  8. @interface MyProgramCourseGroupCell ()
  9. @property (weak, nonatomic) IBOutlet UILabel *programTitle;
  10. @property (weak, nonatomic) IBOutlet UILabel *courseStatus;
  11. @property (weak, nonatomic) IBOutlet UIImageView *avatar;
  12. @property (weak, nonatomic) IBOutlet UILabel *nameLabel;
  13. @property (weak, nonatomic) IBOutlet UIView *subjectView;
  14. @property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
  15. @property (weak, nonatomic) IBOutlet UILabel *courseDesc;
  16. @end
  17. @implementation MyProgramCourseGroupCell
  18. - (void)awakeFromNib {
  19. [super awakeFromNib];
  20. // Initialization code
  21. self.selectionStyle = UITableViewCellSelectionStyleNone;
  22. }
  23. - (void)configWithSource:(ProgramCourseGroupModel *)model isVipCourse:(BOOL)isVipCourse {
  24. self.programTitle.text = [NSString returnNoNullStringWithString:model.courseGroupName];
  25. /// 状态
  26. [self evaluateGroupStatus:model.status];
  27. [self.avatar sd_setImageWithURL:[NSURL URLWithString:[model.teacherAvatar getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:STUDENT_AVATAR]];
  28. self.nameLabel.text = [NSString returnNoNullStringWithString:model.teacherName];
  29. self.subjectLabel.text = [NSString returnNoNullStringWithString:model.subjectName];
  30. // 课程描述
  31. NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:@"已上课时 " attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightRegular],NSForegroundColorAttributeName:HexRGB(0x999999)}];
  32. NSAttributedString *finishNumAttr = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%.0f", model.completeCourseNum] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightSemibold],NSForegroundColorAttributeName:THEMECOLOR}];
  33. [attrs appendAttributedString:finishNumAttr];
  34. NSAttributedString *totalDescAttr = [[NSAttributedString alloc] initWithString:@" /总课时 " attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightRegular],NSForegroundColorAttributeName:HexRGB(0x999999)}];
  35. [attrs appendAttributedString:totalDescAttr];
  36. NSAttributedString *totalNumAttr = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%.0f", model.courseNum] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f weight:UIFontWeightSemibold],NSForegroundColorAttributeName:THEMECOLOR}];
  37. [attrs appendAttributedString:totalNumAttr];
  38. self.courseDesc.attributedText = attrs;
  39. }
  40. - (void)evaluateGroupStatus:(NSString *)status {
  41. if ([status isEqualToString:@"ING"]) {
  42. self.courseStatus.text = @"已开课";
  43. self.courseStatus.textColor = THEMECOLOR;
  44. }
  45. else if ([status isEqualToString:@"NOT_START"]) {
  46. self.courseStatus.text = @"未开课";
  47. self.courseStatus.textColor = HexRGB(0xFF802C);
  48. }
  49. else if ([status isEqualToString:@"COMPLETE"]) {
  50. self.courseStatus.text = @"已结课";
  51. self.courseStatus.textColor = HexRGB(0x999999);
  52. }
  53. else if ([status isEqualToString:@"CANCEL"]) {
  54. self.courseStatus.text = @"已取消";
  55. self.courseStatus.textColor = HexRGB(0x999999);
  56. }
  57. }
  58. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  59. [super setSelected:selected animated:animated];
  60. // Configure the view for the selected state
  61. }
  62. @end