Forráskód Böngészése

1.加载登录数据

time 6 éve
szülő
commit
70b1a92762

+ 22 - 14
UU_Ent/UU_Ent/Modules/App/AppDelegate.m

@@ -50,29 +50,37 @@
             
         } failure:^(NSString * _Nonnull errorStr) {
             //自动登录失败
-            [YRAlertView showWithTitle:nil content:errorStr sureTitle:nil cancelTitle:nil click:^(NSInteger index) {
-               
-                YRLoginVC *loginVC = [[YRLoginVC alloc]init];
-                
-                loginVC.completed = ^(BOOL success) {
+            [YRAlertView showWithTitle:@"UU互联" content:errorStr sureTitle:@"确定" cancelTitle:@"" click:^(NSInteger index) {
+
+                [UIView animateWithDuration:0.3f animations:^{
+                   
+                    YRLoginVC *loginVC = [[YRLoginVC alloc]init];
                     
-                    YRMainVC *mainVC = [[YRMainVC alloc]init];
+                    self.window.rootViewController = loginVC;
                     
-                    [UIView animateWithDuration:0.3f animations:^{
+                    loginVC.completed = ^(BOOL success) {
                         
-                        self.window.rootViewController = mainVC;
+                        YRMainVC *mainVC = [[YRMainVC alloc]init];
                         
-                    }];
-                    
+                        [UIView animateWithDuration:0.3f animations:^{
+                            
+                            self.window.rootViewController = mainVC;
+                            
+                        }];
+                        
+                        
+                    };
                     
-                };
-                
-                self.window.rootViewController = loginVC;
-                
+                }];
+
+
             }];
             
+           
+            
         }];
         
+        
     }else{
     
     YRLoginVC *loginVC = [[YRLoginVC alloc]init];

+ 0 - 1
UU_Ent/UU_Ent/Modules/Login/Main/Others/YRLoginManager.h

@@ -15,7 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 /**
  自动登录
-
  */
 +(void)autoLoginsuccess:(void(^)(void))success failure:(void(^)(NSString *errorStr))failure;
 

+ 0 - 6
UU_Ent/UU_Ent/Modules/Main/Main/Controllers/YRMainVC.m

@@ -43,12 +43,6 @@
     
     self.tabBar.tintColor = HexColor(@"#1084D1");
     
-    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-        
-        [tarBar showBadgeOnItemIndex:1];
-        [tarBar showBadgeOnItemIndex:2];
-        
-    });
 }
 
 

+ 2 - 0
UU_Ent/UU_Ent/Modules/Main/Main/Views/YRTabBar.m

@@ -115,6 +115,8 @@
 
 -(void)setRemindCount:(NSInteger)remindCount{
     
+    _remindCount = remindCount;
+    
     if (remindCount > 0) {
         
          self.labArr[0].hidden = NO;

+ 44 - 7
UU_Ent/UU_Ent/Modules/Message/Main/Controllers/YRMsgVC.m

@@ -26,19 +26,14 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    DLog(@"%@",[YRUserInfo shareManager].userCompanyInfo);
+    
 }
 
 -(void)viewWillAppear:(BOOL)animated{
     
     [super viewWillAppear:animated];
     
-    if ([YRUserInfo shareManager].masChanged) {
-        
-         [self getDataFromServer];
-        
-        
-    }
+    [self loadData];
     
 }
 
@@ -52,10 +47,52 @@
         
     }];
     
+    
+    
 }
 
 #pragma mark - 网络请求
 
+-(void)loadData{
+    
+    if ([YRUserInfo shareManager].masChanged) {
+        
+        NSDictionary *comDic = [YRUserInfo shareManager].userCompanyInfo;
+        
+        if (comDic) {
+            
+            self.dataArr = [YRMsgMainModel mj_objectArrayWithKeyValuesArray:comDic[@"messageConfigArray"]];
+            
+            NSMutableArray *unArr =comDic[@"unreadMessageCountArray"];
+            
+            for (YRMsgMainModel *model in self.dataArr) {
+                
+                for (NSDictionary *unDic in unArr) {
+                    
+                    if ([model.code isEqualToString:FORMAT(@"%@",unDic[@"code"])]) {
+                        
+                        model.remindCount = [unDic[@"count"] integerValue]+arc4random_uniform(20);
+                        
+                    }
+                    
+                }
+                
+            }
+            
+            [self calculteRemindCount];
+            
+            [self.tableView reloadData];
+            
+        }else{
+        
+        [self getDataFromServer];
+        
+        }
+        
+    }
+    
+}
+
 /**
  获取配置信息
  */

+ 3 - 3
UU_Ent/UU_Ent/Modules/Mine/Main/Others/YRUserInfo.m

@@ -25,7 +25,7 @@
     return instance;
 
 }
-
+#pragma mark - token
 -(void)setToken:(NSString *)token{
     
     if (token) {
@@ -41,7 +41,7 @@
     return [[NSUserDefaults standardUserDefaults] objectForKey:@"UUUserInfoToken"];
     
 }
-
+#pragma mark - 最后登录的公司信息
 -(void)setLastCompanyInfo:(NSDictionary *)lastCompanyInfo{
     
     [[NSUserDefaults standardUserDefaults] setObject:lastCompanyInfo forKey:@"UUCompanyLastCompanyInfo"];
@@ -56,7 +56,7 @@
 
 }
 
-
+#pragma mark - 自动登录
 -(void)setAutoLogin:(BOOL)autoLogin{
     
     [[NSUserDefaults standardUserDefaults] setObject:@(autoLogin) forKey:@"UUUserAutoLoginOrNot"];

+ 25 - 5
UU_Ent/UU_Ent/Modules/Work/Main/Controllers/YRWorkVC.m

@@ -141,11 +141,7 @@
         
     }
     
-    if ([YRUserInfo shareManager].masChanged) {
-        
-        [self loadDataFromServer];
-        
-    }
+    [self loadData];
     
 }
 
@@ -167,6 +163,30 @@
 }
 
 #pragma mark - 网络请求
+
+-(void)loadData{
+    
+    
+    if ([YRUserInfo shareManager].masChanged) {
+        
+        NSDictionary *comDic = [YRUserInfo shareManager].userCompanyInfo;
+        
+        if (comDic) {
+            
+            self.dataArr = [YRWorkConModel mj_objectArrayWithKeyValuesArray:comDic[@"appGroupConfigArray"]];
+            
+            [self.tableView reloadData];
+            
+        }else{
+        
+        [self loadDataFromServer];
+        
+        }
+        
+    }
+    
+}
+
 -(void)loadDataFromServer{
     
     [GRPCCall useInsecureConnectionsForHost:kHostAddress];

+ 7 - 1
UU_Ent/UU_Ent/Utils/AlertView/YRAlertView.m

@@ -24,7 +24,13 @@ static YRAlertView *alert = nil;
         
         alert = [[YRAlertView alloc]initWithFrame:[UIScreen mainScreen].bounds];
         
+        alert.windowLevel = UIWindowLevelAlert;
+        
         alert.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.2f];
+        //防止某些情况下没有主window异常
+        UIViewController *viewC = [UIViewController new];
+        
+        alert.rootViewController = viewC;
         
         [alert makeKeyAndVisible];
         
@@ -126,7 +132,7 @@ static YRAlertView *alert = nil;
         [centView addSubview:sure];
         [sure addTarget:alert action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
         
-        if (cancelTitle) {
+        if (cancelTitle.length > 0) {
             [centView addSubview:cancel];
             [cancel mas_makeConstraints:^(MASConstraintMaker *make) {
                 

+ 2 - 2
UU_Ent/UU_Ent/Utils/UIPopoverListView/UIPopoverListView.m

@@ -134,7 +134,7 @@ UIView *popDetailView;
     _webView.delegate=self;
     _webView.scalesPageToFit=YES;
     NSMutableURLRequest *preRequest;
-    DLog(@"popWebView=%@",webViewLink);
+    
     preRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:webViewLink]];
     [_webView loadRequest:preRequest];
 
@@ -311,7 +311,7 @@ BOOL isfirstOpen=YES;
     popoverDateStr=str1;
     [self.delegate setDateText:popoverDateStr];
     isfirstOpen=NO;
-    DLog(@"date=%@",str1);
+    
 }
 -(void)buttonClicked1:(id)sender{
 //    [self.delegate setDateText:popoverDateStr];