Browse Source

模拟考试

Steven 4 năm trước cách đây
mục cha
commit
26438e25ef

+ 4 - 4
MusicGradeExam/MusicGradeExam.xcodeproj/project.pbxproj

@@ -3542,7 +3542,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_ENTITLEMENTS = "MusicGradeExam/酷乐秀.entitlements";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.2.0;
+				CURRENT_PROJECT_VERSION = 1.3.0;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = P664H7S5LL;
 				ENABLE_BITCODE = NO;
@@ -3564,7 +3564,7 @@
 					"$(inherited)",
 					"$(PROJECT_DIR)/MusicGradeExam/RongCloud/IMLib",
 				);
-				MARKETING_VERSION = 1.2.0;
+				MARKETING_VERSION = 1.3.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.JMCloudMusic.MusicGradeExam;
 				PRODUCT_NAME = "酷乐秀";
 				TARGETED_DEVICE_FAMILY = "1,2";
@@ -3578,7 +3578,7 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CODE_SIGN_ENTITLEMENTS = "MusicGradeExam/酷乐秀.entitlements";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.2.0;
+				CURRENT_PROJECT_VERSION = 1.3.0;
 				DEVELOPMENT_TEAM = P664H7S5LL;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -3599,7 +3599,7 @@
 					"$(inherited)",
 					"$(PROJECT_DIR)/MusicGradeExam/RongCloud/IMLib",
 				);
-				MARKETING_VERSION = 1.2.0;
+				MARKETING_VERSION = 1.3.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.JMCloudMusic.MusicGradeExam;
 				PRODUCT_NAME = "酷乐秀";
 				TARGETED_DEVICE_FAMILY = "1,2";

+ 35 - 26
MusicGradeExam/MusicGradeExam/UI/Classroom/Controller/ClassroomViewController.m

@@ -58,10 +58,17 @@ typedef NS_ENUM(NSInteger, KICKTYPE) {
 
 @property (nonatomic, strong) SubjectImageModel *guideImageModel;
 
+@property (nonatomic, assign) BOOL isSimulitionExam;  // 是否模拟考试
+
 @end
 
 @implementation ClassroomViewController
 
+- (void)setRegistrationId:(NSString *)registrationId {
+    _registrationId = registrationId;
+    _isSimulitionExam = [registrationId containsString:@"S"] ? YES : NO;
+}
+
 #pragma mark - Life cycle
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -181,13 +188,23 @@ typedef NS_ENUM(NSInteger, KICKTYPE) {
                 [KSNormalAlertView ks_showAlertWithTitle:@"确认关闭麦克风吗?" leftTitle:@"取消" rightTitle:@"确认" cancel:^{
                 } confirm:^{
                     button.selected = YES;
-                    [[ClassroomService sharedService] enableDevice:NO withType:DeviceTypeMicrophone];
+                    if (self.isSimulitionExam) {
+                        [[RTCService sharedInstance] setMicrophoneDisable:YES];
+                    }
+                    else {
+                        [[ClassroomService sharedService] enableDevice:NO withType:DeviceTypeMicrophone];
+                    }
                 }];
 
             }
             else {
                 button.selected = NO;
-                [[ClassroomService sharedService] enableDevice:YES withType:DeviceTypeMicrophone];
+                if (self.isSimulitionExam) {
+                    [[RTCService sharedInstance] setMicrophoneDisable:NO];
+                }
+                else {
+                    [[ClassroomService sharedService] enableDevice:YES withType:DeviceTypeMicrophone];
+                }
             }
         }
             break;
@@ -197,12 +214,24 @@ typedef NS_ENUM(NSInteger, KICKTYPE) {
                 [KSNormalAlertView ks_showAlertWithTitle:@"确认关闭摄像头吗?" leftTitle:@"取消" rightTitle:@"确认" cancel:^{
                 } confirm:^{
                     button.selected = YES;
-                    [[ClassroomService sharedService] enableDevice:NO withType:DeviceTypeCamera];
+                    
+                    if (self.isSimulitionExam) {
+                        [[RTCService sharedInstance] setCameraDisable:YES];
+                    }
+                    else {
+                        [[ClassroomService sharedService] enableDevice:NO withType:DeviceTypeCamera];
+                    }
                 }];
             }
             else {
                 button.selected = NO;
-                [[ClassroomService sharedService] enableDevice:YES withType:DeviceTypeCamera];
+                
+                if (self.isSimulitionExam) {
+                    [[RTCService sharedInstance] setCameraDisable:NO];
+                }
+                else {
+                    [[ClassroomService sharedService] enableDevice:YES withType:DeviceTypeCamera];
+                }
             }
         }
             break;
@@ -245,28 +274,7 @@ typedef NS_ENUM(NSInteger, KICKTYPE) {
 
 // 判断是否需要退出房间
 - (void)refreshClassStatus {
-    /*
-    NSString *userType = UserDefault(UserTypeKey);
-    if (![userType isEqualToString:@"1"] && self.isQuitRoom == NO) {
-        NSString *formatString = @"yyyy-MM-dd HH:mm:ss";
-        NSDate *endDate = [NSDate dateFromString:self.classEndTime format:formatString];
-        NSTimeInterval endDuration = [[NSDate date] timeIntervalSinceDate:endDate];
-        if (endDuration >= self.quitRoomTime * 60) {
-            self.isQuitRoom = YES;
-            // 退出房间
-            [self showMessage:@"课程已结束"];
-            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-                // 课程结束退出房间
-                SealClassLog(@"ClassEnd!");
-                self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
-                [[LoginHelper sharedInstance] logout:^{
-                } error:^(RongRTCCode code) {
-                    [self.hud hideAnimated:YES];
-                }];
-            });
-        }
-    }
-     */
+    
 }
 
 #pragma mark ------ 退出RTC房间并重新加入
@@ -705,6 +713,7 @@ typedef NS_ENUM(NSInteger, KICKTYPE) {
         }
         _videoListView = [[ClassVideoListView alloc] initWithFrame:CGRectMake(width + iPhoneXSafeTopMargin + 5, 10, kScreenWidth -  (width + 10 + iPhoneXSafeTopMargin) - iPhoneXSafeBottomMargin, height)];
         _videoListView.delegate = self;
+        _videoListView.isSimulitionExam = self.isSimulitionExam;
     }
     return _videoListView;
 }

+ 6 - 1
MusicGradeExam/MusicGradeExam/UI/Classroom/Service/Classroom/ClassroomService.m

@@ -114,7 +114,12 @@
     }
     [HTTPUtility setAuthHeader:[NSString stringWithFormat:@"%@ %@", UserDefault(Token_type), UserDefault(TokenKey)]];
     NSMutableDictionary *dic = [[NSMutableDictionary alloc] init];
-    [dic setObject:roomId forKey:@"registrationId"];
+    if ([roomId containsString:@"S"]) {
+        [dic setObject:roomId forKey:@"roomId"];
+    }
+    else {
+        [dic setObject:roomId forKey:@"registrationId"];
+    }
     [dic setObject:@(audience) forKey:@"audience"];
     [dic setObject:userName forKey:@"userName"];
     [HTTPUtility requestWithHTTPMethod:HTTPMethodPost

+ 1 - 1
MusicGradeExam/MusicGradeExam/UI/Classroom/View/VideoList/ClassVideoListCell.m

@@ -221,7 +221,7 @@
         _WaitLable.textAlignment = NSTextAlignmentCenter;
         _WaitLable.backgroundColor = [UIColor clearColor];
         _WaitLable.textColor = [UIColor colorWithHexString:@"FFFFFF" alpha:1];
-        _WaitLable.text =  @"老师正在赶来的路上\n请耐心等待";
+        _WaitLable.text =  @"正式考试时\n此处显示评委画面";
         _WaitLable.hidden = YES;
     }
     return _WaitLable;

+ 2 - 0
MusicGradeExam/MusicGradeExam/UI/Classroom/View/VideoList/ClassVideoListView.h

@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface ClassVideoListView : UIView
 
+@property (nonatomic, assign) BOOL isSimulitionExam;  // 是否模拟考试
+
 @property (nonatomic, weak) id<ClassVideoListViewDelegate> delegate;
 
 - (void)updateUserVideo:(NSString *)userId;

+ 4 - 0
MusicGradeExam/MusicGradeExam/UI/Classroom/View/VideoList/ClassVideoListView.m

@@ -69,6 +69,10 @@
             [lastArray removeObjectsInArray:removeArray];
         }
         
+        if (lastArray.count == 0 && self.isSimulitionExam) {
+            RoomMember *member = [[RoomMember alloc] init];
+            [lastArray insertObject:member atIndex:0];
+        }
         dispatch_async(dispatch_get_main_queue(), ^{
             self.videoDataSource = [lastArray mutableCopy];
             [self.videoListTableView reloadData];

+ 1 - 1
MusicGradeExam/MusicGradeExam/UI/Home/SimulationExam/Controller/SimulationWaitExamController.m

@@ -199,7 +199,7 @@
         case JOINROOMACTION_JOIN:  // 加入房间
         {
             if (self.sourceModel.classroomSwitch == 1) {
-                NSString *roomId = [NSString stringWithFormat:@"%.0f", source.examRegistrationId];
+                NSString *roomId = self.examRegistrationId;
                 [self joinRoomAction:roomId];
             }
         }