|
|
@@ -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
|