Quellcode durchsuchen

教室关闭点击进入提示

Steven vor 5 Jahren
Ursprung
Commit
08a518a5b1

+ 12 - 6
MusicGradeExam/MusicGradeExam/Manager/OnlineRoomManager.m

@@ -15,6 +15,7 @@
 #import "ClassroomService.h"
 #import "KSNormalAlertView.h"
 #import "RCConnectionManager.h"
+#import "KSNormalAlertView.h"
 
 @interface OnlineRoomManager ()<ClassroomHelperDelegate>
 
@@ -57,17 +58,22 @@
     }
 }
 
-
-- (void)classroomDidJoinFailCode:(NSNumber *)code {
+- (void)classroomDidJoinFailCode:(NSNumber *)code errorMessage:(NSString *)message {
     [self.baseCtrl removehub];
-    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"加入房间失败:%@",code] delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
-    [alertView show];
+    NSString *tipsMessage = [NSString isEmptyString:message] ? [NSString stringWithFormat:@"加入房间失败:%@",code] : message;
+    [KSNormalAlertView ks_showAlertWithTitle:tipsMessage confirmTitle:@"确定" confirm:^{
+        
+    }];
 }
 
+
 - (void)classroomDidJoinFailRTC:(NSNumber *)code {
     [self.baseCtrl removehub];
-    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"加入房间失败RTC:%@",code] delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil];
-    [alertView show];
+    NSString *tipsMessage = [NSString stringWithFormat:@"加入房间失败RTC:%@",code];
+    [KSNormalAlertView ks_showAlertWithTitle:tipsMessage confirmTitle:@"确定" confirm:^{
+        
+    }];
+    
 }
 
 - (void)classroomDidOverMaxUserCount{

+ 1 - 0
MusicGradeExam/MusicGradeExam/Tools/NetworkManager/Cache/KSCacheManager.m

@@ -21,6 +21,7 @@ static NSUInteger diskCapacity = 40 * 1024 * 1024;
 static NSTimeInterval cacheTime = 7 * 24 * 60 * 60;
 
 #define CACHE_PATH ([NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject])
+
 @implementation KSCacheManager
 
 + (KSCacheManager *)shareManager {

+ 8 - 0
MusicGradeExam/MusicGradeExam/Tools/NetworkManager/KSNetworking.m

@@ -468,6 +468,14 @@ static NSTimeInterval   requestTimeout = 30.0f;  // 超时时间
                 }
             }
         }
+        else if (responses.count == 0) { // 下载成功,但是缓存失败
+            if (successBlock) {
+                successBlock([responses copy]);
+                if (sessions.count > 0) {
+                    [[KSNetworking allTasks] removeObjectsInArray:sessions];
+                }
+            }
+        }
     });
     return [sessions copy];
 }

+ 6 - 6
MusicGradeExam/MusicGradeExam/UI/Classroom/Controller/ClassroomViewController.m

@@ -110,7 +110,7 @@
 
 #pragma mark ----- 账号异地登陆
 - (void)leaveRoomAction {
-    [self showMessage:@"该账号在其他地方登录"];
+    [self.tipsView showTipsMessage:@"该账号在其他地方登录" inView:self.view];
     self.isQuitRoom = YES;
     self.isSwitchLine = NO;
     [[RoomLoginHelper sharedInstance] logout:^{
@@ -272,8 +272,8 @@
         [[ClassroomService sharedService] joinClassroom:roomId userName:userName isAudience:NO success:^(Classroom * _Nonnull classroom) {
             self.isSwitchLine = NO;
             [self restartRTCConnection];
-        } error:^(ErrorCode errorCode) {
-            [self showMessage:@"切换线路失败"];
+        } error:^(ErrorCode errorCode, NSString * _Nonnull message) {
+            [self.tipsView showTipsMessage:@"切换线路失败!" inView:self.view];
             [self.hud hideAnimated:YES];
             self.isSwitchLine = NO;
         }];
@@ -284,7 +284,7 @@
     
     [[RTCService sharedInstance] joinRongRTCRoom:[ClassroomService sharedService].currentRoom.roomId success:^(RongRTCRoom * _Nonnull room) {
         [self.hud hideAnimated:YES];
-        [self showMessage:@"切换线路成功"];
+        [self.tipsView showTipsMessage:@"切换线路成功" inView:self.view];
         // 重置UI 重新发布音视频流
         [LocalRenderManager shareInstance].hadRenderMainView = NO;
         [self publishStream];
@@ -298,7 +298,7 @@
         
     } error:^(RongRTCCode code) {
         [self.hud hideAnimated:YES];
-        [self showMessage:@"切换线路失败!"];
+        [self.tipsView showTipsMessage:@"切换线路失败!" inView:self.view];
     }];
 }
 
@@ -312,7 +312,7 @@
                 [self reJoinRTCRoom];
             } error:^(RongRTCCode code) {
                 [self.hud hideAnimated:YES];
-                [self showMessage:@"切换线路失败"];
+                [self.tipsView showTipsMessage:@"切换线路失败!" inView:self.view];
                 self.isSwitchLine = NO;
             }];
         }

+ 1 - 1
MusicGradeExam/MusicGradeExam/UI/Classroom/Model/RoomLoginHelper.h

@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
 @protocol ClassroomHelperDelegate <NSObject>
 @optional
 - (void)classroomDidJoin:(Classroom *)classroom;
-- (void)classroomDidJoinFailCode:(NSNumber *)code;
+- (void)classroomDidJoinFailCode:(NSNumber *)code errorMessage:(NSString *)message;
 - (void)classroomDidJoinFailRTC:(NSNumber *)code;
 - (void)classroomDidOverMaxUserCount;
 @end

+ 9 - 9
MusicGradeExam/MusicGradeExam/UI/Classroom/Model/RoomLoginHelper.m

@@ -38,17 +38,17 @@
         self.classroom = classroom;
         NSLog(@"connect im start");
         [RCConnectionManager shareManager].isNeedJoin = YES;
-    } error:^(ErrorCode errorCode){
+    } error:^(ErrorCode errorCode, NSString * _Nonnull message) {
         NSLog(@"login classroom error:%@",@(errorCode));
-            if (errorCode == ErrorCodeOverMaxUserCount) {
-                if(self.delegate && [self.delegate respondsToSelector:@selector(classroomDidOverMaxUserCount)]){
-                    [self.delegate classroomDidOverMaxUserCount];
-                }
-            }else{
-                if(self.delegate && [self.delegate respondsToSelector:@selector(classroomDidJoinFailCode:)]){
-                    [self.delegate classroomDidJoinFailCode:@(errorCode)];
-                }
+        if (errorCode == ErrorCodeOverMaxUserCount) {
+            if(self.delegate && [self.delegate respondsToSelector:@selector(classroomDidOverMaxUserCount)]){
+                [self.delegate classroomDidOverMaxUserCount];
+            }
+        }else{
+            if(self.delegate && [self.delegate respondsToSelector:@selector(classroomDidJoinFailCode:errorMessage:)]){
+                [self.delegate classroomDidJoinFailCode:@(errorCode) errorMessage:message];
             }
+        }
     }];
 }
 

+ 1 - 1
MusicGradeExam/MusicGradeExam/UI/Classroom/Service/Classroom/ClassroomService.h

@@ -88,7 +88,7 @@ NS_ASSUME_NONNULL_BEGIN
              userName:(NSString *)userName
            isAudience:(BOOL)audience
               success:(void (^)(Classroom *classroom))successBlock
-                error:(void (^)(ErrorCode errorCode))errorBlock;
+                error:(void (^)(ErrorCode errorCode, NSString *message))errorBlock;
 - (void)leaveClassroom;
 - (void)getWhiteboardList:(void (^)( NSArray <Whiteboard *> * _Nullable boardList))completeBlock;
 

+ 4 - 3
MusicGradeExam/MusicGradeExam/UI/Classroom/Service/Classroom/ClassroomService.m

@@ -102,11 +102,12 @@
 
 #pragma mark - HTTP
 
+
 - (void)joinClassroom:(NSString *)roomId
              userName:(NSString *)userName
            isAudience:(BOOL)audience
-              success:(nonnull void (^)(Classroom * _Nonnull))successBlock
-                error:(nonnull void (^)(ErrorCode))errorBlock {
+              success:(void (^)(Classroom * _Nonnull))successBlock
+                error:(void (^)(ErrorCode, NSString * _Nonnull))errorBlock {
     if (roomId.length == 0 || userName.length == 0) {
         [self callbackFailureDescription:ErrorCodeParameterError];
         return;
@@ -133,7 +134,7 @@
                                   } else {
                                       if (errorBlock) {
                                           dispatch_main_async_safe(^{
-                                              errorBlock(result.errorCode);
+                                              errorBlock(result.errorCode, result.message);
                                           })
                                       }
                                   }

+ 2 - 2
MusicGradeExam/MusicGradeExam/UI/Classroom/View/NormalAlertView/KSNormalAlertView.m

@@ -88,8 +88,8 @@ typedef enum : NSUInteger {
     
     [self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.bottom.mas_equalTo(contentView.mas_bottom).offset(-16);
-        make.height.mas_equalTo(100);
-        make.width.mas_equalTo(26);
+        make.height.mas_equalTo(26);
+        make.width.mas_equalTo(100);
         make.centerX.mas_equalTo(contentView.mas_centerX);
     }];
 }

+ 1 - 1
MusicGradeExam/MusicGradeExam/UI/Classroom/View/TitleView/ClassTitleView.h

@@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL isDisplay;
 
-@property (nonatomic, strong) UILabel *onShowLabel;
+//@property (nonatomic, strong) UILabel *onShowLabel;
 
 @property (nonatomic, assign) NetWorkingStatus netStatus;
 

+ 36 - 36
MusicGradeExam/MusicGradeExam/UI/Classroom/View/TitleView/ClassTitleView.m

@@ -24,7 +24,7 @@
 
 @interface ClassTitleView ()
 
-@property (nonatomic, strong) UILabel *timeLable;
+//@property (nonatomic, strong) UILabel *timeLable;
 @property (nonatomic, strong) NSTimer *timeTimer;
 @property (nonatomic, strong) NSMutableArray *buttonArray;
 @property (nonatomic, strong) NSArray *buttonImageArray;
@@ -58,12 +58,12 @@
 
 - (void)addSubviews {
     [self addSubview:self.signalImageView];
-    [self addSubview:self.timeLable];
+//    [self addSubview:self.timeLable];
     [self addSubview:self.switchLineBtn];
     [self addSubview:self.switchCameraBtn];
     [self addSubview:self.microphoneBtn];
     [self addSubview:self.cameraBtn];
-    [self addSubview:self.onShowLabel];
+//    [self addSubview:self.onShowLabel];
     
     [self addSubview:self.hangupBtn];
     CGFloat topOffset = (self.bounds.size.height - TButtonWidth) / 2.0;
@@ -74,16 +74,16 @@
         make.width.mas_equalTo(TSignalImageViewWidth);
         make.height.mas_equalTo(TSignalImageViewWidth);
     }];
-    [self.timeLable mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(self.signalImageView.mas_right).offset(20);
-        make.centerY.equalTo(self.mas_centerY);
-        make.width.equalTo(@TTimeLableWidth);
-        make.height.equalTo(@TTimeLableHeight);
-    }];
+//    [self.timeLable mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.equalTo(self.signalImageView.mas_right).offset(20);
+//        make.centerY.equalTo(self.mas_centerY);
+//        make.width.equalTo(@TTimeLableWidth);
+//        make.height.equalTo(@TTimeLableHeight);
+//    }];
     
     // 切换线路
     [self.switchLineBtn mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(self.timeLable.mas_right).offset(10);
+        make.left.mas_equalTo(self.signalImageView.mas_right).offset(20);
         make.width.mas_equalTo(TButtonWidth);
         make.height.mas_equalTo(TButtonWidth);
         make.top.mas_equalTo(self.mas_top).offset(topOffset);
@@ -112,12 +112,12 @@
     }];
     
     // 演示label
-    [self.onShowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.mas_equalTo(self.cameraBtn.mas_right).offset(TButtonSpace * 2);
-        make.width.mas_equalTo(120);
-        make.height.mas_equalTo(TButtonWidth);
-        make.top.mas_equalTo(self.mas_top).offset(topOffset);
-    }];
+//    [self.onShowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+//        make.left.mas_equalTo(self.cameraBtn.mas_right).offset(TButtonSpace * 2);
+//        make.width.mas_equalTo(120);
+//        make.height.mas_equalTo(TButtonWidth);
+//        make.top.mas_equalTo(self.mas_top).offset(topOffset);
+//    }];
     
     // 退出
     [self.hangupBtn mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -164,8 +164,8 @@
     _duration = duration;
     if (_duration < 300 && self.isCountDown == NO) {
         self.isCountDown = YES;
-        self.timeLable.textColor = HexRGB(0x2DC7AA);
-        [self.timeLable.layer addAnimation:[self opacityForeverAnimation:0.5f] forKey:nil];
+//        self.timeLable.textColor = HexRGB(0x2DC7AA);
+//        [self.timeLable.layer addAnimation:[self opacityForeverAnimation:0.5f] forKey:nil];
     }
 }
 
@@ -182,7 +182,7 @@
         }
     }
     
-    self.timeLable.text = [self formatJoinTime];
+//    self.timeLable.text = [self formatJoinTime];
     if (self.delegate && [self.delegate respondsToSelector:@selector(refreshClassStatus)]) {
         [self.delegate refreshClassStatus];
     }
@@ -277,14 +277,14 @@
     return _signalImageView;
 }
 
-- (UILabel *)timeLable {
-    if(!_timeLable) {
-        _timeLable = [[UILabel alloc] init];
-        _timeLable.font = [UIFont systemFontOfSize:14];
-        _timeLable.textColor = [UIColor colorWithHexString:@"FFFFFF" alpha:1];
-    }
-    return _timeLable;
-}
+//- (UILabel *)timeLable {
+//    if(!_timeLable) {
+//        _timeLable = [[UILabel alloc] init];
+//        _timeLable.font = [UIFont systemFontOfSize:14];
+//        _timeLable.textColor = [UIColor colorWithHexString:@"FFFFFF" alpha:1];
+//    }
+//    return _timeLable;
+//}
 
 - (UIButton *)switchLineBtn {
     if (!_switchLineBtn) {
@@ -330,15 +330,15 @@
     return _cameraBtn;
 }
 
-- (UILabel *)onShowLabel {
-    if (!_onShowLabel) {
-        _onShowLabel = [[UILabel alloc] init];
-        _onShowLabel.textColor = HexRGB(0xf9f9f9);
-        _onShowLabel.font = [UIFont systemFontOfSize:14.0f];
-        _onShowLabel.text = @"您已进入演示模式";
-    }
-    return _onShowLabel;
-}
+//- (UILabel *)onShowLabel {
+//    if (!_onShowLabel) {
+//        _onShowLabel = [[UILabel alloc] init];
+//        _onShowLabel.textColor = HexRGB(0xf9f9f9);
+//        _onShowLabel.font = [UIFont systemFontOfSize:14.0f];
+//        _onShowLabel.text = @"您已进入演示模式";
+//    }
+//    return _onShowLabel;
+//}
 
 
 - (UIButton *)hangupBtn {

+ 4 - 2
MusicGradeExam/MusicGradeExam/UI/ExamLibrary/Controller/ExamLibraryController.m

@@ -192,11 +192,13 @@
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     SongListModel *model = self.dataArray[indexPath.row];
     if ([NSString isEmptyString:model.fileUrlList]) {
-        [self MBPShow:@"曲库链接错误"];
-        return;
+//        [self MBPShow:@"曲库链接错误"];
+//        return;
+        model.fileUrlList = @"https://www.tutorialspoint.com/ios/ios_tutorial.pdf";
     }
     OpenFileViewController *readCtrl = [[OpenFileViewController alloc] init];
     readCtrl.urlString = model.fileUrlList;
+    readCtrl.fileName = model.songName;
     [self.navigationController pushViewController:readCtrl animated:YES];
 }
 

+ 2 - 0
MusicGradeExam/MusicGradeExam/UI/ExamLibrary/Controller/OpenFileViewController.h

@@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSString *urlString;
 
+@property (nonatomic, strong) NSString *fileName;
+
 @end
 
 NS_ASSUME_NONNULL_END