Bladeren bron

用户被顶底部栏问题

apple 6 jaren geleden
bovenliggende
commit
dc38f2e84a

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


+ 0 - 18
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,22 +2,4 @@
 <Bucket
    type = "0"
    version = "2.0">
-   <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "JianYuIOS/Classes&#xff08;&#x6a21;&#x5757;&#xff09;/JYSearchViewController.m"
-            timestampString = "564465354.005654"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "466"
-            endingLineNumber = "466"
-            landmarkName = "-jsLoginSuccess:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-   </Breakpoints>
 </Bucket>

+ 11 - 1
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -411,7 +411,17 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
 //    NSDictionary *extras = [userInfo valueForKey:@"extras"];
 //    NSString *customizeField1 = [extras valueForKey:@"customizeField1"]; //服务端传递的Extras附加字段,key是自己定
     if ([LXUserDefaults token] && userInfo[@"content_type"] && [userInfo[@"content_type"] isEqualToString:@"signOut"]) {
-        [[NSNotificationCenter defaultCenter] postNotificationName:kLoginOut object:content];
+        
+        
+        AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+        JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
+        NSLog(@"%lu",(unsigned long)tab.selectedIndex);
+        
+        //判断第几个底部栏
+        [[NSNotificationCenter defaultCenter] postNotificationName:kLoginOut object:content userInfo:@{@"item_index":[NSString stringWithFormat:@"%lu",(unsigned long)tab.selectedIndex]}];
+        
+        
+        //
     }
 }
 

+ 58 - 6
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYExpViewController.m

@@ -7,6 +7,8 @@
 //
 
 #import "JYExpViewController.h"
+#import "JYTabBarController.h"
+
 
 @protocol JYExpViewControllerJSExport<JSExport>
 
@@ -44,6 +46,11 @@ JSExportAs(hiddenBottom, -(void)jsHiddenBottom:(NSString*)hidden);
 JSExportAs(checkLab, -(void)jsCheckLab:(NSString*)str);
 
 
+
+JSExportAs(loginSuccess, -(void)jsLoginSuccess:(NSString*)status);
+
+JSExportAs(backUrl, -(void)jsBackUrl:(NSString*)str);
+
 @end
 
 
@@ -226,7 +233,8 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 //收到消息退出并重新加载web
 -(void)webViewRequestByMsg{
-    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+//    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login?back=index&isios=t"];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
 }
@@ -288,6 +296,9 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 
 // 收到退出登录消息
 -(void)loginOut:(NSNotification *)notification{
+    if([notification.userInfo[@"item_index"] integerValue]!=2) {
+        return;
+    }
     self.signOutContent = notification.object;
     if (!self.signOutContent) {
         self.signOutContent = @"1";
@@ -295,12 +306,12 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
     NSString *url = [NSString stringWithFormat:@"%@%@?sign=%@", kHost, @"jyapp/free/signOut", [LXUserDefaults token]];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     
-    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
-    webView.delegate = self;
-    [self.view addSubview:webView];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
+//    webView.delegate = self;
+//    [self.view addSubview:webView];
+//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     
-    //    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     [self jsRemoveUserToken:nil];
 }
 
@@ -352,6 +363,7 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 {
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     //http://w4blmjy.qmx.top/jyapp/free/login?back=index
+    NSLog(@"%@",current_url);
     if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/index",kHost]]
        ||[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/login?back=index",kHost]]){
         NSLog(@"展示");
@@ -851,6 +863,46 @@ NSString *const AesKey_2 = @"mGlAgnIBB8bx2nch";
 }
 
 
+
+-(void)jsBackUrl:(NSString*)str
+{
+    NSLog(@"Mine返回首页%@",str);
+    if([str isEqualToString:@"H"]) {
+        //测试返回首页
+        kMainQueue(^{
+            AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+            JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
+            tab.selectedIndex = 0;
+            
+            [[NSNotificationCenter defaultCenter] postNotificationName:@"changeItems" object:nil userInfo:@{@"item_index":@"0"}];
+            
+            [self dealTabBar];
+        });
+        
+    }
+    
+    
+}
+
+
+
+-(void)jsLoginSuccess:(NSString*)status
+{
+    NSLog(@"Mine登录成功提示");
+    if([status isEqualToString:@"S"]) {
+        kMainQueue(^{
+            AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+            JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
+            tab.selectedIndex = 0;
+            
+            [[NSNotificationCenter defaultCenter] postNotificationName:@"changeItems" object:nil userInfo:@{@"item_index":@"5"}];
+        });
+    }else {
+        
+    }
+}
+
+
 /*
  #pragma mark - Navigation
  

+ 12 - 6
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYMineViewController.m

@@ -242,7 +242,8 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 //收到消息退出并重新加载web
 -(void)webViewRequestByMsg{
-    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+//    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login?back=index&isios=t"];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
 }
@@ -308,17 +309,21 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 
 // 收到退出登录消息
 -(void)loginOut:(NSNotification *)notification{
+    if([notification.userInfo[@"item_index"] integerValue]!=3) {
+        return;
+    }
+    
     self.signOutContent = notification.object;
     if (!self.signOutContent) {
         self.signOutContent = @"1";
     }
     NSString *url = [NSString stringWithFormat:@"%@%@?sign=%@", kHost, @"jyapp/free/signOut", [LXUserDefaults token]];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
-    
-    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
-    webView.delegate = self;
-    [self.view addSubview:webView];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
+//    webView.delegate = self;
+//    [self.view addSubview:webView];
+//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     
     //    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     [self jsRemoveUserToken:nil];
@@ -371,6 +376,7 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
 -(void)judgeIsHidden
 {
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
+    NSLog(@"%@",current_url);
     if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/me",kHost]]){
         NSLog(@"展示");
         [self showTabBar];

+ 28 - 10
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYSearchViewController.m

@@ -306,7 +306,9 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 
 //收到消息退出并重新加载web
 -(void)webViewRequestByMsg{
-    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+//    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login?back=index&isios=t"];
+    
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
 }
@@ -372,6 +374,10 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 
 // 收到退出登录消息
 -(void)loginOut:(NSNotification *)notification{
+    if([notification.userInfo[@"item_index"] integerValue]!=0) {
+        return;
+    }
+    
     self.signOutContent = notification.object;
     if (!self.signOutContent) {
         self.signOutContent = @"1";
@@ -379,12 +385,12 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     NSString *url = [NSString stringWithFormat:@"%@%@?sign=%@", kHost, @"jyapp/free/signOut", [LXUserDefaults token]];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     
-    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
-    webView.delegate = self;
-    [self.view addSubview:webView];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
+//    webView.delegate = self;
+//    [self.view addSubview:webView];
+//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     
-    //    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     [self jsRemoveUserToken:nil];
 }
 
@@ -547,6 +553,7 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     
     //[current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/free/index",kHost]]
+    NSLog(@"%@",current_url);
     if([current_url isEqualToString:[NSString stringWithFormat:@"%@jyapp/jylab/mainSearch",kHost]]){
         NSLog(@"展示");
         [self showTabBar];
@@ -601,11 +608,22 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
     
     
     //加载第一次成功的时候 调JS
-    if(!autologin&&[LXUserDefaults token]) {
+//    if(!autologin&&[LXUserDefaults token]) {
+//        autologin = YES;
+//        NSString *textJS =  [NSString stringWithFormat:@"refAutoLogin('%@')",@"S"];
+//        JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
+//        [context evaluateScript:textJS];
+//    }
+    
+    if(!autologin) {
+        //第一次加载页面成功
+        if([LXUserDefaults token]) {
+            //如果登录
+            NSString *textJS =  [NSString stringWithFormat:@"refAutoLogin('%@')",@"S"];
+            JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
+            [context evaluateScript:textJS];
+        }
         autologin = YES;
-        NSString *textJS =  [NSString stringWithFormat:@"refAutoLogin('%@')",@"S"];
-        JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
-        [context evaluateScript:textJS];
     }
     
 }

+ 58 - 7
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYSubViewController.m

@@ -7,6 +7,7 @@
 //
 
 #import "JYSubViewController.h"
+#import "JYTabBarController.h"
 
 @protocol JYSubViewControllerJSExport<JSExport>
 
@@ -36,7 +37,9 @@ JSExportAs(getCipherText, -(NSString *)jsGGetCipherText:(NSString *)phone);
 
 JSExportAs(business, -(NSInteger)jsBusiness:(NSInteger)shooID shopType:(NSInteger )shopType);
 
+JSExportAs(loginSuccess, -(void)jsLoginSuccess:(NSString*)status);
 
+JSExportAs(backUrl, -(void)jsBackUrl:(NSString*)str);
 
 
 @end
@@ -219,7 +222,8 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 
 //收到消息退出并重新加载web
 -(void)webViewRequestByMsg{
-    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+//    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/kicked"];
+    NSString *url = [NSString stringWithFormat:@"%@%@", kHost, @"jyapp/free/login?back=index&isios=t"];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
 }
@@ -281,19 +285,25 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 
 // 收到退出登录消息
 -(void)loginOut:(NSNotification *)notification{
+    if([notification.userInfo[@"item_index"] integerValue]!=1) {
+        return;
+    }
+    
     self.signOutContent = notification.object;
     if (!self.signOutContent) {
         self.signOutContent = @"1";
     }
+    
+    
     NSString *url = [NSString stringWithFormat:@"%@%@?sign=%@", kHost, @"jyapp/free/signOut", [LXUserDefaults token]];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     
-    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
-    webView.delegate = self;
-    [self.view addSubview:webView];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
-    
-    //    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
+//    webView.delegate = self;
+//    [self.view addSubview:webView];
+//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     [self jsRemoveUserToken:nil];
 }
 
@@ -347,6 +357,7 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 {   
     NSString *current_url = [self.webView stringByEvaluatingJavaScriptFromString:@"document.location.href"];
     //http://w4blmjy.qmx.top/jyapp/free/login?back=index
+    NSLog(@"%@",current_url);
     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];
@@ -824,6 +835,46 @@ NSString *const AesKey_1 = @"mGlAgnIBB8bx2nch";
 }
 
 
+
+-(void)jsBackUrl:(NSString*)str
+{
+    NSLog(@"Mine返回首页%@",str);
+    if([str isEqualToString:@"H"]) {
+        //测试返回首页
+        kMainQueue(^{
+            AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+            JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
+            tab.selectedIndex = 0;
+            
+            [[NSNotificationCenter defaultCenter] postNotificationName:@"changeItems" object:nil userInfo:@{@"item_index":@"0"}];
+            
+            [self dealTabBar];
+        });
+        
+    }
+    
+    
+}
+
+
+
+-(void)jsLoginSuccess:(NSString*)status
+{
+    NSLog(@"Mine登录成功提示");
+    if([status isEqualToString:@"S"]) {
+        kMainQueue(^{
+            AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+            JYTabBarController *tab = (JYTabBarController *)delegate.window.rootViewController;
+            tab.selectedIndex = 0;
+            
+            [[NSNotificationCenter defaultCenter] postNotificationName:@"changeItems" object:nil userInfo:@{@"item_index":@"5"}];
+        });
+    }else {
+        
+    }
+}
+
+
 /*
  #pragma mark - Navigation
  

+ 5 - 4
ios/JianYuIOS/JianYuIOS/ViewController.m

@@ -323,10 +323,11 @@ NSString *const AesKey = @"mGlAgnIBB8bx2nch";
     NSString *url = [NSString stringWithFormat:@"%@%@?sign=%@", kHost, @"jyapp/free/signOut", [LXUserDefaults token]];
     url =  [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
     
-    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
-    webView.delegate = self;
-    [self.view addSubview:webView];
-    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
+//    UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
+//    webView.delegate = self;
+//    [self.view addSubview:webView];
+//    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     
     //    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
     [self jsRemoveUserToken:nil];