Commit f7270c2c authored by admin's avatar admin

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

parent 57e30e56
......@@ -2292,7 +2292,7 @@
CreatedOnToolsVersion = 7.0.1;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
enabled = 0;
};
com.apple.Push = {
enabled = 0;
......
......@@ -22,7 +22,7 @@
#define kAnnounceContentCell @"AnnoContentTableViewCell"
#define kAttachmentTableViewCell @"AttachmentTableViewCell"
@interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate, UIDocumentInteractionControllerDelegate>
@interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate, UIDocumentInteractionControllerDelegate, UIAlertViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) AnnounceDetailHeadView *headerView;
......@@ -125,7 +125,7 @@
docController.delegate = self;//设置代理
[docController presentPreviewAnimated:YES];
} 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];
}
}
......@@ -177,19 +177,27 @@
//已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功");
[self.tableView reloadData];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"下载成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.tag = 66690;
[alert show];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"下载失败");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"下载失败!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}];
[operation start];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
#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
......
......@@ -132,13 +132,18 @@
{
NSString *nameStr = @"";
_uuidArray = [NSMutableArray array];
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:model.uuid , @"store_uuid", model.code , @"store_code", model.name , @"store_name", nil];
[_uuidArray addObject:dict];
if (array.count == 0) {
_storeName = @"全部";
} else {
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:model.uuid , @"store_uuid", model.code , @"store_code", model.name , @"store_name", nil];
[_uuidArray addObject:dict];
}
_storeName = nameStr;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
_storeName = nameStr;
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
......
......@@ -43,6 +43,14 @@
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)];
[customLab setTextColor:[UIColor whiteColor]];
[customLab setText:@"选择商场"];
......@@ -69,6 +77,11 @@
}
- (void)resetClick:(UIButton *)sender
{
}
- (void)sureClick:(UIButton *)sender
{
if (_delegate && [_delegate respondsToSelector:@selector(deliverWithArray:)]) {
......@@ -91,10 +104,8 @@
@"pageNumber":@(0),
@"pageSize":@(999)
};
NSLog(@"url = %@", url);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient queryLowerOrgsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"查询下级组织 reponse = %@,error = %@", response, error);
NSDictionary *data = response[@"data"];
NSArray *dataArray = data[@"records"];
NSMutableArray *oneTree = [NSMutableArray array];
......
......@@ -20,6 +20,7 @@
#import "CommentView.h"
#import <MBProgressHUD.h>
#import "CommentModel.h"
#import "CommonFunc.h"
#import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h>
......@@ -41,6 +42,8 @@
@property (nonatomic, copy) NSString *pictureUuid;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@end
@implementation PictureStoryViewController
......@@ -55,6 +58,7 @@
[super viewDidLoad];
self.picTextArray = [NSMutableArray array];
self.imageNameArray = [NSMutableArray array];
self.view.backgroundColor = [UIColor whiteColor];
self.automaticallyAdjustsScrollViewInsets = NO;
......@@ -76,7 +80,6 @@
NSString *url = [NSString stringWithFormat:@"%@%@%@?userUuid=%@", kRedStarURL, kPicturePraiseDetailURL, self.uuid, user_uuid];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
HttpClient *http = [[HttpClient alloc] initWithUrl:url];
__block PictureStoryViewController *weakSelf = self;
[http getPicturePraiseDetailWithCompletion:^(id response, NSError *error) {
NSLog(@"图说口碑详情 res ===%@, error = %@", response, error);
......@@ -99,14 +102,51 @@
[_picTextArray addObject:picText];
}
weakSelf.tableView.delegate = self;
weakSelf.tableView.dataSource = self;
[MBProgressHUD hideHUDForView:self.view animated:YES];
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
// [self reloadPictureText:_picTextArray];
// });
self.tableView.delegate = self;
self.tableView.dataSource = self;
[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
{
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
......@@ -326,10 +366,16 @@
cell = [[PictureTextTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kPictureTextTableCell];
}
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];
NSLog(@"cell.size = %@", NSStringFromCGSize(cell.bigImageView.image.size));
// [cell.bigImageView sd_setImageWithURL:imageUrl];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick:)];
[cell.bigImageView addGestureRecognizer:tap];
......@@ -341,6 +387,20 @@
}
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;
}
......
......@@ -18,7 +18,7 @@
#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) NSArray *titleArray;
......@@ -256,7 +256,9 @@
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
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
......@@ -276,8 +278,11 @@
if (![fileManager fileExistsAtPath:aSavePath]) {
[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];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
......@@ -290,10 +295,15 @@
//已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功");
[self.tableView reloadData];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"下载成功!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
alert.tag = 66690;
[alert show];
} 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];
......@@ -404,6 +414,17 @@
{
[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
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
......
......@@ -72,9 +72,8 @@
[super viewDidLoad];
self.allTitleArray = [NSArray arrayWithObjects:@"口碑巡检", @"选择范围", @"统计方式" ,nil];
self.uuidArray = [NSMutableArray array];
self.titleArray = [NSMutableArray array];
self.uuidArray = [NSMutableArray array];
self.tableView.delegate = self;
self.tableView.dataSource = self;
......@@ -302,12 +301,17 @@
- (void)deliverWithArray:(NSMutableArray *)array
{
NSString *nameStr = @"";
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
[_uuidArray addObject:model.uuid];
self.uuidArray = [NSMutableArray array];
if (array.count == 0) {
_selectName = @"全部";
} else {
for (TreeNodeModel *model in array) {
nameStr = [nameStr stringByAppendingString:[NSString stringWithFormat:@"%@,", model.name]];
[_uuidArray addObject:model.uuid];
}
_selectName = nameStr;
}
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:1 inSection:0];
_selectName = nameStr;
[self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
......
......@@ -32,10 +32,6 @@
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<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