|
|
@@ -104,90 +104,220 @@ static const int delta = 25;
|
|
|
//strongSelf.content_action
|
|
|
if(self.content_action!=nil)
|
|
|
{
|
|
|
- NSString * module = self.content_action[@"module"];
|
|
|
- if([module isEqualToString:@"quick_look"])
|
|
|
+
|
|
|
+ if(self.content_action.count==1)
|
|
|
{
|
|
|
-
|
|
|
-// +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url
|
|
|
- NSMutableDictionary *params = self.content_action[@"params"];
|
|
|
- NSString* URL =self.content_action[@"url"];
|
|
|
- __weak typeof(self) weakSelf = self;
|
|
|
- dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+ NSDictionary* action =self.content_action.firstObject;
|
|
|
+ NSString * module = action[@"module"];
|
|
|
+ if([module isEqualToString:@"quick_look"])
|
|
|
+ {
|
|
|
+
|
|
|
+ // +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url
|
|
|
+ NSMutableDictionary *params = action[@"params"];
|
|
|
+ NSString* URL =action[@"url"];
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+
|
|
|
+
|
|
|
+ NSString *path = [RANetwork download_file:params url:URL];
|
|
|
+ weakSelf.documentPath = path;
|
|
|
+
|
|
|
+ if (path) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if([module isEqualToString:@"kv_detail"])
|
|
|
+ {
|
|
|
+ NSMutableDictionary *params = action[@"params"];
|
|
|
|
|
|
|
|
|
- NSString *path = [RANetwork download_file:params url:URL];
|
|
|
- weakSelf.documentPath = path;
|
|
|
+ UIAlertView * waitalert = [RAUtils waiting_alert:@"Loading..." title:@"Please wait"];
|
|
|
|
|
|
- if (path) {
|
|
|
+
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSDictionary* json =[RANetwork kv_detail:params];
|
|
|
+
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+
|
|
|
+
|
|
|
+ if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ KVViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"KVViewController"];
|
|
|
+ vc.content = [json mutableCopy];
|
|
|
+ [weakself.navigationController pushViewController:vc animated:NO];
|
|
|
+
|
|
|
+ // weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
+ //
|
|
|
+ // weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // [weakself download_success];
|
|
|
+ // [weakself.editorTable reloadData];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:json[@"msg"] title:nil controller:weakself] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
- }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if([module isEqualToString:@"order_detail"])
|
|
|
+ {
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
- else if([module isEqualToString:@"kv_detail"])
|
|
|
- {
|
|
|
- NSMutableDictionary *params = self.content_action[@"params"];
|
|
|
-
|
|
|
-
|
|
|
- UIAlertView * waitalert = [RAUtils waiting_alert:@"Loading..." title:@"Please wait"];
|
|
|
-
|
|
|
-
|
|
|
- __weak typeof(self) weakself = self;
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+ OrderDetailViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderDetailViewController"];
|
|
|
|
|
|
|
|
|
+ vc.url_type = URL_REMOTE;
|
|
|
+ vc.request_url=URL_ORDER_DETAIL;
|
|
|
|
|
|
- NSDictionary* json =[RANetwork kv_detail:params];
|
|
|
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+ vc.params = [NSMutableDictionary dictionary];
|
|
|
+ // NSString *path = [[NSBundle mainBundle] pathForResource:@"search_ui.json" ofType:nil];
|
|
|
+ // NSData *data = [NSData dataWithContentsOfFile:path];
|
|
|
+ // vc.content_data_download = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
+ [self.navigationController pushViewController:vc animated:NO];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Menu" message:nil preferredStyle:UIAlertControllerStyleAlert];
|
|
|
+ //block代码块取代了delegate
|
|
|
+
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ for(int i=0;i<self.content_action.count;i++)
|
|
|
+ {
|
|
|
+ NSMutableDictionary* json = self.content_action[i];
|
|
|
+ NSString* title =json[@"title"];
|
|
|
+ NSString* module = json[@"module"];
|
|
|
+ NSMutableDictionary* add_params = json[@"params"];
|
|
|
+ UIAlertAction *actioni = [UIAlertAction actionWithTitle:title style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
|
|
|
|
|
|
|
|
- if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+ if([module isEqualToString:@"quick_look"])
|
|
|
{
|
|
|
- KVViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"KVViewController"];
|
|
|
- vc.content = [json mutableCopy];
|
|
|
- [weakself.navigationController pushViewController:vc animated:NO];
|
|
|
|
|
|
-// weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
-//
|
|
|
-// weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
-//
|
|
|
-//
|
|
|
-// [weakself download_success];
|
|
|
-// [weakself.editorTable reloadData];
|
|
|
+ // +(NSString*)download_file : (NSMutableDictionary*) params url:(NSString*) url
|
|
|
+ NSMutableDictionary *params = json[@"params"];
|
|
|
+ NSString* URL =json[@"url"];
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
|
|
+
|
|
|
+
|
|
|
+ NSString *path = [RANetwork download_file:params url:URL];
|
|
|
+ weakSelf.documentPath = path;
|
|
|
+
|
|
|
+ if (path) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if([module isEqualToString:@"kv_detail"])
|
|
|
+ {
|
|
|
+ NSMutableDictionary *params = json[@"params"];
|
|
|
+
|
|
|
|
|
|
+ UIAlertView * waitalert = [RAUtils waiting_alert:@"Loading..." title:@"Please wait"];
|
|
|
+
|
|
|
+
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSDictionary* json =[RANetwork kv_detail:params];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
|
|
|
+
|
|
|
+
|
|
|
+ if([[json valueForKey:@"result"] intValue]==2)
|
|
|
+ {
|
|
|
+ KVViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"KVViewController"];
|
|
|
+ vc.content = [json mutableCopy];
|
|
|
+ [weakself.navigationController pushViewController:vc animated:NO];
|
|
|
+
|
|
|
+ // weakself.content_data_download = [weakself CopyDirty:weakself.content_data_download to:[editor_json mutableCopy]];//[editor_json mutableCopy];
|
|
|
+ //
|
|
|
+ // weakself.content_data_control = [weakself translate_json:weakself.content_data_download changed: weakself.changed_data];
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // [weakself download_success];
|
|
|
+ // [weakself.editorTable reloadData];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ [RAUtils message_alert:json[@"msg"] title:nil controller:weakself] ;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
- else
|
|
|
+ else if([module isEqualToString:@"order_detail"])
|
|
|
{
|
|
|
- [RAUtils message_alert:json[@"msg"] title:nil controller:weakself] ;
|
|
|
+
|
|
|
+ OrderDetailViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderDetailViewController"];
|
|
|
+
|
|
|
+
|
|
|
+ vc.url_type = URL_REMOTE;
|
|
|
+ vc.request_url=URL_ORDER_DETAIL;
|
|
|
+
|
|
|
+
|
|
|
+ vc.params = [NSMutableDictionary dictionary];
|
|
|
+ // NSString *path = [[NSBundle mainBundle] pathForResource:@"search_ui.json" ofType:nil];
|
|
|
+ // NSData *data = [NSData dataWithContentsOfFile:path];
|
|
|
+ // vc.content_data_download = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
+ [self.navigationController pushViewController:vc animated:NO];
|
|
|
+ return;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- else if([module isEqualToString:@"order_detail"])
|
|
|
- {
|
|
|
-
|
|
|
- OrderDetailViewController *vc = [[UIStoryboard storyboardWithName:@"Detail" bundle:nil] instantiateViewControllerWithIdentifier:@"OrderDetailViewController"];
|
|
|
+ // DebugLog(@"Cancel");
|
|
|
+// if([actiontype isEqualToString:@"download"])
|
|
|
+// {
|
|
|
+// [weakSelf Export:add_params];
|
|
|
+// }
|
|
|
+// else if([actiontype isEqualToString:@"save"])
|
|
|
+// {
|
|
|
+// }
|
|
|
+ }];
|
|
|
+ [alertControl addAction:actioni];
|
|
|
+ }
|
|
|
|
|
|
+ UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
|
|
|
+ // DebugLog(@"Cancel");
|
|
|
|
|
|
- vc.url_type = URL_REMOTE;
|
|
|
- vc.request_url=URL_ORDER_DETAIL;
|
|
|
+ }];
|
|
|
+ [alertControl addAction:actionCancel];
|
|
|
|
|
|
|
|
|
- vc.params = [NSMutableDictionary dictionary];
|
|
|
-// NSString *path = [[NSBundle mainBundle] pathForResource:@"search_ui.json" ofType:nil];
|
|
|
-// NSData *data = [NSData dataWithContentsOfFile:path];
|
|
|
-// vc.content_data_download = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil] mutableCopy];
|
|
|
- [self.navigationController pushViewController:vc animated:NO];
|
|
|
- return;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [self presentViewController:alertControl animated:NO completion:nil];
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -618,6 +748,10 @@ static const int delta = 25;
|
|
|
case 0:
|
|
|
case 1: {
|
|
|
self.offset = 0;
|
|
|
+ self.content_layout =nil;
|
|
|
+ self.content_action = nil;
|
|
|
+ self.content_menu = nil;
|
|
|
+ self.content_data = nil;
|
|
|
}
|
|
|
break;
|
|
|
case 2: {
|
|
|
@@ -749,8 +883,16 @@ static const int delta = 25;
|
|
|
int option = 0;
|
|
|
if ([refresh isEqual:self.tableview.jl_header]) {
|
|
|
option = 1;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
if (refresh == self.tableview.jl_footer) {
|
|
|
+ if(refresh.state==JLRefreshStateNoMore) //数据取完不再加载
|
|
|
+ return;
|
|
|
option = 2;
|
|
|
}
|
|
|
__weak typeof(self) weakSelf = self;
|