Ver código fonte

小组课课程调整

Steven 2 dias atrás
pai
commit
81ff3979de

BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Course/lesson_Live.imageset/lesson_Live@2x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Course/lesson_Live.imageset/lesson_Live@3x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/program_tips.imageset/program_tips@2x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/program_tips.imageset/program_tips@3x.png


+ 52 - 13
KulexiuForTeacher/KulexiuForTeacher/Module/Course/Controller/CourseViewController.m

@@ -73,6 +73,10 @@
 
 @property (nonatomic, strong) NSString *adjustEndTime;    // 可调整结束时间
 
+@property (nonatomic, assign) NSInteger groupStartTime;      // 小组课开课前可进入时间配置(分钟)
+
+@property (nonatomic, assign) NSInteger groupEndTime;        // 小组课结束后退出时间配置(分钟)
+
 @end
 
 @implementation CourseViewController
@@ -373,9 +377,13 @@
             
             self.liveStartTime = [config ks_integerValueForKey:@"liveStartTime"];
             self.liveEndTime = [config ks_integerValueForKey:@"liveEndTime"];
+            
             self.pianoStartTime = [config ks_integerValueForKey:@"pianoStartTime"];
             self.pianoEndTime = [config ks_integerValueForKey:@"pianoEndTime"];
             
+            self.groupStartTime = [config ks_integerValueForKey:@"groupStartTime"];
+            self.groupEndTime = [config ks_intValueForKey:@"groupEndTime"];
+            
             NSArray *courseArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"studentList"];
             NSMutableArray *lessonArray = [NSMutableArray array];
             for (NSDictionary *parm in courseArray) {
@@ -468,10 +476,11 @@
     else { // 琴房课 PIANO_ROOM_CLASS
         
         BOOL isGroup = [model.courseType isEqualToString:@"GROUP"] ? YES : NO;
+        NSInteger beforeTime = isGroup ? self.groupStartTime : self.pianoStartTime;
         MusicRoomCourseCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MusicRoomCourseCell"];
         MJWeakSelf;
-        [cell configWithSource:model isGroup:isGroup beforeTime:self.pianoStartTime callback:^(NSString * _Nonnull targetId) {
-            [weakSelf chatAction:targetId groupName:@"" isGroup:YES];
+        [cell configWithCourseMessage:model isGroup:isGroup beforeTime:beforeTime actionCallback:^(MUSIC_COURSE_TYPE type, TableCourseModel * _Nonnull courseModel) {
+            [weakSelf musicRoomAction:type source:courseModel];
         }];
         return cell;
     }
@@ -491,18 +500,10 @@
         [self liveCourseDetail:model.courseId courseGroupId:model.courseGoupId];
     }
     else if ([model.courseType isEqualToString:@"GROUP"]) {
-        MusicRoomViewController *ctrl = [[MusicRoomViewController alloc] init];
-        ctrl.courseType = MUTIL_COURSE_TYPE_GROUP;
-        ctrl.courseId = model.courseId;
-        ctrl.courseGroupId = model.courseGoupId;
-        [self.navigationController pushViewController:ctrl animated:YES];
+        [self showMusicRoomDetail:model];
     }
     else {
-        MusicRoomViewController *ctrl = [[MusicRoomViewController alloc] init];
-        ctrl.courseType = MUTIL_COURSE_TYPE_MUSIC;
-        ctrl.courseId = model.courseId;
-        ctrl.courseGroupId = model.courseGoupId;
-        [self.navigationController pushViewController:ctrl animated:YES];
+        [self showMusicRoomDetail:model];
     }
 }
 
@@ -550,6 +551,45 @@
     }
 }
 
+- (void)musicRoomAction:(MUSIC_COURSE_TYPE)action source:(TableCourseModel *)source {
+    switch (action) {
+        case MUSIC_COURSE_TYPE_CHAT:
+        {
+            [self chatAction:source.imGroupId groupName:@"" isGroup:YES];
+        }
+            break;
+        case MUSIC_COURSE_TYPE_ADJUST:
+        {
+            [self adjustCourseAction:source];
+        }
+            break;
+        case MUSIC_COURSE_TYPE_DETAIL:
+        {
+            [self showMusicRoomDetail:source];
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+- (void)showMusicRoomDetail:(TableCourseModel *)source {
+    if ([source.courseType isEqualToString:@"GROUP"]) {
+        MusicRoomViewController *ctrl = [[MusicRoomViewController alloc] init];
+        ctrl.courseType = MUTIL_COURSE_TYPE_GROUP;
+        ctrl.courseId = source.courseId;
+        ctrl.courseGroupId = source.courseGoupId;
+        [self.navigationController pushViewController:ctrl animated:YES];
+    }
+    else {
+        MusicRoomViewController *ctrl = [[MusicRoomViewController alloc] init];
+        ctrl.courseType = MUTIL_COURSE_TYPE_MUSIC;
+        ctrl.courseId = source.courseId;
+        ctrl.courseGroupId = source.courseGoupId;
+        [self.navigationController pushViewController:ctrl animated:YES];
+    }
+}
+
 - (void)adjustCourseAction:(TableCourseModel *)source {
     // 获取当前课程的时间
     NSString *formatString = @"yyyy-MM-dd HH:mm:ss";
@@ -636,7 +676,6 @@
     switch (action) {
         case LIVECOURSEACTION_CHAT:  // 聊天
         {
-
             [self chatAction:source.imGroupId groupName:@"" isGroup:YES];
         }
             break;

+ 10 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Course/MusicRoom/Controller/MusicRoomViewController.m

@@ -107,8 +107,16 @@
     [KSNetworkingManager selectRoomConfigRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             NSDictionary *result = [dic ks_dictionaryValueForKey:@"data"];
-            self.joinRoomBeforeTime = [result ks_integerValueForKey:@"pianoStartTime"];
-            self.quitRomeEndTime = [result ks_integerValueForKey:@"pianoEndTime"];
+            
+            if (self.courseType == MUTIL_COURSE_TYPE_GROUP) {
+                self.joinRoomBeforeTime = [result ks_integerValueForKey:@"groupStartTime"];
+                self.quitRomeEndTime = [result ks_integerValueForKey:@"groupEndTime"];
+            }
+            else {
+                self.joinRoomBeforeTime = [result ks_integerValueForKey:@"pianoStartTime"];
+                self.quitRomeEndTime = [result ks_integerValueForKey:@"pianoEndTime"];
+            }
+            
         }
         else {
             [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];

+ 1 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/GroupCourseGroup/MyGroupCourseGroupListCell.m

@@ -69,7 +69,6 @@
 }
 
 - (void)evaluateGroupStatus:(NSString *)status sourceModel:(LiveLessonModel *)model {
-    NSString *desc = [NSString stringWithFormat:@"%.0f人学习", model.studentCount];
     if ([status isEqualToString:@"ING"]) {
         self.courseStatus.text = @"已开课";
         self.courseStatus.textColor = THEMECOLOR;
@@ -77,7 +76,6 @@
     else if ([status isEqualToString:@"NOT_START"]) {
         self.courseStatus.text = @"未开课";
         self.courseStatus.textColor = HexRGB(0xFF802C);
-        desc = [NSString stringWithFormat:@"剩余%.0f个名额", model.maxStudentNum - model.studentCount];
     }
     else if ([status isEqualToString:@"COMPLETE"]) {
         self.courseStatus.text = @"已结课";
@@ -86,9 +84,8 @@
     else if ([status isEqualToString:@"CANCEL"]) {
         self.courseStatus.text = @"已取消";
         self.courseStatus.textColor = HexRGB(0x999999);
-        desc = [NSString stringWithFormat:@"剩余%.0f个名额", model.maxStudentNum - model.studentCount];
     }
-    
+    NSString *desc = [NSString stringWithFormat:@"%.0f人学习", model.studentCount];
     self.bookDesc.text = desc;
 
 }

+ 11 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/PopView/MusicRoomCourseCell.h

@@ -6,17 +6,27 @@
 //
 
 #import <UIKit/UIKit.h>
+#import "TableCourseModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
-
+typedef NS_ENUM(NSInteger, MUSIC_COURSE_TYPE) {
+    MUSIC_COURSE_TYPE_CHAT,
+    MUSIC_COURSE_TYPE_DETAIL,
+    MUSIC_COURSE_TYPE_ADJUST,
+};
 
 typedef void(^MusicRoomChatAction)(NSString *targetId);
 
+typedef void(^MusicRoomLessonCallback)(MUSIC_COURSE_TYPE type, TableCourseModel * _Nonnull courseModel);
 
 @interface MusicRoomCourseCell : UITableViewCell
 
 - (void)configWithSource:(id)source isGroup:(BOOL)isGroup beforeTime:(NSInteger)beforeTime callback:(MusicRoomChatAction)callback;
 
+/// 课表使用
+- (void)configWithCourseMessage:(TableCourseModel *)model isGroup:(BOOL)isGroup beforeTime:(NSInteger)beforeTime actionCallback:(MusicRoomLessonCallback)callback;
+
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 81 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/PopView/MusicRoomCourseCell.m

@@ -31,6 +31,13 @@
 
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *buttonWidth;
 
+@property (nonatomic, assign) MUSIC_COURSE_TYPE type;
+
+/// 课表使用
+@property (nonatomic, copy) MusicRoomLessonCallback lessonCallback;
+
+@property (nonatomic, strong) TableCourseModel *lessonModel;
+
 @end
 
 @implementation MusicRoomCourseCell
@@ -112,6 +119,70 @@
     }
 }
 
+
+/// 课表使用
+- (void)configWithCourseMessage:(TableCourseModel *)model isGroup:(BOOL)isGroup beforeTime:(NSInteger)beforeTime actionCallback:(MusicRoomLessonCallback)callback {
+    if (callback) {
+        self.lessonCallback = callback;
+    }
+    self.lessonModel = model;
+    NSString *courseImgName = isGroup ? @"course_group" : @"course_musicRoom";
+    [self.courseImage setImage:[UIImage imageNamed:courseImgName]];
+    // time
+    [self evaluateTimeLabelWithBeginTime:model.startTime endTime:model.endTime];
+    self.courseName.text = [NSString returnNoNullStringWithString:model.courseName];
+    self.subjectName.text = [NSString returnNoNullStringWithString:model.subjectName];
+    
+    self.memberCount.text = [NSString stringWithFormat:@"%@人",model.payCount];
+    
+    self.operationButton.userInteractionEnabled = YES;
+    [self.operationButton setTitle:@"进入教室" forState:UIControlStateNormal];
+    [self.operationButton setTitleColor:HexRGB(0xffffff) forState:UIControlStateNormal];
+    [self.operationButton setBackgroundColor:THEMECOLOR];
+    
+    if ([model.status isEqualToString:@"NOT_START"]) {
+        self.statusLabel.text = @"未开始";
+        self.statusLabel.textColor = HexRGB(0xFF802C);
+        // 判断按钮显示调课还是进入教室
+        BOOL canChange = isGroup;
+        
+        NSDate *currentDate = [NSDate date];
+        NSDate *beginDate = [self getCourseBeginDate:model.startTime];
+        NSTimeInterval beginTimeInterval = [beginDate timeIntervalSinceDate:currentDate];
+        if (beginTimeInterval < beforeTime * 60) {
+            self.operationButton.hidden = NO;
+            self.buttonWidth.constant = 70.0f;
+            self.type = MUSIC_COURSE_TYPE_DETAIL;
+        }
+        else {
+            if (canChange) {
+                self.operationButton.hidden = NO;
+                self.buttonWidth.constant = 70.0f;
+                [self.operationButton setTitle:@"调课" forState:UIControlStateNormal];
+                self.type = MUSIC_COURSE_TYPE_ADJUST;
+            }
+            else {
+                self.operationButton.hidden = YES;
+                self.buttonWidth.constant = 0.0f;
+            }            
+        }
+    }
+    else if ([model.status isEqualToString:@"ING"]) {
+        self.statusLabel.text = @"进行中";
+        self.statusLabel.textColor = THEMECOLOR;
+        self.operationButton.hidden = NO;
+        self.buttonWidth.constant = 70.0f;
+        self.type = MUSIC_COURSE_TYPE_DETAIL;
+    }
+    else if ([model.status isEqualToString:@"COMPLETE"]) {
+        self.statusLabel.text = @"已结束";
+        self.statusLabel.textColor = HexRGB(0x999999);
+        self.operationButton.hidden = YES;
+        self.buttonWidth.constant = 0.0f;
+    }
+}
+
+
 - (NSDate *)getCourseBeginDate:(NSString *)beginTime {
     NSDateFormatter *dateFormatter = [NSObject getDateformatter];
     [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
@@ -137,8 +208,18 @@
     if (self.callback) {
         self.callback(self.targetId);
     }
+    if (self.lessonCallback) {
+        self.lessonCallback(MUSIC_COURSE_TYPE_CHAT, self.lessonModel);
+    }
 }
 
+- (IBAction)courseAction:(id)sender {
+    if (self.lessonCallback) {
+        self.lessonCallback(self.type, self.lessonModel);
+    }
+}
+
+
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
     [super setSelected:selected animated:animated];
 

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/PopView/MusicRoomCourseCell.xib

@@ -133,6 +133,9 @@
                                         <real key="value" value="14"/>
                                     </userDefinedRuntimeAttribute>
                                 </userDefinedRuntimeAttributes>
+                                <connections>
+                                    <action selector="courseAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="fXG-2B-9qe"/>
+                                </connections>
                             </button>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeRecentCourseView.m

@@ -89,6 +89,9 @@
         else if ([self.courseModel.courseType isEqualToString:@"PIANO_ROOM_CLASS"]) {
             type = RECENTCOURSE_TYPE_MUSICCLASS;
         }
+        else if ([self.courseModel.courseType isEqualToString:@"GROUP"]) {
+            type = RECENTCOURSE_TYPE_GROUP;
+        }
         else if ([self.courseModel.courseType isEqualToString:@"VIP"]) {
             type = RECENTCOURSE_TYPE_VIP;
         }