Browse Source

首页最近课程

Steven 7 months ago
parent
commit
1f9dd6e793

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Model/RecentCourseModel.h

@@ -22,6 +22,8 @@
 @property (nonatomic, strong) NSString *teacherId;
 @property (nonatomic, strong) NSString *courseGroupName;
 @property (nonatomic, strong) NSString *studentId;
+@property (nonatomic, strong) NSString *courseEndTime;
+
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
 - (instancetype)initWithDictionary:(NSDictionary *)dict;

+ 7 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Model/RecentCourseModel.m

@@ -19,6 +19,7 @@ NSString *const kRecentCourseModelCourseStartTime = @"courseStartTime";
 NSString *const kRecentCourseModelTeacherId = @"teacherId";
 NSString *const kRecentCourseModelCourseGroupName = @"courseGroupName";
 NSString *const kRecentCourseModelStudentId = @"studentId";
+NSString *const kRecentCourseModelCourseEndTime = @"courseEndTime";
 
 @interface RecentCourseModel ()
 
@@ -39,6 +40,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
 @synthesize teacherId = _teacherId;
 @synthesize courseGroupName = _courseGroupName;
 @synthesize studentId = _studentId;
+@synthesize courseEndTime = _courseEndTime;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
 {
@@ -63,7 +65,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
             self.teacherId = [self objectOrNilForKey:kRecentCourseModelTeacherId fromDictionary:dict];
             self.courseGroupName = [self objectOrNilForKey:kRecentCourseModelCourseGroupName fromDictionary:dict];
             self.studentId = [self objectOrNilForKey:kRecentCourseModelStudentId fromDictionary:dict];
-
+        self.courseEndTime = [self objectOrNilForKey:kRecentCourseModelCourseEndTime fromDictionary:dict];
     }
     
     return self;
@@ -84,6 +86,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
     [mutableDict setValue:self.teacherId forKey:kRecentCourseModelTeacherId];
     [mutableDict setValue:self.courseGroupName forKey:kRecentCourseModelCourseGroupName];
     [mutableDict setValue:self.studentId forKey:kRecentCourseModelStudentId];
+    [mutableDict setValue:self.courseEndTime forKey:kRecentCourseModelCourseEndTime];
     return [NSDictionary dictionaryWithDictionary:mutableDict];
 }
 
@@ -121,6 +124,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
     self.teacherId = [aDecoder decodeObjectForKey:kRecentCourseModelTeacherId];
     self.courseGroupName = [aDecoder decodeObjectForKey:kRecentCourseModelCourseGroupName];
     self.studentId = [aDecoder decodeObjectForKey:kRecentCourseModelStudentId];
+    self.courseEndTime = [aDecoder decodeObjectForKey:kRecentCourseModelCourseEndTime];
     return self;
 }
 
@@ -138,6 +142,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
     [aCoder encodeObject:_teacherId forKey:kRecentCourseModelTeacherId];
     [aCoder encodeObject:_courseGroupName forKey:kRecentCourseModelCourseGroupName];
     [aCoder encodeObject:_studentId forKey:kRecentCourseModelStudentId];
+    [aCoder encodeObject:_courseEndTime forKey:kRecentCourseModelCourseEndTime];
 }
 
 - (id)copyWithZone:(NSZone *)zone
@@ -157,6 +162,7 @@ NSString *const kRecentCourseModelStudentId = @"studentId";
         copy.teacherId = [self.teacherId copyWithZone:zone];
         copy.courseGroupName = [self.courseGroupName copyWithZone:zone];
         copy.studentId = [self.studentId copyWithZone:zone];
+        copy.courseEndTime = [self.courseEndTime copyWithZone:zone];
     }
     
     return copy;

+ 9 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeRecentCourseView.m

@@ -41,17 +41,24 @@
     NSDateFormatter *formatter = [NSObject getDateformatter];
     [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
     NSDate *beginDate = [formatter dateFromString:model.courseStartTime];
+    NSDate *endDate = [formatter dateFromString:model.courseEndTime];
+    
     NSDate *currentDate = [NSDate date];
     [formatter setDateFormat:@"yyyy-MM-dd"];
     NSString *currentDay = [formatter stringFromDate:currentDate];
     NSString *courseDay = [formatter stringFromDate:beginDate];
     if ([currentDay isEqualToString:courseDay]) {
         [formatter setDateFormat:@"HH:mm"];
-        self.timeLabel.text = [NSString stringWithFormat:@"今日 %@", [NSString returnNoNullStringWithString:[formatter stringFromDate:beginDate]]];
+        NSString *beginTime = [NSString returnNoNullStringWithString:[formatter stringFromDate:beginDate]];
+        NSString *endTime = [NSString returnNoNullStringWithString:[formatter stringFromDate:endDate]];
+        self.timeLabel.text = [NSString stringWithFormat:@"今日 %@-%@", beginTime, endTime];
     }
     else {
         [formatter setDateFormat:@"yyyy-MM-dd HH:mm"];
-        self.timeLabel.text = [NSString returnNoNullStringWithString:[formatter stringFromDate:beginDate]];
+        NSString *beginTime = [NSString returnNoNullStringWithString:[formatter stringFromDate:beginDate]];
+        [formatter setDateFormat:@"HH:mm"];
+        NSString *endTime = [NSString returnNoNullStringWithString:[formatter stringFromDate:endDate]];
+        self.timeLabel.text = [NSString stringWithFormat:@"%@-%@", beginTime, endTime];
     }
     
     if ([model.status isEqualToString:@"ING"]) { // 进行中

+ 4 - 7
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/HeadView/MinePageTopView.m

@@ -105,8 +105,7 @@
         }
         else {
             NSArray *tagArray = [infoMessage.subjectName componentsSeparatedByString:@","];
-            CGFloat maxWidth = kScreenWidth - 28 - 10 - 91;
-            [self configTagViewWithTagArray:tagArray maxWidth:maxWidth];
+            [self configTagViewWithTagArray:tagArray];
         }
         
         NSString *viperImage = @"";
@@ -185,21 +184,19 @@
     return 131 + 14 + 64 + EMPTY_HEIGHT;
 }
 
-- (void)configTagViewWithTagArray:(NSArray *)tagArray maxWidth:(CGFloat)maxWidth {
+- (void)configTagViewWithTagArray:(NSArray *)tagArray {
     [self.tagScroll removeAllSubViews];
-    CGFloat width = maxWidth;
     CGFloat xSpace = 0.0f;
     for (NSInteger i = 0; i < tagArray.count; i++) {
         NSString *tagString = tagArray[i];
         CGFloat labelWidth = [self getStringWidthInLabel:tagString font:[UIFont systemFontOfSize:10.0f]];
         CGFloat viewWidth = labelWidth + 16;
-        if (xSpace + viewWidth > width) {
-            return;
-        }
+
         CGRect frame = CGRectMake(xSpace, 0, viewWidth, 20.0f);
         [self createTagLabelViewWithName:tagString frame:frame];
         xSpace += (viewWidth + 6);
     }
+    self.tagScroll.contentSize = CGSizeMake(xSpace, 20);
 }
 
 - (CGFloat)getStringWidthInLabel:(NSString *)tagString font:(UIFont *)font {