Sfoglia il codice sorgente

1.修改iOS Apex Drivers Update Order过程中禁止重复提交。
2.修改iOS Apex Drivers Upload重试开始消息提示没有发生改变。

Pen Li 7 anni fa
parent
commit
27a5130a79

+ 1 - 1
Redant Drivers/Apex And Drivers/Update/Model/RAEditDateModel.m

@@ -30,7 +30,7 @@
 
 - (NSString *)value {
     if (!self.date) {
-        return @"0";
+        return nil;
     }
     return [NSString stringWithFormat:@"%f",[self.date timeIntervalSince1970]];
 }

+ 17 - 1
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -150,6 +150,8 @@
 @property (nonatomic,strong) NSMutableArray *sectionArray;
 @property (nonatomic,copy) NSString *photoDir;
 @property (nonatomic,strong) UIRefreshControl *refreshControl;
+@property (nonatomic,strong) UIBarButtonItem *updateItem;
+
 
 @end
 
@@ -216,7 +218,7 @@
 - (void)configureNavigationBar {
     
     UIBarButtonItem *updateItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Update", nil) style:UIBarButtonItemStylePlain target:self action:@selector(updateBtnClick:)];
-    self.navigationItem.rightBarButtonItem = updateItem;
+    self.updateItem = updateItem;
 }
 
 - (void)registKeyboardListener {
@@ -269,6 +271,11 @@
 
 #pragma mark - Setter
 
+- (void)setUpdateItem:(UIBarButtonItem *)updateItem {
+    _updateItem = updateItem;
+    self.navigationItem.rightBarButtonItem = updateItem;
+}
+
 - (void)addModelAtIndex:(NSIndexPath *)indexPath withJsonItem:(NSDictionary *)item {
     RAEditSectionModel *section = [self.sectionArray objectAtIndex:indexPath.section];
     [section addModelAtIndex:indexPath.row withJsonItem:item];
@@ -394,6 +401,8 @@
 
 - (void)updateBtnClick:(UIBarButtonItem *)sender {
     
+    self.updateItem.enabled = NO; // 失败返回时重新开启enable
+    
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
     if (self.orderType2) {
         [params setObject:self.orderType2 forKey:@"orderType2"];
@@ -418,6 +427,8 @@
         RAEditRequiredAlert *alertVC = [RAEditRequiredAlert alertWithTile:NSLocalizedString(@"Warning", nil) message:[NSString localizedStringWithFormat:NSLocalizedString(@"please complete missing field:\n%@", nil),[emptyArr componentsJoinedByString:@"\n"]]];
         
         [self presentViewController:alertVC animated:YES completion:nil];
+        
+        self.updateItem.enabled = YES;
         return;
     }
     
@@ -453,6 +464,8 @@
                         }
                         
                         [weakSelf showAlert:msg];
+                        
+                        weakSelf.updateItem.enabled = YES;
                     }
                     
                 }];
@@ -473,6 +486,7 @@
                     
                     dispatch_async(dispatch_get_main_queue(), ^{
                         
+                        
 //                        if (photoArr.count > 0) {
 //                            [strongSelf syncUploadPhotos:photoArr Json:json HUD:hud];
 //                        } else {
@@ -499,6 +513,8 @@
                             
                             NSString *msg = [json objectForKey:@"err_msg"];
                             [strongSelf showAlertTilte:NSLocalizedString(@"Warning", nil) message:msg];
+                            
+                            strongSelf.updateItem.enabled = YES;
                         }];
                         
                     });