Commit f7270c2c authored by admin's avatar admin

修复首页搜索无数据页面 口碑报告选择商场bug 下载pdf附件

parent 57e30e56
...@@ -2292,7 +2292,7 @@ ...@@ -2292,7 +2292,7 @@
CreatedOnToolsVersion = 7.0.1; CreatedOnToolsVersion = 7.0.1;
SystemCapabilities = { SystemCapabilities = {
com.apple.BackgroundModes = { com.apple.BackgroundModes = {
enabled = 1; enabled = 0;
}; };
com.apple.Push = { com.apple.Push = {
enabled = 0; enabled = 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define kAnnounceContentCell @"AnnoContentTableViewCell" #define kAnnounceContentCell @"AnnoContentTableViewCell"
#define kAttachmentTableViewCell @"AttachmentTableViewCell" #define kAttachmentTableViewCell @"AttachmentTableViewCell"
@interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate, UIDocumentInteractionControllerDelegate> @interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate, UIDocumentInteractionControllerDelegate, UIAlertViewDelegate>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) AnnounceDetailHeadView *headerView; @property (nonatomic, strong) AnnounceDetailHeadView *headerView;
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
docController.delegate = self;//设置代理 docController.delegate = self;//设置代理
[docController presentPreviewAnimated:YES]; [docController presentPreviewAnimated:YES];
} else { } else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"文件不存在,请先下载在查看!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"文件不存在,请下载后再查看!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show]; [alert show];
} }
} }
...@@ -177,19 +177,27 @@ ...@@ -177,19 +177,27 @@
//已完成下载 //已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"下载成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[self.tableView reloadData]; alert.tag = 66690;
[alert show];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"下载失败");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"下载失败!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}]; }];
[operation start]; [operation start];
} }
} }
- (void)didReceiveMemoryWarning { #pragma mark - UIAlertViewDelegate
[super didReceiveMemoryWarning]; -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
// Dispose of any resources that can be recreated. {
if (alertView.tag == 66690) {
if (buttonIndex == 0) {
[self.tableView reloadData];
}
}
} }
#pragma mark - UITableView Delegate/DataSource #pragma mark - UITableView Delegate/DataSource
......
...@@ -132,13 +132,18 @@ ...@@ -132,13 +132,18 @@
{ {
NSString *nameStr = @""; NSString *nameStr = @"";
_uuidArray = [NSMutableArray array]; _uuidArray = [NSMutableArray array];
if (array.count == 0) {
_storeName = @"全部";
} else {
for (TreeNodeModel *model in array) { for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]]; nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:model.uuid , @"store_uuid", model.code , @"store_code", model.name , @"store_name", nil]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:model.uuid , @"store_uuid", model.code , @"store_code", model.name , @"store_name", nil];
[_uuidArray addObject:dict]; [_uuidArray addObject:dict];
} }
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
_storeName = nameStr; _storeName = nameStr;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} }
......
...@@ -43,6 +43,14 @@ ...@@ -43,6 +43,14 @@
self.view.backgroundColor = kFootViewBackGroundColor; self.view.backgroundColor = kFootViewBackGroundColor;
// UIButton *rightButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 20)];
// [rightButton setTitle:@"全部重置" forState:UIControlStateNormal];
// [rightButton addTarget:self action:@selector(resetClick:) forControlEvents:UIControlEventTouchUpInside];
// [rightButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
// UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
// self.navigationItem.rightBarButtonItem = rightButtonItem;
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
[customLab setTextColor:[UIColor whiteColor]]; [customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"选择商场"]; [customLab setText:@"选择商场"];
...@@ -69,6 +77,11 @@ ...@@ -69,6 +77,11 @@
} }
- (void)resetClick:(UIButton *)sender
{
}
- (void)sureClick:(UIButton *)sender - (void)sureClick:(UIButton *)sender
{ {
if (_delegate && [_delegate respondsToSelector:@selector(deliverWithArray:)]) { if (_delegate && [_delegate respondsToSelector:@selector(deliverWithArray:)]) {
...@@ -91,10 +104,8 @@ ...@@ -91,10 +104,8 @@
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(999) @"pageSize":@(999)
}; };
NSLog(@"url = %@", url);
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient queryLowerOrgsWithParameters:parameters completion:^(id response, NSError *error) { [httpClient queryLowerOrgsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"查询下级组织 reponse = %@,error = %@", response, error);
NSDictionary *data = response[@"data"]; NSDictionary *data = response[@"data"];
NSArray *dataArray = data[@"records"]; NSArray *dataArray = data[@"records"];
NSMutableArray *oneTree = [NSMutableArray array]; NSMutableArray *oneTree = [NSMutableArray array];
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#import "CommentView.h" #import "CommentView.h"
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
#import "CommentModel.h" #import "CommentModel.h"
#import "CommonFunc.h"
#import <UIImageView+WebCache.h> #import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h> #import <UIButton+WebCache.h>
...@@ -41,6 +42,8 @@ ...@@ -41,6 +42,8 @@
@property (nonatomic, copy) NSString *pictureUuid; @property (nonatomic, copy) NSString *pictureUuid;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@end @end
@implementation PictureStoryViewController @implementation PictureStoryViewController
...@@ -55,6 +58,7 @@ ...@@ -55,6 +58,7 @@
[super viewDidLoad]; [super viewDidLoad];
self.picTextArray = [NSMutableArray array]; self.picTextArray = [NSMutableArray array];
self.imageNameArray = [NSMutableArray array];
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO; self.automaticallyAdjustsScrollViewInsets = NO;
...@@ -76,7 +80,6 @@ ...@@ -76,7 +80,6 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, self.uuid, user_uuid]; NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, self.uuid, user_uuid];
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *http = [[HttpClient alloc] initWithUrl:url]; HttpClient *http = [[HttpClient alloc] initWithUrl:url];
__block PictureStoryViewController *weakSelf = self;
[http getPicturePraiseDetailWithCompletion:^(id response, NSError *error) { [http getPicturePraiseDetailWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑详情 res ===%@, error = %@", response, error); NSLog(@"图说口碑详情 res ===%@, error = %@", response, error);
...@@ -99,14 +102,51 @@ ...@@ -99,14 +102,51 @@
[_picTextArray addObject:picText]; [_picTextArray addObject:picText];
} }
weakSelf.tableView.delegate = self; // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
weakSelf.tableView.dataSource = self; // [self reloadPictureText:_picTextArray];
// });
self.tableView.delegate = self;
self.tableView.dataSource = self;
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
}]; }];
} }
- (void)reloadPictureText:(NSMutableArray *)picTextArray
{
if (picTextArray.count == 0) {
return;
}
for (int i = 0; i < picTextArray.count; i++) {
PicTextModel *picText = picTextArray[i];
if (picText.fileName.length != 0) {
NSURL *imageURL = [NSURL URLWithString:picText.fileUrl];
NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
NSString *imageName = picText.fileName;
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *fullPath = [cachePath stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
}
}
dispatch_async(dispatch_get_main_queue(), ^{
[_tableView reloadData];
});
}
- (void)setupNav - (void)setupNav
{ {
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
...@@ -326,10 +366,16 @@ ...@@ -326,10 +366,16 @@
cell = [[PictureTextTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTextTableCell]; cell = [[PictureTextTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTextTableCell];
} }
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,picText.fileUrl]]; NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,picText.fileUrl]];
UIImage *defaultImage = [UIImage imageNamed:@"default_pic"];
// defaultImage = [defaultImage resizableImageWithCapInsets:UIEdgeInsetsMake(38, 85, 22, 85) resizingMode:UIImageResizingModeStretch];
[cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:defaultImage];
// [cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]]; // [cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
[cell.bigImageView sd_setImageWithURL:imageUrl]; // [cell.bigImageView sd_setImageWithURL:imageUrl];
NSLog(@"cell.size = %@", NSStringFromCGSize(cell.bigImageView.image.size));
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)];
[cell.bigImageView addGestureRecognizer:tap]; [cell.bigImageView addGestureRecognizer:tap];
...@@ -341,6 +387,20 @@ ...@@ -341,6 +387,20 @@
} }
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
// if (_imageNameArray.count == 0) {
// cell.bigImageView.image = [UIImage imageNamed:@"default_pic"];
// } else {
// // 获取沙盒目录
// NSString *cachePath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0];
// NSString *fullPath = [cachePath stringByAppendingPathComponent:_imageNameArray[0]];
// UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
// cell.bigImageView.image = image;
// //[cell ];
// }
return cell; return cell;
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#define SELECTED_VIEW_CONTROLLER_TAG 39998 #define SELECTED_VIEW_CONTROLLER_TAG 39998
@interface SOPViewController () <GroupTabBarDelegate, SOPTableViewDelegate, UITableViewDelegate, UITableViewDataSource, UIDocumentInteractionControllerDelegate> @interface SOPViewController () <UIAlertViewDelegate,GroupTabBarDelegate, SOPTableViewDelegate, UITableViewDelegate, UITableViewDataSource, UIDocumentInteractionControllerDelegate>
@property (nonatomic, strong) GroupTabBar *groupTabBar; @property (nonatomic, strong) GroupTabBar *groupTabBar;
@property (nonatomic, strong) NSArray *titleArray; @property (nonatomic, strong) NSArray *titleArray;
...@@ -256,7 +256,9 @@ ...@@ -256,7 +256,9 @@
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject; NSString *path = paths.lastObject;
[self downloadFileURL:[NSString stringWithFormat:@"%@%@", kRedStarURL, atta.fileUrl] savePath:path fileName:atta.fileName]; NSString *fileName = [NSString stringWithFormat:@"%@", atta.fileName];
fileName = [fileName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
[self downloadFileURL:[NSString stringWithFormat:@"%@%@", kRedStarURL, atta.fileUrl] savePath:path fileName:fileName];
} }
- (void)downloadFileURL:(NSString *)aUrl savePath:(NSString *)aSavePath fileName:(NSString *)aFileName - (void)downloadFileURL:(NSString *)aUrl savePath:(NSString *)aSavePath fileName:(NSString *)aFileName
...@@ -276,8 +278,11 @@ ...@@ -276,8 +278,11 @@
if (![fileManager fileExistsAtPath:aSavePath]) { if (![fileManager fileExistsAtPath:aSavePath]) {
[fileManager createDirectoryAtPath:aSavePath withIntermediateDirectories:YES attributes:nil error:nil]; [fileManager createDirectoryAtPath:aSavePath withIntermediateDirectories:YES attributes:nil error:nil];
} }
NSLog(@"aurlllll === %@", aUrl);
//下载附件 //下载附件
aUrl = [aUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSLog(@"aurlllll === %@", aUrl);
NSURL *url = [[NSURL alloc] initWithString:aUrl]; NSURL *url = [[NSURL alloc] initWithString:aUrl];
NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSURLRequest *request = [NSURLRequest requestWithURL:url];
...@@ -290,10 +295,15 @@ ...@@ -290,10 +295,15 @@
//已完成下载 //已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"下载成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[self.tableView reloadData]; alert.tag = 66690;
[alert show];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) { } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"下载失败"); NSLog(@"error ==== %@", error);
[self.tableView reloadData];
[self closeRedView];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"下载失败!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}]; }];
[operation start]; [operation start];
...@@ -404,6 +414,17 @@ ...@@ -404,6 +414,17 @@
{ {
[self.navigationController dismissViewControllerAnimated:YES completion:nil]; [self.navigationController dismissViewControllerAnimated:YES completion:nil];
} }
#pragma mark - UIAlertViewDelegate
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag == 66690) {
if (buttonIndex == 0) {
[self.tableView reloadData];
}
}
}
#pragma mark - UITableView Delegate/DataSource #pragma mark - UITableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
......
...@@ -72,9 +72,8 @@ ...@@ -72,9 +72,8 @@
[super viewDidLoad]; [super viewDidLoad];
self.allTitleArray = [NSArray arrayWithObjects:@"口碑巡检", @"选择范围", @"统计方式" ,nil]; self.allTitleArray = [NSArray arrayWithObjects:@"口碑巡检", @"选择范围", @"统计方式" ,nil];
self.uuidArray = [NSMutableArray array];
self.titleArray = [NSMutableArray array]; self.titleArray = [NSMutableArray array];
self.uuidArray = [NSMutableArray array];
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
...@@ -302,12 +301,17 @@ ...@@ -302,12 +301,17 @@
- (void)deliverWithArray:(NSMutableArray *)array - (void)deliverWithArray:(NSMutableArray *)array
{ {
NSString *nameStr = @""; NSString *nameStr = @"";
self.uuidArray = [NSMutableArray array];
if (array.count == 0) {
_selectName = @"全部";
} else {
for (TreeNodeModel *model in array) { for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]]; nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
[_uuidArray addObject:model.uuid]; [_uuidArray addObject:model.uuid];
} }
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
_selectName = nameStr; _selectName = nameStr;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} }
......
...@@ -32,10 +32,6 @@ ...@@ -32,10 +32,6 @@
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
</dict> </dict>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment