Browse Source

Recant mobile

修复外观显示混乱
修改导出传值
Ray Zhang 8 years ago
parent
commit
e803143c4c

BIN
RA Image/RA Image.xcodeproj/project.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate


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

@@ -45,13 +45,13 @@
 #import "AppDelegate.h"
 
 #import "FileCache.h"
-#import "RAConvertor.h"
+//#import "RAConvertor.h"
 #import "EnumSelectAndSortViewController.h"
 #import "CommonEditorRangeCell.h"
 #import "CommonEditorWebCell.h"
 #import "CommonEditorBannerCell.h"
 #import "ContentPreviewController.h"
-
+#import "NetworkUtils.h"
 
 
 @interface subitem_data ()

+ 4 - 0
RedAnt Mobile/DefaultAppearance.m

@@ -179,6 +179,8 @@
         else
         {
             NSArray* arr_container = [self appearance_container:container_json];
+            if(arr_container.count==0)
+                return nil;
             return [UILabel appearanceWhenContainedIn: arr_container.firstObject, nil];
         }
     }
@@ -235,6 +237,8 @@
 }
 +(void) appearance_function:(id)appearance function:(NSString*)function value:(NSString*)value
 {
+    if(appearance==nil)
+        return;
     // json 中添加 function 类型必须在此函数中添加对应代码
     if([function isEqualToString:@"setTitleColor.Normal"])
     {

+ 3 - 1
RedAnt Mobile/RedAnt Mobile/RAModeListViewController.m

@@ -167,7 +167,8 @@
     
     ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
     [preQueryVC setQueryParams: @{
-                                  @"query_id" : modeinfo[@"query_id"]
+                                  @"query_id" : modeinfo[@"query_id"],
+                                  @"title":modeinfo[@"name"]
                                   }];
     
     [self.navigationController pushViewController:preQueryVC animated:YES];
@@ -180,6 +181,7 @@
     
     queryVC.params = [NSMutableDictionary new];
     queryVC.params[@"query_id"]=modeinfo[@"query_id"];
+    queryVC.params[@"title"]=modeinfo[@"name"];
     queryVC.request_url = [RANetwork get_url:URL_QUERY_UI];
     queryVC.url_type = URL_REMOTE;
 

+ 1 - 1
RedAnt Mobile/RedAnt Mobile/RANetwork.h

@@ -15,7 +15,7 @@
 +(NSDictionary*)Login : (NSString*) user password:(NSString*) password;
 +(NSDictionary*)logout;
 +(NSDictionary*)query : (NSMutableDictionary*) params;
-+(NSString*)download_query : (NSMutableDictionary*) params;
++(NSString*)download_query : (NSString*) url;
 +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url;
 +(NSDictionary*)require_query_ui:(NSString*) request_url params:(NSMutableDictionary*)params;
 +(NSDictionary*)kv_detail : (NSMutableDictionary*) params;

+ 39 - 8
RedAnt Mobile/RedAnt Mobile/RANetwork.m

@@ -74,20 +74,51 @@
     NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
     return resultDic;
 }
-+(NSString*)download_query : (NSMutableDictionary*) params
++(NSString*)download_query : (NSString*) url
 {
+    
+#ifdef FAKE_DATA
     NSString *Path =nil;
     Path=[[NSBundle mainBundle] pathForResource:@"download_query.xls" ofType:nil];
     
     return Path;
-    
+#endif
     
     // params[@"_operate"]=@"valid_upload";
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
-    NSData *data = [self get_json:[self get_url:URL_QUERY] parameters:params file:nil];
-    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
-    return resultDic;
+//    NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
+    
+    
+    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]        cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60*5];
+    
+    //设置请求方式为get
+    
+    [request setHTTPMethod:@"GET"];
+    
+    //添加用户会话id
+    
+    [request addValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
+    
+    
+    NSHTTPURLResponse* urlResponse = nil;
+    
+    NSError *error = nil;
+    
+    NSData *data= [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
+    
+    NSString* temp = NSTemporaryDirectory();
+    
+    NSString* file=[urlResponse suggestedFilename];
+    
+    NSString *tempfile = [temp stringByAppendingPathComponent:file];
+    
+    
+    [data writeToFile:tempfile atomically:false];
+    return tempfile;
+//    NSData *data = [self get_json:[self get_url:URL_QUERY] parameters:params file:nil];
+//    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
+//    return resultDic;
 }
 +(NSDictionary*)kv_detail : (NSMutableDictionary*) params
 {
@@ -101,7 +132,7 @@
     
     params[ @"_action"]=@"ant_mobile";
     params[ @"module"]=@"kv_detail";
-    params[ @"_operate"]=@"getCondition";
+    params[ @"_operate"]=@"row_action";
     
     // params[@"_operate"]=@"valid_upload";
     AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
@@ -137,7 +168,7 @@
     //    NSString* d=[AESCrypt decrypt:@"VzB4+lENfbzWX7ggHh2Os1P69l5YBzKmM51yqA37AfoKgPY8bJgdK8M4WvF+wDyOsLWP\/o8H5+bHMivQp1u8wM2QV7SYzgzPwV85QKtYWIzEgLe9T0HO69EdutWz7k1rdAT\/mftsRin0Hy5SHk7txTZT\/zPH5X+FQiExCTFm5Zus39HYvp+VxCX4+kYeymn8B63AUd3mRQyscUvDjfgU2olKR\/TP8PV3g+VQMZxpKfol3P1iOtz3XQlHZV0pM6SAf+SwT0sPfrdn6CZFfNQlrKA9QjMrnBdMeSCquSIWXnmLv6okzvnlJnT0SjvJuUeqNdBC5EZ0ACnhI0MrXVZEsq1EuM9al7oPzvU5EZbjZpmx+fSFIkMzTT8bYClTnG1bsL1MCcU4pSODDorUj8zalA==" password:@"usai2010"];
     params = [self prepare_addtional_params:params];
     
-    return [super get_json:url parameters:params file:(NSString*)file err_recorder:URL_ERR_LOG result_handler:^NSMutableDictionary *(NSMutableDictionary *jsobj) {
+    return [super get_json:url parameters:params file:file err_recorder:URL_ERR_LOG result_handler:^NSMutableDictionary *(NSMutableDictionary *jsobj) {
         int result=[[jsobj valueForKey:@"result"] intValue];
         //        UIApplication * app = [UIApplication sharedApplication];
         //        AppDelegate *appDelegate = (AppDelegate *)[app delegate];

+ 10 - 9
RedAnt Mobile/RedAnt Mobile/ResultViewController.m

@@ -146,7 +146,7 @@ static const int delta = 25;
                 }
                 
                 
-                params[@"criteria"]=[RAConvertor dict2string:action[@"params"]] ;
+                params[@"criteria"]=[RAConvertor dict2string:criteria] ;
                 
                 
                 
@@ -211,7 +211,7 @@ static const int delta = 25;
         else
         {
             
-            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Menu" message:nil preferredStyle:UIAlertControllerStyleAlert];
+            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"" message:nil preferredStyle:UIAlertControllerStyleAlert];
             //block代码块取代了delegate
             
             __weak typeof(self) weakSelf = self;
@@ -661,12 +661,13 @@ static const int delta = 25;
         NSMutableDictionary* json = self.content_menu[i];
         NSString* title =json[@"title"];
         NSString* actiontype = json[@"action"];
-        NSMutableDictionary* add_params = json[@"params"];
+        NSString* url = json[@"url"];
+//        NSMutableDictionary* add_params = json[@"params"];
         UIAlertAction *actioni = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
             // DebugLog(@"Cancel");
             if([actiontype isEqualToString:@"download"])
             {
-                [weakSelf Export:add_params];
+                [weakSelf Export:url];
             }
             else if([actiontype isEqualToString:@"save"])
             {
@@ -687,7 +688,7 @@ static const int delta = 25;
     
     [self presentViewController:alertControl animated:NO completion:nil];
 }
--(void)Export:(NSDictionary*) add_params
+-(void)Export:(NSString*) url
 {
     if(self.download_query )
     {
@@ -699,10 +700,10 @@ static const int delta = 25;
     __weak typeof(self) weakSelf = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
         
-        NSMutableDictionary *params = self.params.mutableCopy;
-        if(add_params!=nil)
-           [params addEntriesFromDictionary:add_params];
-        NSString *path = [RANetwork download_query:params];
+//        NSMutableDictionary *params = self.params.mutableCopy;
+//        if(add_params!=nil)
+//           [params addEntriesFromDictionary:add_params];
+        NSString *path = [RANetwork download_query:url];
         weakSelf.download_query = path;
         weakSelf.documentPath = path;
         

+ 1 - 1
RedAnt Mobile/RedAnt Mobile/SearchViewController.m

@@ -60,7 +60,7 @@
     NSMutableDictionary* result_params = [NSMutableDictionary new];
     result_params[@"criteria"] = [RAConvertor dict2string:criteria];//criteria;
     result_params[@"query_id"]=self.params[@"query_id"];
-    
+    result_params[@"title"]=self.params[@"title"];
     ResultViewController *preQueryVC = [[UIStoryboard storyboardWithName:@"Result" bundle:nil] instantiateViewControllerWithIdentifier:@"ResultViewController"];
     [preQueryVC setQueryParams: result_params];
     

+ 1 - 1
RedAnt Mobile/RedAnt Mobile/config.h

@@ -31,7 +31,7 @@
 #define PDF_DEBUG false
 
 
-#define FAKE_DATA
+//#define FAKE_DATA
 
 #define PROJ_RAMOBILE
 

+ 1 - 24
RedAnt Mobile/RedAnt Mobile/login.json

@@ -59,30 +59,7 @@
                               "code_name": "PO#",
                               "description": "scan PO#"
                               }
-                              ],
-                  "mode_list": [
-                                {
-                                "name": "POP",
-                                "description":"test description",
-                                "type": "local_func",
-                                "module": "raimage_pop"
-                                },
-                                {
-                                "name": "Model",
-                                "type": "local_func",
-                                "module": "raimage_model"
-                                },
-                                {
-                                "name": "Receiving",
-                                "type": "local_func",
-                                "module": "raimage_receiving"
-                                },
-                                {
-                                "name": "Returns",
-                                "type": "local_func",
-                                "module": "raimage_returns"
-                                }
-                                ]
+                              ]
                   },
                   {
                   "name": "Sales Order",

+ 1 - 0
common/NetworkUtils.h

@@ -8,6 +8,7 @@
 
 #import <Foundation/Foundation.h>
 #import "const.h"
+#import "RAConvertor.h"
 typedef NSMutableDictionary*(^resultBlock)(NSMutableDictionary* result);
 typedef NSMutableDictionary*(^decryptBlock)(NSMutableDictionary* result);
 

+ 1 - 1
common/NetworkUtils.m

@@ -10,7 +10,7 @@
 #import "RAUtils.h"
 #import "Reachability.h"
 #import "RANetworkTaskDelegate.h"
-#import "RAConvertor.h"
+
 
 #define BOUNDARY @"AaB03x"