Jelajahi Sumber

1.修改iOS RedAnt Mobile Result,整理子类需要重写的方法。

Pen Li 8 tahun lalu
induk
melakukan
a87ccf26f6

+ 13 - 0
common/customUI/MyQLPreviewController.h

@@ -0,0 +1,13 @@
+//
+//  MyQLPreviewController.h
+//  Apex Mobile
+//
+//  Created by Ray on 02/03/2018.
+//  Copyright © 2018 United Software Applications, Inc. All rights reserved.
+//
+
+#import <QuickLook/QuickLook.h>
+
+@interface MyQLPreviewController : QLPreviewController
+
+@end

+ 66 - 0
common/customUI/MyQLPreviewController.m

@@ -0,0 +1,66 @@
+//
+//  MyQLPreviewController.m
+//  Apex Mobile
+//
+//  Created by Ray on 02/03/2018.
+//  Copyright © 2018 United Software Applications, Inc. All rights reserved.
+//
+
+#import "MyQLPreviewController.h"
+
+@interface MyQLPreviewController ()
+
+@end
+
+@implementation MyQLPreviewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+//    self.toolbarItems = nil;
+    
+//    for(UIView* v in self.view.subviews)
+//    {
+//        if ([v isKindOfClass:[UIToolbar class] ]) {
+//            v.hidden = YES;
+//        }
+//    }
+    // Do any additional setup after loading the view.
+}
+-(void)viewWillLayoutSubviews
+{
+    [super viewWillLayoutSubviews];
+    
+//    self.navigationController.navigationBar.hidden = YES;
+    
+//    self.navigationController.toolbar.hidden = YES;
+//    [self.navigationController.toolbar removeFromSuperview];
+//    UIView* v1 = self.navigationController.toolbar.superview;
+//    UIView* v2 = self.navigationController.toolbar;
+    [self.navigationController setToolbarHidden:true];
+    
+//    self.navigationController.toolbar.backgroundColor = [UIColor clearColor];
+    //把tool bar frame置为空,实现隐藏
+    self.navigationController.toolbar.frame = CGRectMake(0, 0, 0, 0);
+//    [self.navigationController.toolbar.superview removeFromSuperview];
+//    // custom view demonstrate
+//    UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
+//    topView.backgroundColor = [UIColor redColor];
+//
+//    [self.view addSubview:topView];
+}
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 12 - 11
common/customUI/ResultViewController.h

@@ -46,19 +46,13 @@ UIKIT_EXTERN const int delta;
 @property (assign) unsigned long default_title_text_size;
 @property (assign) unsigned long default_row_text_size;
 
-- (void)setQueryParams:(NSDictionary *)params;
+- (void)setQueryParams:(NSMutableDictionary *)params;
 
 //@property (strong, nonatomic)UITapGestureRecognizer* labelTap;
 //
 //@property (strong, nonatomic)UITapGestureRecognizer* cellDoubleTap;
 
 - (void)loadContent;
-/**
- * 0: init load
- * 1: refresh
- * 2: load more
- */
-- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish;
 
 - (void)updateTableFrame;
 
@@ -68,15 +62,22 @@ UIKIT_EXTERN const int delta;
 
 - (void)resize_tableHeader;
 
-- (void)Export:(NSString*)url;
++ (instancetype)buildInstanceWithParams:(NSMutableDictionary *)params;
 
-- (void)save;
+#pragma mark - Child View Controller Override
 
-- (void)downloadItemClick:(UIBarButtonItem *)sender;
+/**
+ * 0: init load
+ * 1: refresh
+ * 2: load more
+ */
+- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish;
 
--(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer;
+- (void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer;
 
 - (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath;
 
+- (void)MenuClick:(UIBarButtonItem *)sender;
+
 @end
 

+ 446 - 428
common/customUI/ResultViewController.m

@@ -37,6 +37,12 @@ const int delta = 25;
 
 @implementation ResultViewController
 
++ (instancetype)buildInstanceWithParams:(NSMutableDictionary *)params {
+    id resultVC = [[self alloc] initWithNibName:@"Result" bundle:nil];
+    ((ResultViewController *)resultVC).params = params;
+    return resultVC;
+}
+
 - (void)labelClick {
     NSLog(@"underlineLabel被点击了");
 }
@@ -84,7 +90,7 @@ const int delta = 25;
 
 - (void)viewDidLoad {
     
-        [super viewDidLoad];
+    [super viewDidLoad];
     
     self.default_row_text_size=14;
     self.default_title_text_size=17;
@@ -141,6 +147,7 @@ const int delta = 25;
     self.automaticallyAdjustsScrollViewInsets = NO;
     self.tableview.tableFooterView = [UIView new];
     [self setupNavigationBar];
+    [self configureTableView];
     [self setupTableRefreshView];
     [self loadContent];
     
@@ -152,254 +159,6 @@ const int delta = 25;
     [super viewWillAppear:animated];
 }
 
-- (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath {
-    
-}
-
--(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer
-{
-    
-    NSAssert(true, ([NSString stringWithFormat:@"%s cellDoubleTapAction not impl",object_getClassName([self class])]));
-}
-//{
-//    NSLog(@"cell double tap");
-//        UITableViewCell* cell = (UITableViewCell*)[gestureRecognizer view];
-//    NSIndexPath* indexPath=[self.tableview indexPathForCell:cell];
-//    //strongSelf.content_action
-//    if(self.content_action!=nil)
-//    {
-//
-//        if(self.content_action.count==1)
-//        {
-//            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 = [NSMutableDictionary new];
-//                params[@"query_id"] = self.params[@"query_id"];
-//
-//                NSMutableDictionary *criteria =[NSMutableDictionary new];
-//                for(NSString* key in [action[@"params"] allKeys] )
-//                {
-//                    NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
-//                    int idx =[action[@"params"][key] intValue];
-//                    criteria[key]=item[ idx];
-//                }
-//
-//
-//                params[@"criteria"]=[RAConvertor dict2string:criteria] ;
-//
-//
-//
-//                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 if([module isEqualToString:@"order_detail"])
-//            {
-//
-//                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
-//        {
-//
-//            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"" 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([module isEqualToString:@"quick_look"])
-//                    {
-//
-//                        //            +(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 if([module isEqualToString:@"order_detail"])
-//                    {
-//
-//                        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;
-//                    }
-//                    // 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");
-//
-//            }];
-//            [alertControl addAction:actionCancel];
-//
-//
-//
-//
-//
-//            [self presentViewController:alertControl animated:NO completion:nil];
-//
-//        }
-//
-//    }
-//
-//
-//
-//}
 -(void)labelTapAction:(UIGestureRecognizer*)gestureRecognizer
 {
     
@@ -766,7 +525,7 @@ const int delta = 25;
 
 #pragma mark - Public
 
-- (void)setQueryParams:(NSDictionary *)params {
+- (void)setQueryParams:(NSMutableDictionary *)params {
     self.params = params;
 }
 
@@ -807,6 +566,11 @@ const int delta = 25;
     };
 }
 
+- (void)configureTableView {
+    
+    [self.tableview registerNib:[UINib nibWithNibName:@"ResultCell" bundle:nil] forCellReuseIdentifier:@"tCell"];
+}
+
 - (void)setupNavigationBar {
     
     if(self.content_menu==nil)
@@ -822,107 +586,6 @@ const int delta = 25;
     backItem.title = @"Back";
     self.navigationItem.backBarButtonItem = backItem;
 }
-- (void)MenuClick:(UIBarButtonItem *)sender {
-    
-    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
-    //block代码块取代了delegate
-    
-    __weak typeof(self) weakSelf = self;
-    for(int i=0;i<self.content_menu.count;i++)
-    {
-        NSMutableDictionary* json = self.content_menu[i];
-        NSString* title =json[@"title"];
-        NSString* actiontype = json[@"action"];
-        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:url];
-            }
-            else if([actiontype isEqualToString:@"save"])
-            {
-                [weakSelf save];
-            }
-        }];
-        [alertControl addAction:actioni];
-    }
-    
-    UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-        // DebugLog(@"Cancel");
-       
-    }];
-    [alertControl addAction:actionCancel];
-    
-  
-    
-    
-    
-    [self presentViewController:alertControl animated:NO completion:nil];
-}
-
-- (void)save {
-    
-}
-
--(void)Export:(NSString*) url
-{
-    
-    NSAssert(true, ([NSString stringWithFormat:@"%s Export not impl",object_getClassName([self class])]));
-//    if(self.download_query )
-//    {
-//        self.documentPath = self.download_query;
-//        [self.navigationController pushViewController:self.quickLook animated:NO];
-//        return;
-//    }
-//
-//    __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:url];
-//        weakSelf.download_query = path;
-//        weakSelf.documentPath = path;
-//
-//        if (path) {
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
-//            });
-//        }
-//
-//    });
-}
-- (void)downloadItemClick:(UIBarButtonItem *)sender {
-    NSAssert(true, ([NSString stringWithFormat:@"%s downloadItemClick not impl",object_getClassName([self class])]));
-//
-//
-//    if(self.download_query )
-//    {
-//        self.documentPath = self.download_query;
-//        [self.navigationController pushViewController:self.quickLook animated:NO];
-//        return;
-//    }
-//
-//    __weak typeof(self) weakSelf = self;
-//    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//
-//        NSMutableDictionary *params = self.params.mutableCopy;
-//        NSString *path = [RANetwork download_query:params];
-//        weakSelf.download_query = path;
-//        weakSelf.documentPath = path;
-//
-//        if (path) {
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
-//            });
-//        }
-//
-//    });
-//
-}
 
 - (NSInteger)resultItemCount {
     return [[self.content_data objectForKey:@"count"] integerValue];
@@ -931,83 +594,6 @@ const int delta = 25;
 - (void)loadContent {
     [self loadContentWithOption:0 Complete:nil];
 }
-/**
- * 0: init load
- * 1: refresh
- * 2: load more
- */
-- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish {
-        NSAssert(true, ([NSString stringWithFormat:@"%s loadContentWithOption not impl",object_getClassName([self class])]));
-//    if (self.params) {
-//
-//        NSMutableDictionary *dic = self.params.mutableCopy;
-//        switch (option) {
-//            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: {
-//                self.offset = [self resultItemCount];
-//            }
-//            break;
-//        }
-//
-////        dic[@"criteria"] = self.params;
-//
-//        [dic setObject:@(self.offset) forKey:@"offset"];
-//        [dic setObject:@(delta) forKey:@"limit"];
-////        dic[@"criteria"] = [NSArray arrayWithObjects:@"aaa",@"bbb", nil];
-//
-//        __weak typeof(self) weakSelf = self;
-//        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-//            NSDictionary *contentDic = [RANetwork query:dic];
-//            NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
-//            dispatch_async(dispatch_get_main_queue(), ^{
-//                if (weakSelf) {
-//                    __strong typeof(weakSelf) strongSelf = weakSelf;
-//                    if (result == RESULT_TRUE) {
-//                        strongSelf.content_layout = [contentDic objectForKey:@"layout"];
-//                        strongSelf.content_action = [contentDic objectForKey:@"row_action"];
-//                        strongSelf.content_menu = [[contentDic objectForKey:@"menu"] mutableCopy];
-//                        [strongSelf setupNavigationBar];
-//
-//                            UILabel * headerview=(UILabel *)self.tableview.tableHeaderView;
-//                            headerview.text = contentDic[@"table_title"];
-//                            [self resize_tableHeader];
-//
-//                        if(strongSelf.content_data==nil)
-//                            strongSelf.content_data = [NSMutableDictionary new];
-//                        NSMutableDictionary* newdata = [[contentDic objectForKey:@"data"] mutableCopy];
-//                        for(int dc = 0;dc<[newdata[@"count"] intValue];dc++)
-//                        {
-//                            NSMutableDictionary * newdata_item = newdata[[NSString stringWithFormat:@"item_%d",dc]];
-//
-//                            strongSelf.content_data[[NSString stringWithFormat:@"item_%d",[strongSelf.content_data[@"count"] intValue] ]] = newdata_item;
-//                            strongSelf.content_data[@"count"] = @([strongSelf.content_data[@"count"] intValue]+1);
-//                        }
-//
-////                        strongSelf.content_data = [contentDic objectForKey:@"data"];
-//                        [strongSelf updateTableFrame];
-//                        [strongSelf.tableview reloadData];
-//                    } else {
-//                        [RAUtils message_alert:[contentDic objectForKey:@"err_msg"] title:@"Warning" controller:strongSelf];
-//                    }
-//
-//                    if (finish) {
-//                        finish((int)result,(int)[self resultItemCount]);
-//                    }
-//
-//                }
-//
-//            });
-//        });
-//    }
-}
 
 - (void)updateTableFrame {
     // auto resizing
@@ -1230,4 +816,436 @@ const int delta = 25;
     }
     NSLog(@"force %f",force);
 }
+
+#pragma mark - Child View Controller Override
+
+/**
+ * 0: init load
+ * 1: refresh
+ * 2: load more
+ */
+- (void)loadContentWithOption:(int)option Complete:(void (^)(int result,int count))finish {
+    NSAssert(true, ([NSString stringWithFormat:@"%s loadContentWithOption not impl",object_getClassName([self class])]));
+    //    if (self.params) {
+    //
+    //        NSMutableDictionary *dic = self.params.mutableCopy;
+    //        switch (option) {
+    //            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: {
+    //                self.offset = [self resultItemCount];
+    //            }
+    //            break;
+    //        }
+    //
+    ////        dic[@"criteria"] = self.params;
+    //
+    //        [dic setObject:@(self.offset) forKey:@"offset"];
+    //        [dic setObject:@(delta) forKey:@"limit"];
+    ////        dic[@"criteria"] = [NSArray arrayWithObjects:@"aaa",@"bbb", nil];
+    //
+    //        __weak typeof(self) weakSelf = self;
+    //        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+    //            NSDictionary *contentDic = [RANetwork query:dic];
+    //            NSInteger result = [[contentDic objectForKey:@"result"] integerValue];
+    //            dispatch_async(dispatch_get_main_queue(), ^{
+    //                if (weakSelf) {
+    //                    __strong typeof(weakSelf) strongSelf = weakSelf;
+    //                    if (result == RESULT_TRUE) {
+    //                        strongSelf.content_layout = [contentDic objectForKey:@"layout"];
+    //                        strongSelf.content_action = [contentDic objectForKey:@"row_action"];
+    //                        strongSelf.content_menu = [[contentDic objectForKey:@"menu"] mutableCopy];
+    //                        [strongSelf setupNavigationBar];
+    //
+    //                            UILabel * headerview=(UILabel *)self.tableview.tableHeaderView;
+    //                            headerview.text = contentDic[@"table_title"];
+    //                            [self resize_tableHeader];
+    //
+    //                        if(strongSelf.content_data==nil)
+    //                            strongSelf.content_data = [NSMutableDictionary new];
+    //                        NSMutableDictionary* newdata = [[contentDic objectForKey:@"data"] mutableCopy];
+    //                        for(int dc = 0;dc<[newdata[@"count"] intValue];dc++)
+    //                        {
+    //                            NSMutableDictionary * newdata_item = newdata[[NSString stringWithFormat:@"item_%d",dc]];
+    //
+    //                            strongSelf.content_data[[NSString stringWithFormat:@"item_%d",[strongSelf.content_data[@"count"] intValue] ]] = newdata_item;
+    //                            strongSelf.content_data[@"count"] = @([strongSelf.content_data[@"count"] intValue]+1);
+    //                        }
+    //
+    ////                        strongSelf.content_data = [contentDic objectForKey:@"data"];
+    //                        [strongSelf updateTableFrame];
+    //                        [strongSelf.tableview reloadData];
+    //                    } else {
+    //                        [RAUtils message_alert:[contentDic objectForKey:@"err_msg"] title:@"Warning" controller:strongSelf];
+    //                    }
+    //
+    //                    if (finish) {
+    //                        finish((int)result,(int)[self resultItemCount]);
+    //                    }
+    //
+    //                }
+    //
+    //            });
+    //        });
+    //    }
+}
+
+- (void)MenuClick:(UIBarButtonItem *)sender {
+    
+    //    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+    //    //block代码块取代了delegate
+    //
+    //    __weak typeof(self) weakSelf = self;
+    //    for(int i=0;i<self.content_menu.count;i++)
+    //    {
+    //        NSMutableDictionary* json = self.content_menu[i];
+    //        NSString* title =json[@"title"];
+    //        NSString* actiontype = json[@"action"];
+    //        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:url];
+    //            }
+    //            else if([actiontype isEqualToString:@"save"])
+    //            {
+    //                [weakSelf save];
+    //            }
+    //        }];
+    //        [alertControl addAction:actioni];
+    //    }
+    //
+    //    UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+    //        // DebugLog(@"Cancel");
+    //
+    //    }];
+    //    [alertControl addAction:actionCancel];
+    //
+    //
+    //
+    //
+    //
+    //    [self presentViewController:alertControl animated:NO completion:nil];
+}
+
+//- (void)save {
+//
+//}
+//
+//-(void)Export:(NSString*) url
+//{
+//
+//    NSAssert(true, ([NSString stringWithFormat:@"%s Export not impl",object_getClassName([self class])]));
+////    if(self.download_query )
+////    {
+////        self.documentPath = self.download_query;
+////        [self.navigationController pushViewController:self.quickLook animated:NO];
+////        return;
+////    }
+////
+////    __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:url];
+////        weakSelf.download_query = path;
+////        weakSelf.documentPath = path;
+////
+////        if (path) {
+////            dispatch_async(dispatch_get_main_queue(), ^{
+////                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
+////            });
+////        }
+////
+////    });
+//}
+//- (void)downloadItemClick:(UIBarButtonItem *)sender {
+//    NSAssert(true, ([NSString stringWithFormat:@"%s downloadItemClick not impl",object_getClassName([self class])]));
+////
+////
+////    if(self.download_query )
+////    {
+////        self.documentPath = self.download_query;
+////        [self.navigationController pushViewController:self.quickLook animated:NO];
+////        return;
+////    }
+////
+////    __weak typeof(self) weakSelf = self;
+////    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+////
+////        NSMutableDictionary *params = self.params.mutableCopy;
+////        NSString *path = [RANetwork download_query:params];
+////        weakSelf.download_query = path;
+////        weakSelf.documentPath = path;
+////
+////        if (path) {
+////            dispatch_async(dispatch_get_main_queue(), ^{
+////                [weakSelf.navigationController pushViewController:weakSelf.quickLook animated:NO];
+////            });
+////        }
+////
+////    });
+////
+//}
+
+- (void)presses3DTouchForIndexPath:(NSIndexPath *)indexPath {
+    
+}
+
+-(void)cellDoubleTapAction:(UIGestureRecognizer*)gestureRecognizer
+{
+    
+    NSAssert(true, ([NSString stringWithFormat:@"%s cellDoubleTapAction not impl",object_getClassName([self class])]));
+}
+//{
+//    NSLog(@"cell double tap");
+//        UITableViewCell* cell = (UITableViewCell*)[gestureRecognizer view];
+//    NSIndexPath* indexPath=[self.tableview indexPathForCell:cell];
+//    //strongSelf.content_action
+//    if(self.content_action!=nil)
+//    {
+//
+//        if(self.content_action.count==1)
+//        {
+//            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 = [NSMutableDictionary new];
+//                params[@"query_id"] = self.params[@"query_id"];
+//
+//                NSMutableDictionary *criteria =[NSMutableDictionary new];
+//                for(NSString* key in [action[@"params"] allKeys] )
+//                {
+//                    NSArray* item =self.content_data[[NSString stringWithFormat:@"item_%ld",indexPath.row]];
+//                    int idx =[action[@"params"][key] intValue];
+//                    criteria[key]=item[ idx];
+//                }
+//
+//
+//                params[@"criteria"]=[RAConvertor dict2string:criteria] ;
+//
+//
+//
+//                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 if([module isEqualToString:@"order_detail"])
+//            {
+//
+//                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
+//        {
+//
+//            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"" 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([module isEqualToString:@"quick_look"])
+//                    {
+//
+//                        //            +(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 if([module isEqualToString:@"order_detail"])
+//                    {
+//
+//                        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;
+//                    }
+//                    // 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");
+//
+//            }];
+//            [alertControl addAction:actionCancel];
+//
+//
+//
+//
+//
+//            [self presentViewController:alertControl animated:NO completion:nil];
+//
+//        }
+//
+//    }
+//
+//
+//
+//}
+
 @end