Ver Fonte

1.修改iOS Apex Mobile登出后重新登陆KPI显示不正确。

Pen Li há 8 anos atrás
pai
commit
14bc611cf1
1 ficheiros alterados com 18 adições e 6 exclusões
  1. 18 6
      Apex Mobile/Apex Mobile/HomeViewController.m

+ 18 - 6
Apex Mobile/Apex Mobile/HomeViewController.m

@@ -93,9 +93,14 @@ typedef enum {
         [self loadData];
     }
     
-    if (self.mode == HomeModeKPI && self.KPIArray.count) {
-        NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count - 2];
-        self.parentViewController.title = str;
+    if (self.mode == HomeModeKPI) {
+        if (self.KPIArray.count) {
+            NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count];
+            self.parentViewController.title = str;
+        } else {
+            [self loadKPIData];
+        }
+        
     }
     
 }
@@ -311,6 +316,9 @@ typedef enum {
                 
                 [self.KPITableView reloadData];
                 
+                NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count];
+                self.parentViewController.title = str;
+                
             } else {
                 NSString *msg = [json objectForKey:@"err_msg"];
                 [RAUtils message_alert:msg title:@"Warning" controller:weakSelf];
@@ -352,7 +360,7 @@ typedef enum {
         if (self.KPIArray.count == 0) {
             [self loadKPIData];
         } else {
-            NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count - 2];
+            NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count];
             self.parentViewController.title = str;
         }
         
@@ -618,8 +626,12 @@ typedef enum {
             cur = index;
         }
         self.currentKPI = cur;
-        NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count];
-        self.parentViewController.title = str;
+        if (self.currentKPI > 0) {
+            NSString *str = [NSString stringWithFormat:@"%ld / %ld",self.currentKPI,self.KPIArray.count];
+            self.parentViewController.title = str;
+        } else {
+            self.currentKPI = 1;
+        }
     }
 }