Răsfoiți Sursa

1.修改iOS Apex Drivers文件上传。

Pen Li 7 ani în urmă
părinte
comite
a898e4ac60

+ 2 - 2
Redant Drivers/Apex And Drivers/FakeData/fake_order_edit.json

@@ -42,7 +42,7 @@
                            {
                            "type": 3,
                            "key": "container_photo_0",
-                           "title": "Container Photo",
+                           "title": "Container Photo 0",
                            "path": "photoPath"
                            },
                            {
@@ -83,7 +83,7 @@
                            {
                            "type": 3,
                            "key": "container_photo_1",
-                           "title": "Container Photo",
+                           "title": "Container Photo 1",
                            "path": "photoPath"
                            }
                            ]

+ 13 - 7
Redant Drivers/Apex And Drivers/RADataProvider.m

@@ -276,12 +276,12 @@
     
     sleep(3.0f);
     
-    int i = arc4random_uniform(100);
-    if (i % 2 == 0) {
-        return @{@"result" : @2};
-    } else {
+//    int i = arc4random_uniform(100);
+//    if (i % 2 == 0) {
+//        return @{@"result" : @2};
+//    } else {
         return @{@"result" : @1};
-    }
+//    }
     
     return [self upload:URL_HOST parameters:params file:filePath];
 }
@@ -326,9 +326,15 @@
 }
 
 + (NSDictionary *)fakeError {
+//    return @{
+//             @"result" : @0,
+//             @"err_msg" : @"server error,please try later."
+//             };
+    
     return @{
-             @"result" : @0,
-             @"err_msg" : @"server error,please try later."
+             @"container_photo_0": @"12346798",
+             @"container_photo_1": @"78945612",
+             @"result": @2
              };
 }
 

+ 3 - 0
Redant Drivers/Apex And Drivers/RAProgressHUD.m

@@ -80,6 +80,8 @@ static const CGFloat HUDSIZE = 100.0f;
     hud.activityIndicator.frame = CGRectMake(20, 5, 60, 60);
     [hud addSubview:hud.activityIndicator];
     
+    hud.window.userInteractionEnabled = NO;
+    
     return hud;
 }
 
@@ -110,6 +112,7 @@ static const CGFloat HUDSIZE = 100.0f;
     [UIView animateWithDuration:0.25 animations:^{
         self.alpha = 0.3;
     } completion:^(BOOL finished) {
+        self.window.userInteractionEnabled = YES;
         [self removeFromSuperview];
         if (completion) {
             completion();

+ 14 - 2
Redant Drivers/Apex And Drivers/Update/RAOrderEditViewController.m

@@ -282,7 +282,11 @@
                     [RASingleton sharedInstance].requiredLocation = requiredLocation;
                 });
                 
-                [strongSelf syncUploadPhotos:photoArr Json:json HUD:nil];
+                if (photoArr.count > 0) {
+                    [strongSelf syncUploadPhotos:photoArr Json:json HUD:hud];
+                } else {
+                    [self gobackHome];
+                }
                 
             } else {
                 // process error
@@ -308,6 +312,11 @@
     
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
+    NSDate *date = [NSDate date];
+    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
+    formatter.dateFormat = @"MM/dd/YYYY HH:mm";
+    NSString *time = [formatter stringFromDate:date];
+    
     for (RAEditPhotoModel *model in photos) {
         
         NSString *serial = [json objectForKey:model.key];
@@ -321,8 +330,11 @@
             NSMutableDictionary *task = [@{
                                            @"order" : self.orderID,
                                            @"action" : self.actionTitle,
+                                           @"name" : model.title,
+                                           @"time" : time,
                                            @"url" : URL_HOST,
-                                           @"file" : photoPath
+                                           @"file" : photoPath,
+                                           @"params" : params
                                            } mutableCopy];
             [appDelegate.uploadManager addTask:task];
         }

+ 1 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.h

@@ -11,6 +11,7 @@
 @interface ApexDriverUploadCell : UITableViewCell
 
 @property (nonatomic,copy) NSString *orderID;
+@property (nonatomic,copy) NSString *photoName;
 @property (nonatomic,copy) NSString *action;
 @property (nonatomic,copy) NSString *datetime;
 @property (nonatomic,copy) NSString *status;

+ 6 - 0
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadCell.m

@@ -11,6 +11,7 @@
 @interface ApexDriverUploadCell ()
 
 @property (strong, nonatomic) IBOutlet UILabel *orderNoLabel;
+@property (strong, nonatomic) IBOutlet UILabel *photoNameLabel;
 @property (strong, nonatomic) IBOutlet UILabel *actionLabel;
 @property (strong, nonatomic) IBOutlet UILabel *dateLabel;
 @property (strong, nonatomic) IBOutlet UILabel *statusLabel;
@@ -95,4 +96,9 @@
     self.dateLabel.text = datetime;
 }
 
+- (void)setPhotoName:(NSString *)photoName {
+    _photoName = photoName;
+    self.photoNameLabel.text = photoName;
+}
+
 @end

+ 7 - 2
Redant Drivers/Apex And Drivers/Upload/ApexDriverUploadListVC.m

@@ -29,7 +29,9 @@
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-    // Do any additional setup after loading the view.    
+    // Do any additional setup after loading the view.
+    
+    self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
 }
 
 - (void)didReceiveMemoryWarning {
@@ -82,6 +84,8 @@
     cell.action = item_json[@"action"];
     cell.status = status;
     cell.errMsg = item_json[@"msg"];
+    cell.datetime = item_json[@"time"];
+    cell.photoName = item_json[@"name"];
 
     
     op.updateUI=^(){
@@ -114,7 +118,8 @@
         cell.action = item_json[@"action"];
         cell.status = status;
         cell.errMsg = item_json[@"msg"];
-        
+        cell.datetime = item_json[@"time"];
+        cell.photoName = item_json[@"name"];
     };
     
     return cell;

+ 21 - 11
Redant Drivers/Apex And Drivers/Upload/Upload.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina4_7" orientation="portrait">
         <adaptation id="fullscreen"/>
     </device>
@@ -22,11 +22,11 @@
                                 <rect key="frame" x="0.0" y="20" width="375" height="647"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <prototypes>
-                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ApexDriverUploadCell" rowHeight="125" id="huU-zg-npZ" customClass="ApexDriverUploadCell">
-                                        <rect key="frame" x="0.0" y="28" width="375" height="125"/>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ApexDriverUploadCell" rowHeight="151" id="huU-zg-npZ" customClass="ApexDriverUploadCell">
+                                        <rect key="frame" x="0.0" y="28" width="375" height="151"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="huU-zg-npZ" id="dZU-sw-5VP">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="124.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="375" height="150.5"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="AFS20180530001200" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WTo-cm-rdo">
@@ -39,8 +39,14 @@
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
+                                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Container Photo" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gIP-sv-to3">
+                                                    <rect key="frame" x="5" y="31" width="365" height="21.5"/>
+                                                    <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                                    <nil key="textColor"/>
+                                                    <nil key="highlightedColor"/>
+                                                </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delivered" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y9Q-F5-1QB">
-                                                    <rect key="frame" x="5" y="31" width="240" height="21"/>
+                                                    <rect key="frame" x="5" y="57.5" width="240" height="21"/>
                                                     <constraints>
                                                         <constraint firstAttribute="height" constant="21" id="nLb-nk-rmK"/>
                                                     </constraints>
@@ -49,7 +55,7 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Waiting" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rUp-S4-lOb">
-                                                    <rect key="frame" x="5" y="72" width="310" height="21"/>
+                                                    <rect key="frame" x="5" y="98.5" width="310" height="21"/>
                                                     <constraints>
                                                         <constraint firstAttribute="height" constant="21" id="fbR-9t-WUj"/>
                                                     </constraints>
@@ -58,7 +64,7 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="100.0%" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2cy-8a-tLI">
-                                                    <rect key="frame" x="320" y="74" width="50" height="17"/>
+                                                    <rect key="frame" x="320" y="100.5" width="50" height="17"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="50" id="Ax5-Vz-Htq"/>
                                                         <constraint firstAttribute="height" constant="17" id="djs-9H-M2g"/>
@@ -68,7 +74,7 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Error:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UZL-gw-YiG">
-                                                    <rect key="frame" x="5" y="98" width="365" height="21"/>
+                                                    <rect key="frame" x="5" y="124.5" width="365" height="21"/>
                                                     <constraints>
                                                         <constraint firstAttribute="height" constant="21" id="SPE-qn-CPk"/>
                                                     </constraints>
@@ -77,10 +83,10 @@
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                                 <progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="W75-Zx-6bA">
-                                                    <rect key="frame" x="5" y="62" width="365" height="2"/>
+                                                    <rect key="frame" x="5" y="88.5" width="365" height="2"/>
                                                 </progressView>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="12/31/2018 24:05" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1qM-zg-EJJ">
-                                                    <rect key="frame" x="250" y="33" width="120" height="17"/>
+                                                    <rect key="frame" x="250" y="59.5" width="120" height="17"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="120" id="Lxf-4m-vXf"/>
                                                         <constraint firstAttribute="height" constant="17" id="yIa-Y2-aBE"/>
@@ -92,9 +98,11 @@
                                             </subviews>
                                             <color key="backgroundColor" red="0.76483958467461133" green="0.62864267894700021" blue="0.1775369151630608" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                             <constraints>
-                                                <constraint firstItem="y9Q-F5-1QB" firstAttribute="top" secondItem="WTo-cm-rdo" secondAttribute="bottom" constant="5" id="0Fl-oe-y0X"/>
                                                 <constraint firstItem="W75-Zx-6bA" firstAttribute="top" secondItem="y9Q-F5-1QB" secondAttribute="bottom" constant="10" id="0Xf-UV-Nwz"/>
                                                 <constraint firstItem="1qM-zg-EJJ" firstAttribute="leading" secondItem="y9Q-F5-1QB" secondAttribute="trailing" constant="5" id="2eC-yA-7xv"/>
+                                                <constraint firstItem="gIP-sv-to3" firstAttribute="top" secondItem="WTo-cm-rdo" secondAttribute="bottom" constant="5" id="2eo-VK-3sx"/>
+                                                <constraint firstAttribute="trailing" secondItem="gIP-sv-to3" secondAttribute="trailing" constant="5" id="6Ko-K3-GvW"/>
+                                                <constraint firstItem="gIP-sv-to3" firstAttribute="leading" secondItem="WTo-cm-rdo" secondAttribute="leading" id="Eec-xQ-cCg"/>
                                                 <constraint firstItem="UZL-gw-YiG" firstAttribute="top" secondItem="rUp-S4-lOb" secondAttribute="bottom" constant="5" id="Etm-UB-ilT"/>
                                                 <constraint firstItem="UZL-gw-YiG" firstAttribute="trailing" secondItem="2cy-8a-tLI" secondAttribute="trailing" id="JX0-IN-bS8"/>
                                                 <constraint firstItem="UZL-gw-YiG" firstAttribute="leading" secondItem="rUp-S4-lOb" secondAttribute="leading" id="OUW-J1-UlK"/>
@@ -107,6 +115,7 @@
                                                 <constraint firstAttribute="trailing" secondItem="WTo-cm-rdo" secondAttribute="trailing" constant="5" id="dpK-kz-h0C"/>
                                                 <constraint firstItem="2cy-8a-tLI" firstAttribute="centerY" secondItem="rUp-S4-lOb" secondAttribute="centerY" id="enp-D1-wmU"/>
                                                 <constraint firstItem="W75-Zx-6bA" firstAttribute="trailing" secondItem="WTo-cm-rdo" secondAttribute="trailing" id="fJh-Wr-WW6"/>
+                                                <constraint firstItem="y9Q-F5-1QB" firstAttribute="top" secondItem="gIP-sv-to3" secondAttribute="bottom" constant="5" id="frT-Ed-DfY"/>
                                                 <constraint firstItem="y9Q-F5-1QB" firstAttribute="leading" secondItem="WTo-cm-rdo" secondAttribute="leading" id="gR7-jL-F0U"/>
                                                 <constraint firstItem="1qM-zg-EJJ" firstAttribute="centerY" secondItem="y9Q-F5-1QB" secondAttribute="centerY" id="oNc-nP-bfg"/>
                                                 <constraint firstItem="rUp-S4-lOb" firstAttribute="top" secondItem="W75-Zx-6bA" secondAttribute="bottom" constant="8" id="pJQ-pK-hLR"/>
@@ -118,6 +127,7 @@
                                             <outlet property="actionLabel" destination="y9Q-F5-1QB" id="iio-G5-JhR"/>
                                             <outlet property="dateLabel" destination="1qM-zg-EJJ" id="Vlr-GZ-l6Q"/>
                                             <outlet property="orderNoLabel" destination="WTo-cm-rdo" id="H2g-gN-czi"/>
+                                            <outlet property="photoNameLabel" destination="gIP-sv-to3" id="x9l-1Y-KSA"/>
                                             <outlet property="progressLabel" destination="2cy-8a-tLI" id="R4m-gM-Kw6"/>
                                             <outlet property="progressView" destination="W75-Zx-6bA" id="cVF-cl-2Jh"/>
                                             <outlet property="statusLabel" destination="rUp-S4-lOb" id="OOb-Js-CBk"/>