Explorar el Código

修改加载不同网址的url 底部栏是否隐藏判断

apple hace 6 años
padre
commit
b57f87ecef

BIN
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate


+ 2 - 1
ios/JianYuIOS/JianYuIOS/BaseClass1/PrefixHeader.pch

@@ -99,7 +99,8 @@ _Pragma("clang diagnostic pop")\
 //#define kHost @"http://weblxl.qmx.top/" //小璐
 //#define kHost @"http://webws.qmx.top/" //王山
 //#define kHost @"http://webwcj.qmx.top/"//王传近
-#define kHost @"http://w2blmjy.qmx.top/"//测试环境
+//#define kHost @"http://w2blmjy.qmx.top/"//测试环境
+#define kHost @"http://w4blmjy.qmx.top/"//测试环境2
 //#define kHost @"123.56.103.12/"
 
 

+ 31 - 4
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYExpViewController.m

@@ -52,7 +52,7 @@ JSExportAs(checkLab, -(void)jsCheckLab:(NSString*)str);
     CGPoint startTouch;
     BOOL _isMoving;
     
-    
+    BOOL searchRefreshBool;
 }
 
 
@@ -104,6 +104,10 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
     
     [self clearWeb];
     
+    
+    
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshAllVC:) name:@"refreshAllVC" object:nil];
+    
 }
 
 -(void)moveViewWithX:(float)x
@@ -210,8 +214,13 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 //    if (token) {
 //        url = [url stringByAppendingString:[NSString stringWithFormat:@"?sign=%@&url=/jyapp/jylab/mainSearch&from=restart", token]];
 //    }
+    
+    NSLog(@"333第一次加载%@",url);
+    
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
-    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    kMainQueue(^{
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    })
     
 }
 
@@ -342,10 +351,14 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 -(void)judgeIsHidden
 {
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]){
+    //http://w4blmjy.qmx.top/jyapp/free/login?back=index
+    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]
+       ||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
+        NSLog(@"展示");
         [self showTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
     }else {
+        NSLog(@"隐藏");
         [self hideTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT+STATUS_BAR_HEIGHT);
     }
@@ -356,7 +369,14 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 //捕获js中调用的方法
 - (void)webViewDidFinishLoad:(UIWebView *)webView{
     
-    [self judgeIsHidden];
+    
+    if(searchRefreshBool) {
+        searchRefreshBool = NO;
+    }else {
+        //正常的网页加载
+        [self judgeIsHidden];//是否隐藏
+    }
+
     
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
@@ -824,6 +844,13 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 }
 
 
+//首页登录通知刷新页面
+-(void)refreshAllVC:(NSNotification *)notificaition{
+    searchRefreshBool = YES;
+    [self webViewFirstRequest];
+}
+
+
 /*
  #pragma mark - Navigation
  

+ 34 - 4
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYMineViewController.m

@@ -55,7 +55,7 @@ JSExportAs(backUrl, -(void)jsBackUrl:(NSString*)str);
     CGPoint startTouch;
     BOOL _isMoving;
     
-    
+    BOOL searchRefreshBool;
 }
 
 
@@ -106,6 +106,7 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
    
     
     
+    
     [[AFNetworkReachabilityManager sharedManager] startMonitoring];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netReachChanged:) name:AFNetworkingReachabilityDidChangeNotification object:nil];
     
@@ -119,6 +120,9 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
     
     
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshAllVC:) name:@"refreshAllVC" object:nil];
+    
+    
 }
 
 -(void)moveViewWithX:(float)x
@@ -225,8 +229,14 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 //    if (token) {
 //        url = [url stringByAppendingString:[NSString stringWithFormat:@"?sign=%@&url=/jyapp/jylab/mainSearch&from=restart", token]];
 //    }
+    NSLog(@"444第一次加载%@",url);
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
-    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    
+    
+    
+    kMainQueue(^{
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    })
     
 }
 
@@ -361,10 +371,12 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 -(void)judgeIsHidden
 {
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]){
+    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]||[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]){
+        NSLog(@"展示");
         [self showTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
     }else {
+        NSLog(@"隐藏");
         [self hideTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT+STATUS_BAR_HEIGHT);
     }
@@ -375,7 +387,15 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 //捕获js中调用的方法
 - (void)webViewDidFinishLoad:(UIWebView *)webView{
     
-    [self judgeIsHidden];
+
+    
+    if(searchRefreshBool) {
+        searchRefreshBool = NO;
+    }else {
+        //正常的网页加载
+        [self judgeIsHidden];//是否隐藏
+    }
+
     
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
@@ -885,6 +905,16 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 
 
+
+
+//首页登录通知刷新页面
+-(void)refreshAllVC:(NSNotification *)notificaition{
+    searchRefreshBool = YES;
+    [self webViewFirstRequest];
+}
+
+
+
 /*
  #pragma mark - Navigation
  

+ 41 - 8
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYSearchViewController.m

@@ -68,6 +68,9 @@ JSExportAs(redirectKeyset, -(void)jsRedirectKeyset:(NSString*)str);
     NSInteger _time;
     
     BOOL autologin;
+    BOOL notiFinish;
+    
+    BOOL expRefreshBool; //实验室 是否刷新
 }
 
 
@@ -141,7 +144,6 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     
     
     //新增刷新通知
-    
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshSS:) name:@"refreshSS" object:nil];
     
    
@@ -149,10 +151,12 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     
     
 }
+
+//2.5.1
 -(void)timeFireMethod{
     _timeTick++;
     NSLog(@"定时器");
-    if(self.webView) {
+    if(self.webView&&notiFinish) {
         NSString * urlStr = [NSString stringWithFormat:@"%@",self.notiDict[@"url"]];
         
         if (urlStr) {
@@ -289,8 +293,14 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     if (token) {
         url = [url stringByAppendingString:[NSString stringWithFormat:@"?sign=%@&url=/jyapp/jylab/mainSearch&from=restart", token]];
     }
+    NSLog(@"111第一次加载%@",url);
+    
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
-    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    
+    kMainQueue(^{
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    })
+    
     
 }
 
@@ -441,10 +451,6 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
                 tab.selectedIndex = pushIndex;
                 pushIndex = 0;
             }));
-            
-            
-            
-           
         }else {
             [self webViewFirstRequest];
         }
@@ -455,6 +461,15 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 //        NSString *index = [NSString stringWithFormat:@"%ld",pushIndex];
 //        [[NSNotificationCenter defaultCenter] postNotificationName:@"changeItems" object:nil userInfo:@{@"item_index":index}];
 //        pushIndex = 0;
+        
+        //刷新 订阅 和 我的
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"refreshAllVC" object:nil userInfo:nil];
+        
+        
+        
+        
+        //首页跳转登录刷新 我们+订阅
+        
     }else {
         
     }
@@ -530,10 +545,14 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 -(void)judgeIsHidden
 {
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+    
+    //[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/index",kHost]]
     if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
+        NSLog(@"展示");
         [self showTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
     }else {
+        NSLog(@"隐藏");
         [self hideTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT+STATUS_BAR_HEIGHT);
     }
@@ -544,7 +563,19 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 //捕获js中调用的方法
 - (void)webViewDidFinishLoad:(UIWebView *)webView{
     
-    [self judgeIsHidden];//是否隐藏
+    if(!notiFinish) {
+        notiFinish = YES;
+    }
+    
+    if(expRefreshBool) {
+        expRefreshBool = NO;
+    }else {
+        //正常的网页加载
+        [self judgeIsHidden];//是否隐藏
+    }
+   
+    
+    
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
     JSContext *context = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
@@ -1036,6 +1067,8 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 
 //通知刷新页面
 -(void)refreshSS:(NSNotification *)notificaition{
+    
+    expRefreshBool = YES;
     [self webViewFirstRequest];
 }
 

+ 25 - 5
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYSubViewController.m

@@ -47,7 +47,7 @@ JSExportAs(business, -(NSInteger)jsBusiness:(NSInteger)shooID shopType:(NSIntege
     CGPoint startTouch;
     BOOL _isMoving;
     
-    
+    BOOL searchRefreshBool;
 }
 
 
@@ -103,6 +103,8 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshDY:) name:@"refreshDY" object:nil];
     
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshAllVC:) name:@"refreshAllVC" object:nil];
+    
 }
 
 -(void)moveViewWithX:(float)x
@@ -207,8 +209,11 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
     
     NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/wxkeyset/keyset/index"];
 
+    NSLog(@"222第一次加载%@",url);
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
-    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    kMainQueue(^{
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    })
     
 }
 
@@ -341,10 +346,13 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 -(void)judgeIsHidden
 {   
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
-    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/wxkeyset/keyset/index",kHost]]){
+    //http://w4blmjy.qmx.top/jyapp/free/login?back=index
+    if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/wxkeyset/keyset/index",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
+        NSLog(@"展示");
         [self showTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
     }else {
+        NSLog(@"隐藏");
         [self hideTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT+STATUS_BAR_HEIGHT);
     }
@@ -355,9 +363,15 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 //捕获js中调用的方法
 - (void)webViewDidFinishLoad:(UIWebView *)webView{
     
-    [self judgeIsHidden];
-    
+
     
+    if(searchRefreshBool) {
+        searchRefreshBool = NO;
+    }else {
+        //正常的网页加载
+        [self judgeIsHidden];//是否隐藏
+    }
+
     
     [self removeNoNetViews];
     [[LXViewControllerManager shareViewControllerManager] hideHud];
@@ -803,6 +817,12 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
     [self webViewFirstRequest];
 }
 
+//首页登录通知刷新页面
+-(void)refreshAllVC:(NSNotification *)notificaition{
+    searchRefreshBool = YES;
+    [self webViewFirstRequest];
+}
+
 
 /*
  #pragma mark - Navigation

+ 1 - 0
ios/JianYuIOS/JianYuIOS/ViewController.m

@@ -385,6 +385,7 @@ NSString *const AesKey = @"mGlAgnIBB8bx2nch";
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     
     if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/wxkeyset/keyset/index",kHost]]||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
+        
         [self showTabBar];
         self.webView.frame = CGRectMake(0, -STATUS_BAR_HEIGHT, WIDTH, HEIGHT-TAB_BAR_HEIGHT+STATUS_BAR_HEIGHT);
     }else {