Parcourir la source

160831
Add support offline signature on common editor

Ray Zhang il y a 9 ans
Parent
commit
903a88cbb2

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/UserInterfaceState.xcuserstate


+ 16 - 0
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/Ray.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -83,5 +83,21 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "common/CommonEditor/CommonEditorViewController.m"
+            timestampString = "494306177.367738"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "4638"
+            endingLineNumber = "4638"
+            landmarkName = "-tableView:willSelectRowAtIndexPath:"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 56 - 2
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -4638,6 +4638,60 @@
             signimg = img;
             
             if(signimg!=nil)
+            {
+                if(appDelegate.offline_mode)
+                {
+                    
+                    NSData *data =  UIImagePNGRepresentation(img);
+                    
+                    // 再将NSData转为字符串
+                    NSString *jsonStr = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+                    
+                    //            NSMutableString *str = [[NSMutableString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
+                    
+                    NSLog(@"data string: %@",jsonStr);
+                    NSError *error=nil;
+                    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
+                    
+                    
+                    
+
+                    
+                    
+                    //NSMutableArray* arr_ret = [[NSMutableArray alloc] init];
+                    if([[json valueForKey:@"result"] intValue]==2)
+                    {
+                        NSString* img_url_down = json[@"img_url_aname"];
+                        //                            if(img_url_down.length==0)
+                        //                                img_url_down=@"";
+                        NSString* img_url_up = json[@"img_url"];
+                        //                            if(img_url_up.length==0)
+                        //                                img_url_up=@"";
+                        
+                        NSMutableDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
+                        
+                        [item_json setValue:img_url_down forKey:@"avalue"];
+                        [item_json setValue:img_url_up forKey:@"value"];
+                        [item_json setValue:@"true" forKey:@"dirty"];
+                        NSMutableDictionary* section_json = [[self.content_data_download objectForKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]] mutableCopy];
+                        [section_json setObject:item_json forKey:[NSString stringWithFormat:@"item_%d",indexPath.row]];
+                        
+                        [self.content_data_download setObject:section_json forKey:[NSString stringWithFormat:@"section_%ld",(long)indexPath.section ]];
+                        self.content_data_control = [self translate_json:self.content_data_download changed:self.changed_data];
+                        
+                        
+                        CommonEditorCellSignature* cell = (CommonEditorCellSignature*) [self.editorTable cellForRowAtIndexPath:indexPath];
+                        
+                        cell.imageviewSignature.image = signimg;
+                        
+                        
+                    }
+                    else
+                    {
+                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Image" controller:self] ;
+                    }
+                }
+            else
             {
                 NSData *imageData = UIImagePNGRepresentation(img);
                 
@@ -4748,8 +4802,8 @@
                 
                 [uploadTask resume];
             }
-            
-            
+        }
+        
             
         };
         

+ 3 - 3
RedAnt ERP Mobile/iSales-NPD/Base.lproj/Main.storyboard

@@ -2063,7 +2063,7 @@
                                         <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QWz-EJ-Yzy" id="E1L-su-dvV">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" id="PJV-YE-GvQ">
@@ -2087,7 +2087,7 @@
                                         <rect key="frame" x="0.0" y="44" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="TID-OY-afi" id="yuC-0D-Ebs">
-                                            <rect key="frame" x="0.0" y="0.0" width="768" height="43.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="768" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Diskspace" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="pVO-Tx-wMs">
@@ -2115,7 +2115,7 @@
                                         <rect key="frame" x="0.0" y="88" width="768" height="44"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Pol-lE-P45" id="FAm-1c-nX0">
-                                            <rect key="frame" x="0.0" y="0.0" width="682" height="43.5"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="682" height="44"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Clean Cache" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AHm-p1-51h">