|
@@ -15,12 +15,14 @@
|
|
|
{
|
|
|
CGPoint startTouch;
|
|
|
BOOL _isMoving;
|
|
|
+ BOOL isExistNoNewWork;
|
|
|
}
|
|
|
|
|
|
@property (nonatomic, strong) UIProgressView *progressView;
|
|
|
@property (nonatomic, strong) WKWebView *webView;
|
|
|
@property(nonatomic, assign)BOOL updateNotify;
|
|
|
@property(nonatomic, strong)NoNetView *noNetView;
|
|
|
+@property(nonatomic, strong)NoNetView *failNetView;
|
|
|
@property(nonatomic, strong)ZKClipboardView *clipboardView;
|
|
|
@property(nonatomic, strong)ZKFaceVerifyMsgView *verifyMsgView;
|
|
|
@property(nonatomic, strong)UIPanGestureRecognizer *recognizer;
|
|
@@ -183,6 +185,9 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateNotifyState) name:kUpdateNotifyState object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(afterReceiveNewMsg) name:kAfterReceiveNewMsg object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadWebView) name:kReloadWebVIew object:nil];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(popWebView) name:PopWebView object:nil];
|
|
|
+
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginOut:) name:kLoginOut object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netReachChanged:) name:AFNetworkingReachabilityDidChangeNotification object:nil];
|
|
|
|
|
@@ -495,6 +500,18 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
// 页面加载失败时调用
|
|
|
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(nonnull NSError *)error{
|
|
|
+
|
|
|
+ //加载失败 有网络-弹出页面 , 无网络-记录标记
|
|
|
+ if ([ZKMethod judegeNetworkIsAvailable]) {
|
|
|
+ //弹出页面
|
|
|
+ NSLog(@"页面加载失败-有网络");
|
|
|
+ [self addFailNetViews];
|
|
|
+ }else {
|
|
|
+ //记录标记
|
|
|
+ NSLog(@"页面加载失败-无网络");
|
|
|
+ isExistNoNewWork = YES;
|
|
|
+ }
|
|
|
+
|
|
|
self.recognizer.enabled = YES;
|
|
|
[[GlobalData shareInstance] addOnePlistData:@{
|
|
|
@"detail":[[self stringByEvaluatingJavaScriptFromString:@"document.location.href"] stringByAppendingString:[NSString stringWithFormat:@"\n%@",[error description]]],
|
|
@@ -1072,10 +1089,6 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
[[SKPaymentQueue defaultQueue] addPayment:payment];
|
|
|
}
|
|
|
|
|
|
-// web是否可退回上页面
|
|
|
--(int)jsIsCanBack:(NSString *)str{
|
|
|
- return self.webView.canGoBack ? 1:0;
|
|
|
-}
|
|
|
|
|
|
#pragma mark *****其他方法
|
|
|
-(void)judgeIsHiddenBottom {
|
|
@@ -1359,7 +1372,27 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+-(void)addFailNetViews{
|
|
|
+ kMainQueue(^{
|
|
|
+ [self removeFailNetViews];
|
|
|
+ self.failNetView = [NoNetView shareView];
|
|
|
+ if(self.tabBarController.selectedIndex == 0) {
|
|
|
+ if ([self.webView canGoBack]) {
|
|
|
+ self.failNetView.popBtn.hidden = NO;
|
|
|
+ }else{
|
|
|
+ self.failNetView.popBtn.hidden = YES;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [self.view addSubview:self.failNetView];
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
+-(void)removeFailNetViews{
|
|
|
+ if (self.failNetView ) {
|
|
|
+ [self.failNetView removeFromSuperview];
|
|
|
+ self.failNetView = nil;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -1460,8 +1493,7 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
// 再次加载页面
|
|
|
-(void)reloadWebView{
|
|
|
if(self.tabBarController.selectedIndex == 2) {
|
|
|
- [[LXViewControllerManager shareViewControllerManager] showHudText:nil];
|
|
|
- if (!self.webView.canGoBack) {
|
|
|
+ if (![self.webView canGoBack]) {
|
|
|
[self webViewFirstRequest];
|
|
|
}else{
|
|
|
[self.webView reload];
|
|
@@ -1469,6 +1501,19 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+// 返回上一页面- 防止
|
|
|
+-(void)popWebView{
|
|
|
+ if(self.tabBarController.selectedIndex == 2) {
|
|
|
+ if ([self.webView canGoBack]) {
|
|
|
+ [self.webView goBack];
|
|
|
+ }
|
|
|
+ [self removeNoNetViews];
|
|
|
+ [self removeFailNetViews];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// 收到退出登录消息
|
|
|
-(void)loginOut:(NSNotification *)notification{
|
|
|
if([notification.userInfo[@"item_index"] integerValue]!=2) {
|
|
@@ -1491,6 +1536,10 @@ NSString *const new_AesKey_3 = @"mGlAgnIBB8bx2nch";
|
|
|
[self addNoNetViews];
|
|
|
}else{
|
|
|
[self removeNoNetViews];
|
|
|
+ if (isExistNoNewWork) {
|
|
|
+ isExistNoNewWork = NO;
|
|
|
+ [self reloadWebView];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|