AccompanyStudentEvaCell.m 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // AccompanyStudentEvaCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2022/4/6.
  6. //
  7. #import "AccompanyStudentEvaCell.h"
  8. #import "KSStarView.h"
  9. @interface AccompanyStudentEvaCell ()
  10. @property (weak, nonatomic) IBOutlet UILabel *tipsMsg;
  11. @property (weak, nonatomic) IBOutlet UIView *emptyView;
  12. @property (weak, nonatomic) IBOutlet KSStarView *starView;
  13. @property (weak, nonatomic) IBOutlet UILabel *contentLabel;
  14. @end
  15. @implementation AccompanyStudentEvaCell
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. // Initialization code
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. self.starView.allowMark = NO;
  21. self.starView.hidden = YES; // 隐藏星级
  22. }
  23. - (void)configWithEvaluateMessage:(NSString *)evaluateMessage courseStatus:(NSString *)courseStatus starNum:(NSInteger)starNum hasEvaluate:(BOOL)hasEvaluate {
  24. NSString *tipsDesc = @"";
  25. if ([courseStatus isEqualToString:@"COMPLETE"]) { // 结束
  26. tipsDesc = @"学员尚未对您进行评价";
  27. if (hasEvaluate) {
  28. self.emptyView.hidden = YES;
  29. if (![NSString isEmptyString:evaluateMessage]) {
  30. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  31. [paragraphStyle setLineSpacing:4];//调整行间距
  32. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:evaluateMessage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x333333)}];
  33. self.contentLabel.attributedText = attr;
  34. }
  35. else {
  36. self.contentLabel.attributedText = nil;
  37. }
  38. }
  39. else {
  40. self.emptyView.hidden = NO;
  41. self.contentLabel.attributedText = nil;
  42. }
  43. }
  44. else {
  45. tipsDesc = @"课程结束之后学员才能对您进行评价哦";
  46. self.emptyView.hidden = NO;
  47. self.contentLabel.attributedText = nil;
  48. }
  49. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  50. [paragraphStyle setLineSpacing:4];//调整行间距
  51. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:tipsDesc attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x999999)}];
  52. self.tipsMsg.attributedText = attr;
  53. }
  54. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  55. [super setSelected:selected animated:animated];
  56. // Configure the view for the selected state
  57. }
  58. @end