浏览代码

老师评价空状态区分课程状态显示

Steven 3 月之前
父节点
当前提交
87633ad3b3

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/Controller/AccompanyDetailViewController.m

@@ -227,7 +227,7 @@
         AccompanyEvaluateCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyEvaluateCell"];
         NSString *message = self.evaluateModel.teacherReplied;
         BOOL hasEvaluate = [NSString isEmptyString:self.evaluateModel.teacherReplied] ? NO : YES;
-        [cell configWithEvaluateMessage:message hasEvaluate:hasEvaluate];
+        [cell configWithEvaluateMessage:message courseStatus:self.homeworkModel.courseStatus hasEvaluate:hasEvaluate];
         return cell;
     }
     else if (indexPath.row == 2) {

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/View/AccompanyEvaluateCell.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface AccompanyEvaluateCell : UITableViewCell
 
-- (void)configWithEvaluateMessage:(NSString *)evaluateMessage hasEvaluate:(BOOL)hasEvaluate;
+- (void)configWithEvaluateMessage:(NSString *)evaluateMessage courseStatus:(NSString *)courseStatus hasEvaluate:(BOOL)hasEvaluate;
 
 @end
 

+ 18 - 10
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/View/AccompanyEvaluateCell.m

@@ -25,26 +25,34 @@
     self.selectionStyle = UITableViewCellSelectionStyleNone;
 }
 
-- (void)configWithEvaluateMessage:(NSString *)evaluateMessage hasEvaluate:(BOOL)hasEvaluate {
-
-    if (hasEvaluate) {
-        self.emptyView.hidden = YES;
-        if (![NSString isEmptyString:evaluateMessage]) {
-            NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
-            [paragraphStyle setLineSpacing:4];//调整行间距
-            NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:evaluateMessage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x333333)}];
-            self.contentLabel.attributedText = attr;
+- (void)configWithEvaluateMessage:(NSString *)evaluateMessage courseStatus:(NSString *)courseStatus hasEvaluate:(BOOL)hasEvaluate {
+    NSString *tipsDesc = @"";
+    if ([courseStatus isEqualToString:@"COMPLETE"]) {
+        tipsDesc = @"老师尚未评价";
+        if (hasEvaluate) {
+            self.emptyView.hidden = YES;
+            if (![NSString isEmptyString:evaluateMessage]) {
+                NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+                [paragraphStyle setLineSpacing:4];//调整行间距
+                NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:evaluateMessage attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x333333)}];
+                self.contentLabel.attributedText = attr;
+            }
+            else {
+                self.contentLabel.attributedText = nil;
+            }
         }
         else {
+            self.emptyView.hidden = NO;
             self.contentLabel.attributedText = nil;
         }
+        
     }
     else {
+        tipsDesc = @"课程结束之后老师才能对您的学习进行评价哦";
         self.emptyView.hidden = NO;
         self.contentLabel.attributedText = nil;
     }
     
-    NSString *tipsDesc = @"老师尚未评价";
     NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
     [paragraphStyle setLineSpacing:4];//调整行间距
     NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:tipsDesc attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x999999)}];

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Course/VipCourse/Controller/VipCouseDetailViewController.m

@@ -234,7 +234,7 @@
         AccompanyEvaluateCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyEvaluateCell"];
         NSString *message = self.evaluateModel.teacherReplied;
         BOOL hasEvaluate = [NSString isEmptyString:self.evaluateModel.teacherReplied] ? NO : YES;
-        [cell configWithEvaluateMessage:message hasEvaluate:hasEvaluate];
+        [cell configWithEvaluateMessage:message courseStatus:self.homeworkModel.courseStatus hasEvaluate:hasEvaluate];
         return cell;
     }
     else if (indexPath.row == 2) {