Steven 1 éve
szülő
commit
96992f7fbf

+ 16 - 0
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -439,6 +439,9 @@
 		BC0A22C0284752900065C1AB /* WhiteboardListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0A22BE284752900065C1AB /* WhiteboardListCell.m */; };
 		BC0A22C1284752900065C1AB /* WhiteboardListView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0A22BF284752900065C1AB /* WhiteboardListView.m */; };
 		BC0A22C528475E060065C1AB /* SongListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0A22C428475E060065C1AB /* SongListViewController.m */; };
+		BC0D951D2AC2868400E54D3F /* KSWebLoadRefreshView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0D951B2AC2868400E54D3F /* KSWebLoadRefreshView.m */; };
+		BC0D951E2AC2868400E54D3F /* KSWebLoadRefreshView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC0D951C2AC2868400E54D3F /* KSWebLoadRefreshView.xib */; };
+		BC0D95212AC2870400E54D3F /* UIViewController+KSExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0D95202AC2870400E54D3F /* UIViewController+KSExtension.m */; };
 		BC106B252A8F44F8000759A9 /* TXLiveRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC106B242A8F44F8000759A9 /* TXLiveRoomViewController.m */; };
 		BC106B302A8F4541000759A9 /* TXLiveRoomTimeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = BC106B272A8F453F000759A9 /* TXLiveRoomTimeManager.m */; };
 		BC106B312A8F4541000759A9 /* TXLiveURLUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = BC106B282A8F453F000759A9 /* TXLiveURLUtils.m */; };
@@ -2008,6 +2011,11 @@
 		BC0A22BF284752900065C1AB /* WhiteboardListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WhiteboardListView.m; sourceTree = "<group>"; };
 		BC0A22C328475E060065C1AB /* SongListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SongListViewController.h; sourceTree = "<group>"; };
 		BC0A22C428475E060065C1AB /* SongListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SongListViewController.m; sourceTree = "<group>"; };
+		BC0D951A2AC2868400E54D3F /* KSWebLoadRefreshView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSWebLoadRefreshView.h; sourceTree = "<group>"; };
+		BC0D951B2AC2868400E54D3F /* KSWebLoadRefreshView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KSWebLoadRefreshView.m; sourceTree = "<group>"; };
+		BC0D951C2AC2868400E54D3F /* KSWebLoadRefreshView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KSWebLoadRefreshView.xib; sourceTree = "<group>"; };
+		BC0D951F2AC2870300E54D3F /* UIViewController+KSExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+KSExtension.h"; sourceTree = "<group>"; };
+		BC0D95202AC2870400E54D3F /* UIViewController+KSExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+KSExtension.m"; sourceTree = "<group>"; };
 		BC106B232A8F44F8000759A9 /* TXLiveRoomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXLiveRoomViewController.h; sourceTree = "<group>"; };
 		BC106B242A8F44F8000759A9 /* TXLiveRoomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TXLiveRoomViewController.m; sourceTree = "<group>"; };
 		BC106B262A8F453E000759A9 /* TXLiveMessageCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TXLiveMessageCenter.h; sourceTree = "<group>"; };
@@ -3636,6 +3644,9 @@
 				277935E727E32A450010E277 /* KSBaseViewController.m */,
 				277935E927E32A930010E277 /* KSBaseWKWebViewController.h */,
 				277935EA27E32A930010E277 /* KSBaseWKWebViewController.m */,
+				BC0D951A2AC2868400E54D3F /* KSWebLoadRefreshView.h */,
+				BC0D951B2AC2868400E54D3F /* KSWebLoadRefreshView.m */,
+				BC0D951C2AC2868400E54D3F /* KSWebLoadRefreshView.xib */,
 				275B172527EB1C6C0081FDEF /* KSBaseTableViewController.h */,
 				275B172427EB1C6B0081FDEF /* KSBaseTableViewController.m */,
 				275FA1A427E7327200CFEA2E /* KSAQRecordManager.h */,
@@ -3813,6 +3824,8 @@
 		277930C527E30FBD0010E277 /* Category */ = {
 			isa = PBXGroup;
 			children = (
+				BC0D951F2AC2870300E54D3F /* UIViewController+KSExtension.h */,
+				BC0D95202AC2870400E54D3F /* UIViewController+KSExtension.m */,
 				BCDB092F280583C000D0BDAD /* NSObject+KSDateFormatter.h */,
 				BCDB0930280583C100D0BDAD /* NSObject+KSDateFormatter.m */,
 				2779331327E310A70010E277 /* UIView+Animation.h */,
@@ -8022,6 +8035,7 @@
 				BC0A22A8284751F80065C1AB /* DownloadStatusCell.xib in Resources */,
 				BCC5840228A9FA8100BAB4CF /* cloud_animation_28.png in Resources */,
 				BC71D1F42887FDD40010F14B /* img_6.png in Resources */,
+				BC0D951E2AC2868400E54D3F /* KSWebLoadRefreshView.xib in Resources */,
 				BCC5840E28A9FA8100BAB4CF /* cloud_animation_0.png in Resources */,
 				275B170D27EB14AC0081FDEF /* KSChatListSearchView.xib in Resources */,
 				BC71D1332887ADDA0010F14B /* teacher_refresh.json in Resources */,
@@ -8681,6 +8695,7 @@
 				BC71DF2E2A8A2233003F165E /* KSNewWhiteBoard.m in Sources */,
 				BCDF82252A8A2F56005F8B82 /* KSCloseCourseView.m in Sources */,
 				2779331627E310AA0010E277 /* UIView+ShowProgress.m in Sources */,
+				BC0D95212AC2870400E54D3F /* UIViewController+KSExtension.m in Sources */,
 				BC71DEFD2A89F470003F165E /* TXClassroomMainContainer.m in Sources */,
 				BC7663092827C95200C91A1D /* KSUploadManager.m in Sources */,
 				BC3ACD972890D61400060E97 /* NoRecordViewController.m in Sources */,
@@ -8702,6 +8717,7 @@
 				2755C07E27EC95CC007D9070 /* GroupNoticeViewController.m in Sources */,
 				2779328F27E30FEB0010E277 /* MSSBrowseLocalViewController.m in Sources */,
 				BCC305F828FD4C0800C39762 /* KSChatUserDetailViewController.m in Sources */,
+				BC0D951D2AC2868400E54D3F /* KSWebLoadRefreshView.m in Sources */,
 				BC1365C4280D44EB00EB03E2 /* NotiferMessageViewController.m in Sources */,
 				27A54CF127E9BD3B007309A3 /* FeedbackViewController.m in Sources */,
 				BC106B7B2A8F4586000759A9 /* TXLiveMessageUnBlockUser.m in Sources */,

+ 1 - 14
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSAccompanyWebViewController.m

@@ -205,19 +205,6 @@
 
 - (void)initWebView {
     [self.scrollView removeFromSuperview];
-    [self.view addSubview:self.navView];
-    CGFloat topHeight = kNaviBarHeight;
-    [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.mas_equalTo(self.view);
-        make.height.mas_equalTo(kNaviBarHeight);
-    }];
-    if (self.hiddenNavBar) {
-        topHeight = 0.0f;
-        [self.navView mas_updateConstraints:^(MASConstraintMaker *make) {
-            make.height.mas_equalTo(0);
-        }];
-    }
-    
     [self.view addSubview:self.viewContainer];
     [self.viewContainer mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.right.top.bottom.mas_equalTo(self.view);
@@ -263,7 +250,7 @@
         [self.view addSubview:self.myWebView];
         [self.myWebView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.right.mas_equalTo(self.view);
-            make.top.mas_equalTo(self.view.mas_top).offset(topHeight);
+            make.top.mas_equalTo(self.view.mas_top);
             make.bottom.mas_equalTo(self.view.mas_bottom);
         }];
         if (@available(iOS 11.0, *)) {

+ 9 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseViewController.h

@@ -32,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSMutableArray *dataArray;
 
+@property (nonatomic, strong) KSBaseViewController *preCtrl;
+
 - (void)modifyNavigationBarColor:(UIColor *)barColor;
 
 - (void)addfeedBackGenertor;//添加震动反馈
@@ -96,6 +98,13 @@ NS_ASSUME_NONNULL_BEGIN
 
 // 移除通知
 - (void)removeNotifier;
+
+/// 获取上一个视图控制器
+- (KSBaseViewController *)getPreViewController;
+/// 获取下一个视图控制器
+- (KSBaseViewController *)getNextViewController;
+
+- (BOOL)isViewPopDismiss;
 @end
 
 NS_ASSUME_NONNULL_END

+ 37 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseViewController.m

@@ -407,6 +407,43 @@
 - (void)removeNotifier {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
 }
+
+/// 获取上一个视图控制器
+- (KSBaseViewController *)getPreViewController {
+    NSInteger currentIndex = [self.navigationController.viewControllers indexOfObject:self];
+    if (currentIndex > 0 && currentIndex < self.navigationController.viewControllers.count && currentIndex != NSNotFound) {
+        // 获取上一个视图控制器
+        return [self.navigationController.viewControllers objectAtIndex:currentIndex - 1];
+    }
+    return nil;
+}
+
+/// 获取下一个视图控制器
+- (KSBaseViewController *)getNextViewController {
+    NSArray *viewControllers = self.navigationController.viewControllers;//获取当前的视图控制其
+    if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) { //当前视图控制器在栈中,故为push操作
+        return [self.navigationController.viewControllers objectAtIndex:viewControllers.count - 1];
+    }
+    else {
+        return [self getPreViewController];
+    }
+}
+
+// viewWillDisappear 使用
+- (BOOL)isViewPopDismiss {
+    NSArray *viewControllers = self.navigationController.viewControllers;//获取当前的视图控制其
+    if (viewControllers.count > 1 && [viewControllers objectAtIndex:viewControllers.count-2] == self) { //当前视图控制器在栈中,故为push操作
+        return NO;
+    } else if ([viewControllers indexOfObject:self] == NSNotFound) { //当前视图控制器不在栈中,故为pop操作
+        return YES;
+    }
+    return NO;
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+    [super viewDidAppear:animated];
+    self.preCtrl = [self getPreViewController];
+}
 /*
 #pragma mark - Navigation
 

+ 0 - 8
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.h

@@ -8,8 +8,6 @@
 #import "KSBaseViewController.h"
 #import <WebKit/WebKit.h>
 #import "WeakWebViewScriptMessageDelegate.h"
-#import "KSWebNavView.h"
-#import "KSWebBackButton.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -17,9 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, strong) NSString *url; // webView的连接地址
 
-@property (nonatomic, assign) BOOL hiddenNavBar;  // 是否显示顶部导航栏
-
-@property (nonatomic, assign) BOOL hideTop; // 隐藏顶部包含按钮
 
 @property (nonatomic, strong) NSDictionary *parmDic; // 需要回传的参数
 
@@ -35,9 +30,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL keepOrientation;
 
-@property (nonatomic, strong) KSWebNavView *navView; // 顶部视图
-
-@property (nonatomic, strong) KSWebBackButton *webBackButton; // 返回按钮
 
 - (void)initWebView;
 

+ 82 - 97
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m

@@ -29,7 +29,7 @@
 #import "TZImageManager.h"
 #import "MusicRoomViewController.h"
 #import "KSEnterLiveroomManager.h"
-
+#import "KSWebLoadRefreshView.h"
 
 #import "UserInfoManager.h"
 typedef NS_ENUM(NSInteger, CHOOSETYPE) {
@@ -66,6 +66,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 
 @property (nonatomic, assign) BOOL isFirstLoad;
 
+@property (nonatomic, strong) KSWebLoadRefreshView *errorView;
+
 
 @end
 
@@ -83,9 +85,22 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 }
 
 - (void)captureViewTips:(NSNotification *)notification {
-    if ([UIScreen mainScreen].isCaptured) {
-        [self didCapturedView];
+    [self checkCaptured];
+}
+
+- (void)checkCaptured {
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        if ([self checkIsCaptured]) {
+            [self didCapturedView];
+        }
+    });
+}
+#pragma mark ---- 镜像和投屏检测
+- (BOOL)checkIsCaptured {
+    if ([UIScreen mainScreen].isCaptured && [UIScreen screens].count < 2) {
+        return YES;
     }
+    return NO;
 }
 
 - (void)didCapturedView {
@@ -96,17 +111,6 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     [content setValue:@"pause" forKey:@"status"];
     [sendParm setValue:content forKey:@"content"];
     [self postMessage:sendParm];
-    
-}
-
-- (void)operationDealCallbackMessage:(NSNotification *)notification {
-    NSString *status = [notification object];
-    NSMutableDictionary *sendParm = [NSMutableDictionary dictionary];
-    [sendParm setValue:@"paymentOperation" forKey:@"api"];
-    NSMutableDictionary *content = [NSMutableDictionary dictionary];
-    [content setValue:status forKey:@"status"];
-    [sendParm setValue:content forKey:@"content"];
-    [self postMessage:sendParm];
 }
 
 
@@ -117,13 +121,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     [[UIApplication sharedApplication] setIdleTimerDisabled:isOpenLight];
     // 横竖屏
     NSInteger orientation = [parmDic ks_integerValueForKey:@"orientation"];
-    
     BOOL isLandScape = orientation == 0 ? YES : NO;
-    if (_landScape != isLandScape) {
-        [self changeOrientation:isLandScape];
-    }
-    // 是否隐藏头部导航条
-    self.hideTop = [parmDic ks_boolValueForKey:@"isHideTitle"];
+    self.ks_landScape = isLandScape;
+    [self changeOrientation:isLandScape];
 }
 
 - (void)changeOrientation:(BOOL)isLandScape {
@@ -165,40 +165,29 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 
 - (void)viewWillDisappear:(BOOL)animated {
     [super viewWillDisappear:animated];
-    if (_hasChangeSource && self.keepOrientation == NO && self.landScape == YES) {
-        [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
-        [self changeOrientation:NO];
+    BOOL isBack = [self isViewPopDismiss];
+    if (isBack) {
+        if (self.preCtrl) {
+            if (self.ks_landScape != self.preCtrl.ks_landScape) {
+                [self changeOrientation:self.preCtrl.ks_landScape];
+            }
+        }
+        if (![self.preCtrl isKindOfClass:[KSBaseWKWebViewController class]]) {
+            [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
+        }
+    }
+    else {
+        KSBaseViewController *nextCtrl = [self getNextViewController];
+        if (nextCtrl) {
+            if (nextCtrl.ks_landScape != self.ks_landScape) {
+                [self changeOrientation:NO];
+            }
+        }
     }
-    self.keepOrientation = NO;
 }
 
 - (void)initWebView {
     [self.scrollView removeFromSuperview];
-    [self.view addSubview:self.navView];
-    CGFloat topHeight = kNaviBarHeight;
-    if (self.hideTop) {
-        topHeight = 0.0f;
-    }
-    [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.right.top.mas_equalTo(self.view);
-        make.height.mas_equalTo(topHeight);
-    }];
-    
-    [self.view addSubview:self.webBackButton];
-    [self.webBackButton mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.top.mas_equalTo(self.view);
-        make.height.mas_equalTo(kNaviBarHeight);
-        make.width.mas_equalTo(44);
-    }];
-    if (self.hideTop) {
-        self.webBackButton.hidden = YES;
-    }
-    if (_hiddenNavBar) {
-        topHeight = 0.0f;
-    }
-    if (self.headTitle) {
-        [self.navView.topTitleLabel setText:_headTitle];
-    }
     
     if (_myWebView == nil) {
         
@@ -229,11 +218,10 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         _myWebView.scrollView.bounces = NO;
         // 加载进度条和title
         [_myWebView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
-        [_myWebView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
         [self.view addSubview:_myWebView];
         [_myWebView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.right.mas_equalTo(self.view);
-            make.top.mas_equalTo(self.view.mas_top).offset(topHeight);
+            make.top.mas_equalTo(self.view.mas_top);
             make.bottom.mas_equalTo(self.view.mas_bottom);
         }];
         if (@available(iOS 11.0, *)) {
@@ -244,9 +232,6 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [self setupProgress];
         
         [self loadRequest];
-        
-        [self.view bringSubviewToFront:self.navView];
-        [self.view bringSubviewToFront:self.webBackButton];
     }
     else {
         [_myWebView reload];
@@ -320,6 +305,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"back"]) { // 返回
         [self.navigationController popViewControllerAnimated:YES];
     }
+    else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"goBack"]) { // 逐级返回
+        [self backAction];
+    }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"login"]) {
         // 回到登录页面
         [self backLoginView];
@@ -393,9 +381,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
             KSAccompanyWebViewController *detailCtrl = [[KSAccompanyWebViewController alloc] init];
             detailCtrl.url = [valueDic ks_stringValueForKey:@"url"];
             detailCtrl.parmDic = valueDic;
-            detailCtrl.hiddenNavBar = [valueDic ks_boolValueForKey:@"isHideTitle"];
             NSInteger orientation = [valueDic ks_integerValueForKey:@"orientation"];
             BOOL isLandScape = orientation == 0 ? YES : NO;
+            detailCtrl.ks_landScape = isLandScape;
             if (isLandScape == self.landScape) {
                 self.keepOrientation = YES;
                 detailCtrl.keepOrientation = YES;
@@ -434,6 +422,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [self postMessage:parm];
     }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"backIconChange"]) {
+        /*
         NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
         NSString *backColor = [valueDic ks_stringValueForKey:@"iconStyle"];
         NSString *backImage = @"";
@@ -447,8 +436,10 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         // 是否隐藏按钮
         BOOL hideButton = [valueDic ks_boolValueForKey:@"backIconHide"];
         self.webBackButton.hidden = hideButton;
+         */
     }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"setBarStatus"]) { // 顶部是否隐藏
+        /*
         NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
         BOOL isShow = [valueDic ks_boolValueForKey:@"status"]; // 0 隐藏 1 显示
         self.hiddenNavBar = !isShow;
@@ -460,6 +451,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
         [self.myWebView mas_updateConstraints:^(MASConstraintMaker *make) {
             make.top.mas_equalTo(self.view.mas_top).offset(navHeight);
         }];
+         */
     }
     else if ([[parm ks_stringValueForKey:@"api"] isEqualToString:@"chooseFile"]) {
         NSDictionary *valueDic = [parm ks_dictionaryValueForKey:@"content"];
@@ -731,11 +723,8 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 }
 
 - (void)openSettingView {
-    if (@available(iOS 10, *)) {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
-    } else {
-        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
-    }
+    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
+
 }
 
 - (void)displaySource:(NSURL *)localUrl {
@@ -868,6 +857,7 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
 // 6 页面加载失败时调用
 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation {
     NSLog(@"6-------页面加载失败时调用");
+    [self showErrorView];
 }
 
 // 接收到服务器跳转请求之后调用
@@ -958,12 +948,6 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
                 self.progressLayer.frame = CGRectMake(0, 0, 0, 3);
             });
         }
-    }else if ([keyPath isEqualToString:@"title"]) {
-        // 顶部title
-        self.headTitle = change[@"new"];
-        if (self.hiddenNavBar == NO) {
-            self.navView.topTitleLabel.text = self.headTitle;
-        }
     }
 }
 
@@ -1024,40 +1008,9 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     return json;
 }
 
-- (void)setHiddenNavBar:(BOOL)hiddenNavBar {
-    _hiddenNavBar = hiddenNavBar;
-    if (hiddenNavBar) {
-        self.navView.topTitleLabel.text = @"";
-    }
-    else {
-        self.navView.topTitleLabel.text = self.headTitle;
-    }
-}
-
-#pragma mark --- lazying
-- (KSWebNavView *)navView {
-    if (!_navView) {
-        _navView = [[KSWebNavView alloc] init];
-        
-    }
-    return _navView;
-}
-
-- (KSWebBackButton *)webBackButton {
-    if (!_webBackButton) {
-        _webBackButton = [[KSWebBackButton alloc] init];
-        MJWeakSelf;
-        [_webBackButton webViewBackAction:^{
-            [weakSelf backAction];
-        }];
-    }
-    return _webBackButton;
-}
-
 - (void)dealloc {
     [[_myWebView configuration].userContentController removeScriptMessageHandlerForName:@"COLEXIU"];
     [_myWebView removeObserver:self forKeyPath:@"estimatedProgress"];
-    [_myWebView removeObserver:self forKeyPath:@"title"];
     [_myWebView loadHTMLString:@"" baseURL:nil];
     [_myWebView removeFromSuperview];
     _myWebView = nil;
@@ -1340,6 +1293,38 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     return filesize;
 }
 
+- (KSWebLoadRefreshView *)errorView {
+    if (!_errorView) {
+        _errorView = [KSWebLoadRefreshView shareInstance];
+        MJWeakSelf;
+        [_errorView failViewActionCallback:^(BOOL isBack) {
+            [weakSelf hideErrorView];
+            if (isBack) {
+                [weakSelf backAction];
+            }
+            else {
+                [weakSelf loadRequest];
+            }
+        }];
+    }
+    return _errorView;
+}
+
+- (void)showErrorView {
+    if (![self.view.subviews containsObject:self.errorView]) {
+        [self.view addSubview:self.errorView];
+        [self.errorView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.right.top.bottom.mas_equalTo(self.view);
+        }];
+        [self.view bringSubviewToFront:self.errorView];
+    }
+}
+- (void)hideErrorView {
+    if ([self.view.subviews containsObject:self.errorView]) {
+        [self.errorView removeFromSuperview];
+    }
+}
+
 /*
 #pragma mark - Navigation
 

+ 25 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSWebLoadRefreshView.h

@@ -0,0 +1,25 @@
+//
+//  KSWebLoadRefreshView.h
+//  GuanYueTeamManager
+//
+//  Created by 王智 on 2023/4/20.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef void(^WebLoadFailCallback)(BOOL isBack);
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+@interface KSWebLoadRefreshView : UIView
+
+@property (nonatomic, assign) BOOL hideBackButton;
+
++ (instancetype)shareInstance;
+
+- (void)failViewActionCallback:(WebLoadFailCallback)callback;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 69 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSWebLoadRefreshView.m

@@ -0,0 +1,69 @@
+//
+//  KSWebLoadRefreshView.m
+//  GuanYueTeamManager
+//
+//  Created by 王智 on 2023/4/20.
+//
+
+#import "KSWebLoadRefreshView.h"
+
+@interface KSWebLoadRefreshView ()
+@property (weak, nonatomic) IBOutlet UIImageView *emptyImage;
+
+@property (weak, nonatomic) IBOutlet UIView *headView;
+
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *headHeight;
+
+@property (nonatomic, copy) WebLoadFailCallback callback;
+
+@property (weak, nonatomic) IBOutlet UIButton *refreshButton;
+
+@end
+
+@implementation KSWebLoadRefreshView
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    self.headHeight.constant = kNaviBarHeight;
+}
+
++ (instancetype)shareInstance {
+    KSWebLoadRefreshView *view = [[[NSBundle mainBundle] loadNibNamed:@"KSWebLoadRefreshView" owner:nil options:nil] firstObject];
+    return view;
+}
+
+- (void)failViewActionCallback:(WebLoadFailCallback)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+}
+
+- (IBAction)backAction:(id)sender {
+    if (self.callback) {
+        self.callback(YES);
+    }
+}
+
+- (IBAction)refreshView:(id)sender {
+    if (self.callback) {
+        self.callback(NO);
+    }
+}
+
+- (void)setHideBackButton:(BOOL)hideBackButton {
+    _hideBackButton = hideBackButton;
+    if (hideBackButton) {
+        self.headView.hidden = YES;
+    }
+    else {
+        self.headView.hidden = NO;
+    }
+}
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 130 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSWebLoadRefreshView.xib

@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21679"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="KSWebLoadRefreshView">
+            <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OSR-hZ-Liz">
+                    <rect key="frame" x="0.0" y="0.0" width="393" height="88"/>
+                    <subviews>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BvM-d4-lej">
+                            <rect key="frame" x="0.0" y="44" width="393" height="44"/>
+                            <subviews>
+                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="back_black" translatesAutoresizingMaskIntoConstraints="NO" id="Vlj-I7-nf3">
+                                    <rect key="frame" x="13" y="12" width="12" height="20"/>
+                                </imageView>
+                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2Lm-yn-oKc">
+                                    <rect key="frame" x="0.0" y="0.0" width="44" height="44"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="44" id="h42-sf-rrj"/>
+                                    </constraints>
+                                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                    <connections>
+                                        <action selector="backAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="x8u-o6-v4Y"/>
+                                    </connections>
+                                </button>
+                                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oMj-Xs-baj">
+                                    <rect key="frame" x="196.66666666666666" y="22" width="0.0" height="0.0"/>
+                                    <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
+                                    <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                            </subviews>
+                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstItem="oMj-Xs-baj" firstAttribute="centerY" secondItem="BvM-d4-lej" secondAttribute="centerY" id="6dH-BZ-T37"/>
+                                <constraint firstAttribute="bottom" secondItem="2Lm-yn-oKc" secondAttribute="bottom" id="CTV-aj-dsP"/>
+                                <constraint firstItem="2Lm-yn-oKc" firstAttribute="top" secondItem="BvM-d4-lej" secondAttribute="top" id="GfQ-OO-SI0"/>
+                                <constraint firstItem="2Lm-yn-oKc" firstAttribute="leading" secondItem="BvM-d4-lej" secondAttribute="leading" id="Hsb-N0-G78"/>
+                                <constraint firstItem="oMj-Xs-baj" firstAttribute="centerX" secondItem="BvM-d4-lej" secondAttribute="centerX" id="mWx-b4-F5e"/>
+                                <constraint firstItem="Vlj-I7-nf3" firstAttribute="centerY" secondItem="BvM-d4-lej" secondAttribute="centerY" id="nSO-uv-mps"/>
+                                <constraint firstItem="Vlj-I7-nf3" firstAttribute="leading" secondItem="BvM-d4-lej" secondAttribute="leading" constant="13" id="u9X-nm-DIn"/>
+                                <constraint firstAttribute="height" constant="44" id="zlR-5P-crP"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="trailing" secondItem="BvM-d4-lej" secondAttribute="trailing" id="9D8-Q6-nCV"/>
+                        <constraint firstItem="BvM-d4-lej" firstAttribute="leading" secondItem="OSR-hZ-Liz" secondAttribute="leading" id="Laz-Y9-rLX"/>
+                        <constraint firstAttribute="bottom" secondItem="BvM-d4-lej" secondAttribute="bottom" id="lsM-TO-THM"/>
+                        <constraint firstAttribute="height" constant="88" id="maT-MN-XB2"/>
+                    </constraints>
+                </view>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="no_networking" translatesAutoresizingMaskIntoConstraints="NO" id="MwE-bt-1NJ">
+                    <rect key="frame" x="66.666666666666686" y="110" width="260" height="230"/>
+                </imageView>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hbq-IV-sqV">
+                    <rect key="frame" x="146.66666666666666" y="405" width="100" height="36"/>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="36" id="Iwp-ts-m13"/>
+                        <constraint firstAttribute="width" constant="100" id="L8i-QD-eeX"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="刷新一下">
+                        <color key="titleColor" red="0.1764705882352941" green="0.7803921568627451" blue="0.66666666666666663" alpha="1" colorSpace="calibratedRGB"/>
+                    </state>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="18"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="1"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                            <color key="value" red="0.1764705882352941" green="0.7803921568627451" blue="0.66666666666666663" alpha="1" colorSpace="calibratedRGB"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                    <connections>
+                        <action selector="refreshView:" destination="iN0-l3-epB" eventType="touchUpInside" id="5ge-EF-AvS"/>
+                    </connections>
+                </button>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="网络开小差,再刷新看看" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nlm-k3-ipo">
+                    <rect key="frame" x="106.66666666666669" y="361" width="180" height="22"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="22" id="4Ui-T9-ge2"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                    <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+            </subviews>
+            <color key="backgroundColor" red="0.97254901960784312" green="0.97254901960784312" blue="0.97254901960784312" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstItem="OSR-hZ-Liz" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="07x-EN-DkY"/>
+                <constraint firstItem="Nlm-k3-ipo" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="D66-0o-b6d"/>
+                <constraint firstAttribute="trailing" secondItem="OSR-hZ-Liz" secondAttribute="trailing" id="NFk-om-8aq"/>
+                <constraint firstItem="hbq-IV-sqV" firstAttribute="top" secondItem="Nlm-k3-ipo" secondAttribute="bottom" constant="22" id="f79-6b-Lmd"/>
+                <constraint firstItem="MwE-bt-1NJ" firstAttribute="top" secondItem="OSR-hZ-Liz" secondAttribute="bottom" constant="22" id="gXT-i9-Jdn"/>
+                <constraint firstItem="MwE-bt-1NJ" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="hAC-pb-S9s"/>
+                <constraint firstItem="Nlm-k3-ipo" firstAttribute="top" secondItem="MwE-bt-1NJ" secondAttribute="bottom" constant="21" id="r0L-CI-jCe"/>
+                <constraint firstItem="hbq-IV-sqV" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="w6P-Go-JVZ"/>
+                <constraint firstItem="OSR-hZ-Liz" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="y4K-tF-9kB"/>
+            </constraints>
+            <nil key="simulatedTopBarMetrics"/>
+            <nil key="simulatedBottomBarMetrics"/>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="headHeight" destination="maT-MN-XB2" id="Em4-5f-BCc"/>
+                <outlet property="headView" destination="OSR-hZ-Liz" id="tG6-Qc-ubI"/>
+                <outlet property="refreshButton" destination="hbq-IV-sqV" id="IKF-N8-joE"/>
+            </connections>
+            <point key="canvasLocation" x="79" y="-12"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="back_black" width="12" height="20"/>
+        <image name="no_networking" width="260" height="230"/>
+    </resources>
+</document>

+ 19 - 18
KulexiuForTeacher/KulexiuForTeacher/Common/Define/KSDomain.h

@@ -12,15 +12,16 @@
 
 //#ifdef DEBUG
 // 测试环境
-//#define hostURL (@"https://dev.colexiu.com")
-//#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
-//#define WEBHOST (@"https://dev.colexiu.com/teacher")
-//#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
-//#define JSPUSH_ENVIRONMENT (NO)
-//#define RCIM_KEY (@"0vnjpoad0jbdz")
-//#define SUBMIT_UUID (NO)
-//#define CONFIG_TXSDKAPPID (1400805079)
-//#define TXOfflinePushCertificateIDForAPNS (39559)
+#define hostURL (@"https://dev.colexiu.com")
+#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
+#define WEBHOST (@"https://dev.colexiu.com/teacher")
+//#define WEBHOST (@"http://192.168.3.220:5000/teacher.html")
+#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
+#define JSPUSH_ENVIRONMENT (NO)
+#define RCIM_KEY (@"0vnjpoad0jbdz")
+#define SUBMIT_UUID (NO)
+#define CONFIG_TXSDKAPPID (1400805079)
+#define TXOfflinePushCertificateIDForAPNS (39559)
 
 // 开发环境
 //#define hostURL (@"https://test.colexiu.com")
@@ -46,15 +47,15 @@
 
 //#else
 
-#define hostURL (@"https://online.colexiu.com")
-#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
-#define WEBHOST (@"https://online.colexiu.com/teacher")
-#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
-#define JSPUSH_ENVIRONMENT (YES)
-#define RCIM_KEY (@"e5t4ouvpe42pa")
-#define SUBMIT_UUID (YES)
-#define CONFIG_TXSDKAPPID (1400799837)
-#define TXOfflinePushCertificateIDForAPNS (39561)
+//#define hostURL (@"https://online.colexiu.com")
+//#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
+//#define WEBHOST (@"https://online.colexiu.com/teacher")
+//#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
+//#define JSPUSH_ENVIRONMENT (YES)
+//#define RCIM_KEY (@"e5t4ouvpe42pa")
+//#define SUBMIT_UUID (YES)
+//#define CONFIG_TXSDKAPPID (1400799837)
+//#define TXOfflinePushCertificateIDForAPNS (39561)
 
 
 //#endif

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Define/PrefixHeader.pch

@@ -38,6 +38,8 @@
 #import "KSLoginManager.h"
 #import "KSHudLoagingManager.h"
 
+#import "UIViewController+KSExtension.h"
+
 #define FIRST_LOGIN_KEY (@"FirstLoginKey")
 
 

+ 19 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Category/UIViewController+KSExtension.h

@@ -0,0 +1,19 @@
+//
+//  UIViewController+KSExtension.h
+//  GuanYueTeamManager
+//
+//  Created by 王智 on 2023/3/1.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface UIViewController (KSExtension)
+
+// 是否横屏
+@property (nonatomic, assign) BOOL ks_landScape;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 24 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/Category/UIViewController+KSExtension.m

@@ -0,0 +1,24 @@
+//
+//  UIViewController+KSExtension.m
+//  GuanYueTeamManager
+//
+//  Created by 王智 on 2023/3/1.
+//
+
+#import "UIViewController+KSExtension.h"
+#import <objc/runtime.h>
+
+static const char kLandScapeKey;
+
+@implementation UIViewController (KSExtension)
+
+- (BOOL)ks_landScape {
+    BOOL landScape = objc_getAssociatedObject(self, &kLandScapeKey);
+    return landScape;
+}
+
+- (void)setKs_landScape:(BOOL)ks_landScape {
+    objc_setAssociatedObject(self, &kLandScapeKey, @(ks_landScape), OBJC_ASSOCIATION_ASSIGN);
+}
+
+@end

+ 0 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Controller/TXCustom/KSTXBaseChatViewController.m

@@ -185,7 +185,6 @@ static UIView *gCustomTopView;
 - (void)showMusic:(NSString *)songId {
     KSAccompanyWebViewController *detailCtrl = [[KSAccompanyWebViewController alloc] init];
     detailCtrl.url = [NSString stringWithFormat:@"%@/accompany?id=%@",hostURL, songId];
-    detailCtrl.hiddenNavBar = YES;
     detailCtrl.parmDic = @{@"isOpenLight" : @(YES), @"orientation" : @(0),@"isHideTitle" : @(YES)};
     [self.navigationController pushViewController:detailCtrl animated:YES];
 }

+ 0 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mall/Controller/ShopMallViewController.m

@@ -24,7 +24,6 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    self.webBackButton.hidden = YES;
 }