AccompanyEvaluateCell.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. //
  2. // AccompanyEvaluateCell.m
  3. // KulexiuForTeacher
  4. //
  5. // Created by 王智 on 2022/4/6.
  6. //
  7. #import "AccompanyEvaluateCell.h"
  8. @interface AccompanyEvaluateCell ()
  9. @property (weak, nonatomic) IBOutlet UILabel *tipsMsg;
  10. @property (weak, nonatomic) IBOutlet UIView *emptyView;
  11. @property (weak, nonatomic) IBOutlet UILabel *contentLabel;
  12. @property (weak, nonatomic) IBOutlet UIView *evaluateView;
  13. @property (nonatomic, copy) HomeworkEvaluateCallback callback;
  14. @end
  15. @implementation AccompanyEvaluateCell
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. // Initialization code
  19. self.selectionStyle = UITableViewCellSelectionStyleNone;
  20. }
  21. - (void)configWithEvaluateMessage:(NSString *)evaluateMessage hasEvaluate:(BOOL)hasEvaluate courseStatus:(NSString *)courseStatus callback:(HomeworkEvaluateCallback)callback {
  22. if (callback) {
  23. self.callback = callback;
  24. }
  25. NSString *tipsDesc = @"";
  26. if ([courseStatus isEqualToString:@"COMPLETE"]) { // 结束
  27. tipsDesc = @"课程已结束,请对学员的表现进行评价哦";
  28. if (hasEvaluate) {
  29. self.emptyView.hidden = YES;
  30. self.evaluateView.hidden = YES;
  31. if (![NSString isEmptyString:evaluateMessage]) {
  32. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  33. [paragraphStyle setLineSpacing:4];//调整行间距
  34. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:evaluateMessage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x333333)}];
  35. self.contentLabel.attributedText = attr;
  36. }
  37. else {
  38. self.contentLabel.attributedText = nil;
  39. }
  40. }
  41. else {
  42. self.emptyView.hidden = NO;
  43. self.evaluateView.hidden = NO;
  44. self.contentLabel.attributedText = nil;
  45. }
  46. }
  47. else {
  48. tipsDesc = @"课程结束之后才能评价学员哦";
  49. self.emptyView.hidden = NO;
  50. self.evaluateView.hidden = YES;
  51. self.contentLabel.attributedText = nil;
  52. }
  53. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  54. [paragraphStyle setLineSpacing:4];//调整行间距
  55. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:tipsDesc attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x999999)}];
  56. self.tipsMsg.attributedText = attr;
  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. - (IBAction)clickAction:(id)sender {
  63. if (self.callback) {
  64. self.callback();
  65. }
  66. }
  67. @end