Commit 5e2b2364 authored by admin's avatar admin

口碑标准 附件功能完成

parent b3e1d946
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
84ECCF181C01FA2600EA4960 /* QuestionDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF171C01FA2600EA4960 /* QuestionDetailModel.m */; }; 84ECCF181C01FA2600EA4960 /* QuestionDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF171C01FA2600EA4960 /* QuestionDetailModel.m */; };
84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF1A1C0210F000EA4960 /* CommentModel.m */; }; 84ECCF1B1C0210F000EA4960 /* CommentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ECCF1A1C0210F000EA4960 /* CommentModel.m */; };
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */; }; 84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */; };
84EE92771C2FFDEB000EF5BF /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */; };
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; }; 84F1669B1BE715E40061D350 /* ZanButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F1669A1BE715E40061D350 /* ZanButton.m */; };
84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA31BFC19F200CBAD13 /* RankListModel.m */; }; 84F30DA41BFC19F200CBAD13 /* RankListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F30DA31BFC19F200CBAD13 /* RankListModel.m */; };
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; }; 84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C451BEC388A00DDEEB1 /* CommentView.m */; };
...@@ -477,6 +478,8 @@ ...@@ -477,6 +478,8 @@
84ECCF1A1C0210F000EA4960 /* CommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentModel.m; sourceTree = "<group>"; }; 84ECCF1A1C0210F000EA4960 /* CommentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentModel.m; sourceTree = "<group>"; };
84ED5DD61BF2E64300A1BB6D /* ScreenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenView.h; sourceTree = "<group>"; }; 84ED5DD61BF2E64300A1BB6D /* ScreenView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScreenView.h; sourceTree = "<group>"; };
84ED5DD71BF2E64300A1BB6D /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; }; 84ED5DD71BF2E64300A1BB6D /* ScreenView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScreenView.m; sourceTree = "<group>"; };
84EE92751C2FFDEB000EF5BF /* AttachmentModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AttachmentModel.h; sourceTree = "<group>"; };
84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentModel.m; sourceTree = "<group>"; };
84F166991BE715E40061D350 /* ZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZanButton.h; sourceTree = "<group>"; }; 84F166991BE715E40061D350 /* ZanButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZanButton.h; sourceTree = "<group>"; };
84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; }; 84F1669A1BE715E40061D350 /* ZanButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZanButton.m; sourceTree = "<group>"; };
84F30DA21BFC19F200CBAD13 /* RankListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankListModel.h; sourceTree = "<group>"; }; 84F30DA21BFC19F200CBAD13 /* RankListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankListModel.h; sourceTree = "<group>"; };
...@@ -1477,6 +1480,8 @@ ...@@ -1477,6 +1480,8 @@
children = ( children = (
849B2F751C0CABE6005D809F /* AnnounceDetailModel.h */, 849B2F751C0CABE6005D809F /* AnnounceDetailModel.h */,
849B2F761C0CABE6005D809F /* AnnounceDetailModel.m */, 849B2F761C0CABE6005D809F /* AnnounceDetailModel.m */,
84EE92751C2FFDEB000EF5BF /* AttachmentModel.h */,
84EE92761C2FFDEB000EF5BF /* AttachmentModel.m */,
); );
path = Model; path = Model;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2419,6 +2424,7 @@ ...@@ -2419,6 +2424,7 @@
8473E3881C1BBFF600960257 /* InspectTaskDetailCell.m in Sources */, 8473E3881C1BBFF600960257 /* InspectTaskDetailCell.m in Sources */,
84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */, 84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */,
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */, 84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */,
84EE92771C2FFDEB000EF5BF /* AttachmentModel.m in Sources */,
84D2F5201C2D213400651EFB /* AttachmentTableViewCell.m in Sources */, 84D2F5201C2D213400651EFB /* AttachmentTableViewCell.m in Sources */,
84C9729F1C1ADD17003A3276 /* PictureCommentTableCell.m in Sources */, 84C9729F1C1ADD17003A3276 /* PictureCommentTableCell.m in Sources */,
849A18461C152EBA00071600 /* AddPictureTableCell.m in Sources */, 849A18461C152EBA00071600 /* AddPictureTableCell.m in Sources */,
......
...@@ -14,21 +14,23 @@ ...@@ -14,21 +14,23 @@
{ {
if (!_nameBtn) { if (!_nameBtn) {
_nameBtn = [[UIButton alloc] init]; _nameBtn = [[UIButton alloc] init];
_nameBtn.backgroundColor = [UIColor grayColor];
_nameBtn.translatesAutoresizingMaskIntoConstraints = NO; _nameBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_nameBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
_nameBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
_nameBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
_nameBtn.layer.cornerRadius = 4.0; _nameBtn.layer.cornerRadius = 4.0;
[self.contentView addSubview:_nameBtn]; [self.contentView addSubview:_nameBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5]; NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
[self.contentView addConstraint:lineViewTop]; [self.contentView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-20]; NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.downloadBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-10];
[self.contentView addConstraint:lineViewRight]; [self.contentView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5]; NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
[self.contentView addConstraint:lineViewBottom]; [self.contentView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10]; NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:lineViewLeft]; [self.contentView addConstraint:lineViewLeft];
NSLayoutConstraint *lineViewHeight = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35]; NSLayoutConstraint *lineViewHeight = [NSLayoutConstraint constraintWithItem:_nameBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
...@@ -42,22 +44,24 @@ ...@@ -42,22 +44,24 @@
{ {
if (!_downloadBtn) { if (!_downloadBtn) {
_downloadBtn = [[UIButton alloc] init]; _downloadBtn = [[UIButton alloc] init];
_downloadBtn.backgroundColor = [UIColor grayColor]; _downloadBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
_downloadBtn.translatesAutoresizingMaskIntoConstraints = NO; _downloadBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_downloadBtn setTitle:@"下载" forState:UIControlStateNormal];
[_downloadBtn setTitle:@"已下载" forState:UIControlStateSelected];
_downloadBtn.layer.cornerRadius = 4.0; _downloadBtn.layer.cornerRadius = 4.0;
[self.contentView addSubview:_downloadBtn]; [self.contentView addSubview:_downloadBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5]; NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:lineViewTop]; [self.contentView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:lineViewRight]; [self.contentView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5]; NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:lineViewBottom]; [self.contentView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:10]; NSLayoutConstraint *lineViewWidth = [NSLayoutConstraint constraintWithItem:_downloadBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[self.contentView addConstraint:lineViewLeft]; [self.contentView addConstraint:lineViewWidth];
} }
return _downloadBtn; return _downloadBtn;
} }
......
//
// AttachmentModel.h
// redstar
//
// Created by admin on 15/12/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AttachmentModel : NSObject
@property (nonatomic, strong) NSString *fileName;
@property (nonatomic, strong) NSString *fileUrl;
@end
//
// AttachmentModel.m
// redstar
//
// Created by admin on 15/12/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AttachmentModel.h"
@implementation AttachmentModel
@end
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#import "AnnounceDetailHeadView.h" #import "AnnounceDetailHeadView.h"
#import "AnnoContentTableViewCell.h" #import "AnnoContentTableViewCell.h"
#import "AnnounceDetailFootView.h" #import "AnnounceDetailFootView.h"
#import "AttachmentModel.h"
#import "HttpClient.h" #import "HttpClient.h"
...@@ -17,14 +18,18 @@ ...@@ -17,14 +18,18 @@
#import "AttachmentTableViewCell.h" #import "AttachmentTableViewCell.h"
#import <AFNetworking.h>
#define kAnnounceContentCell @"AnnoContentTableViewCell" #define kAnnounceContentCell @"AnnoContentTableViewCell"
#define kAttachmentTableViewCell @"AttachmentTableViewCell" #define kAttachmentTableViewCell @"AttachmentTableViewCell"
@interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate> @interface AnnoDetailViewController ()<UITableViewDataSource, UITableViewDelegate, UIDocumentInteractionControllerDelegate>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) AnnounceDetailHeadView *headerView; @property (nonatomic, strong) AnnounceDetailHeadView *headerView;
@property (nonatomic, strong) AnnounceDetailFootView *footerView; @property (nonatomic, strong) AnnounceDetailFootView *footerView;
@property (nonatomic, strong) AnnounceDetailModel *annoDetail; @property (nonatomic, strong) AnnounceDetailModel *annoDetail;
@property (nonatomic, strong) NSMutableArray *attachmentArray;
@end @end
@implementation AnnoDetailViewController @implementation AnnoDetailViewController
...@@ -33,6 +38,8 @@ ...@@ -33,6 +38,8 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
self.attachmentArray = [NSMutableArray array];
[self setNav]; [self setNav];
[self requestAnnoDetail]; [self requestAnnoDetail];
...@@ -50,6 +57,12 @@ ...@@ -50,6 +57,12 @@
AnnounceDetailModel *annoDetail = [AnnounceDetailModel announceDetailModelWithDict:dict]; AnnounceDetailModel *annoDetail = [AnnounceDetailModel announceDetailModelWithDict:dict];
_annoDetail = annoDetail; _annoDetail = annoDetail;
for (NSDictionary *attachmentDict in _annoDetail.attachmentUrls) {
AttachmentModel *atta = [[AttachmentModel alloc] init];
[atta setValuesForKeysWithDictionary:attachmentDict];
[_attachmentArray addObject:atta];
}
self.tableView.delegate = self; self.tableView.delegate = self;
self.tableView.dataSource = self; self.tableView.dataSource = self;
}]; }];
...@@ -98,12 +111,80 @@ ...@@ -98,12 +111,80 @@
- (void)showFile:(UIButton *)sender - (void)showFile:(UIButton *)sender
{ {
NSInteger row = sender.tag - 998473;
AttachmentModel *atta = _attachmentArray[row];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject;
NSString *url = [NSString stringWithFormat:@"%@/%@", path, atta.fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:url]) {
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:url]];//为该对象初始化一个加载路径
docController.delegate = self;//设置代理
[docController presentPreviewAnimated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"文件不存在,请先下载在查看!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
} }
- (void)downloadFile:(UIButton *)sender - (void)downloadFile:(UIButton *)sender
{ {
NSInteger row = sender.tag - 998473;
AttachmentModel *atta = _attachmentArray[row];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject;
[self downloadFileURL:[NSString stringWithFormat:@"%@%@", kRedStarURL, atta.fileUrl] savePath:path fileName:atta.fileName];
}
- (void)downloadFileURL:(NSString *)aUrl savePath:(NSString *)aSavePath fileName:(NSString *)aFileName
{
NSFileManager *fileManager = [NSFileManager defaultManager];
//检查本地文件是否已存在
NSString *fileName = [NSString stringWithFormat:@"%@/%@", aSavePath, aFileName];
//检查附件是否存在
if ([fileManager fileExistsAtPath:fileName]) {
NSLog(@"存在了");
}else{
NSLog(@"不存在");
//创建附件存储目录
if (![fileManager fileExistsAtPath:aSavePath]) {
[fileManager createDirectoryAtPath:aSavePath withIntermediateDirectories:YES attributes:nil error:nil];
}
//下载附件
NSURL *url = [[NSURL alloc] initWithString:aUrl];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.inputStream = [NSInputStream inputStreamWithURL:url];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:fileName append:NO];
//下载进度控制
//已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功");
[self.tableView reloadData];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"下载失败");
}];
[operation start];
}
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
...@@ -112,15 +193,24 @@ ...@@ -112,15 +193,24 @@
} }
#pragma mark - UITableView Delegate/DataSource #pragma mark - UITableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
return 1 + _annoDetail.attachmentUrls.count; if (section == 0) {
return 1;
} else {
return _attachmentArray.count;
}
} }
// cell显示的内容 // cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (indexPath.row == 0) { if (indexPath.section == 0) {
AnnoContentTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kAnnounceContentCell]; AnnoContentTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kAnnounceContentCell];
if (!cell) { if (!cell) {
cell = [[AnnoContentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAnnounceContentCell]; cell = [[AnnoContentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAnnounceContentCell];
...@@ -139,21 +229,34 @@ ...@@ -139,21 +229,34 @@
if (!cell) { if (!cell) {
cell = [[AttachmentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAttachmentTableViewCell]; cell = [[AttachmentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAttachmentTableViewCell];
} }
NSDictionary *dict = _annoDetail.attachmentUrls[indexPath.row - 1]; AttachmentModel *atta = _attachmentArray[indexPath.row];
NSString *name = dict[@"fileName"]; NSString *name = atta.fileName;
[cell.nameBtn setTitle:name forState:UIControlStateNormal]; [cell.nameBtn setTitle:name forState:UIControlStateNormal];
[cell.downloadBtn setTitle:@"下载" forState:UIControlStateNormal];
[cell.nameBtn addTarget:self action:@selector(showFile:) forControlEvents:UIControlEventTouchUpInside]; [cell.nameBtn addTarget:self action:@selector(showFile:) forControlEvents:UIControlEventTouchUpInside];
[cell.downloadBtn addTarget:self action:@selector(downloadFile:) forControlEvents:UIControlEventTouchUpInside]; [cell.downloadBtn addTarget:self action:@selector(downloadFile:) forControlEvents:UIControlEventTouchUpInside];
cell.downloadBtn.tag = 998473 + indexPath.row;
cell.nameBtn.tag = 998473 + indexPath.row;
return cell; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
} NSString *path = paths.lastObject;
NSString *url = [NSString stringWithFormat:@"%@/%@", path, atta.fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:url]) {
cell.downloadBtn.selected = YES;
cell.downloadBtn.backgroundColor = [UIColor grayColor];
} else {
cell.downloadBtn.selected = NO;
cell.downloadBtn.backgroundColor = [UIColor colorWithRed:47 / 255.0 green:209/ 255.0 blue:92 / 255.0 alpha:1.0];
}
return cell;
}
} }
- (UITableView *)tableView - (UITableView *)tableView
{ {
if (!_tableView) { if (!_tableView) {
...@@ -165,7 +268,6 @@ ...@@ -165,7 +268,6 @@
_tableView.rowHeight = UITableViewAutomaticDimension; _tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 100.0; _tableView.estimatedRowHeight = 100.0;
_tableView.tableHeaderView = self.headerView; _tableView.tableHeaderView = self.headerView;
_tableView.tableFooterView = self.footerView;
[_tableView registerClass:[AnnoContentTableViewCell class] forCellReuseIdentifier:kAnnounceContentCell]; [_tableView registerClass:[AnnoContentTableViewCell class] forCellReuseIdentifier:kAnnounceContentCell];
[_tableView registerClass:[AttachmentTableViewCell class] forCellReuseIdentifier:kAttachmentTableViewCell]; [_tableView registerClass:[AttachmentTableViewCell class] forCellReuseIdentifier:kAttachmentTableViewCell];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
...@@ -198,8 +300,7 @@ ...@@ -198,8 +300,7 @@
- (AnnounceDetailFootView *)footerView - (AnnounceDetailFootView *)footerView
{ {
if (!_footerView) { if (!_footerView) {
_footerView = [[AnnounceDetailFootView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 120)]; _footerView = [[AnnounceDetailFootView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 40)];
_footerView.backgroundColor = [UIColor whiteColor];
} }
return _footerView; return _footerView;
} }
......
...@@ -134,6 +134,8 @@ ...@@ -134,6 +134,8 @@
_praiseUuid = response[@"data"]; _praiseUuid = response[@"data"];
}]; }];
} }
_rowNumber++;
[self.tableView reloadData];
} else { } else {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(_rowNumber - 2) inSection:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:(_rowNumber - 2) inSection:0];
...@@ -143,6 +145,7 @@ ...@@ -143,6 +145,7 @@
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *http1 = [[HttpClient alloc] initWithUrl:url]; HttpClient *http1 = [[HttpClient alloc] initWithUrl:url];
if ((_imageNameArray.count == _rowNumber - 2) && cell.titleTextView.text.length != 0 ) {
NSString *imageName = _imageNameArray[_rowNumber - 3]; NSString *imageName = _imageNameArray[_rowNumber - 3];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName]; NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath]; UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
...@@ -156,9 +159,15 @@ ...@@ -156,9 +159,15 @@
[http1 upLoadPraisePictureWithParameters:parameters completion:^(id response, NSError *error) { [http1 upLoadPraisePictureWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"6.2上传口碑图片 resp = %@, error = %@", response, error); NSLog(@"6.2上传口碑图片 resp = %@, error = %@", response, error);
}]; }];
}
_rowNumber++; _rowNumber++;
[self.tableView reloadData]; [self.tableView reloadData];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"必须有图片和图片说明!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
} }
- (void)saveImage:(UIImage *)currentImage { - (void)saveImage:(UIImage *)currentImage {
...@@ -382,8 +391,6 @@ ...@@ -382,8 +391,6 @@
[cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside]; [cell.photoButton removeTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
[cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside]; [cell.photoButton addTarget:self action:@selector(showBigPic:) forControlEvents:UIControlEventTouchUpInside];
cell.titleTextView.userInteractionEnabled = NO; cell.titleTextView.userInteractionEnabled = NO;
} }
} }
cell.titleTextView.delegate = self; cell.titleTextView.delegate = self;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
[self.contentView addConstraint:titleRight]; [self.contentView addConstraint:titleRight];
// 高度 // 高度
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:150]; NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_bigImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:170];
[self.contentView addConstraint:titleHeight]; [self.contentView addConstraint:titleHeight];
} }
return _bigImageView; return _bigImageView;
......
...@@ -306,7 +306,6 @@ ...@@ -306,7 +306,6 @@
PicTextModel *picText = _picTextArray[indexPath.row]; PicTextModel *picText = _picTextArray[indexPath.row];
NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,picText.fileUrl]]; NSURL *imageUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", kRedStarURL ,picText.fileUrl]];
[cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]]; [cell.bigImageView sd_setImageWithURL:imageUrl placeholderImage:[UIImage imageNamed:@"default_pic"]];
cell.descriptionLabel.text = [NSString stringWithFormat:@"%@", picText.descriptionText]; cell.descriptionLabel.text = [NSString stringWithFormat:@"%@", picText.descriptionText];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; return cell;
...@@ -321,6 +320,31 @@ ...@@ -321,6 +320,31 @@
} }
} }
//裁剪图片
- (UIImage *)cutImage:(UIImage*)image
{
//压缩图片
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (((kScreenWidth - 20 * 3) / 2) / 90)) {
newSize.width = image.size.width;
newSize.height = image.size.width * 90 / ((kScreenWidth - 20 * 3) / 2);
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * ((kScreenWidth - 20 * 3) / 2) / 90;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
return [UIImage imageWithCGImage:imageRef];
}
// 自定义section // 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{ {
......
...@@ -11,10 +11,14 @@ ...@@ -11,10 +11,14 @@
#import "GroupItems.h" #import "GroupItems.h"
#import "SOPTableView.h" #import "SOPTableView.h"
#import "HttpClient.h" #import "HttpClient.h"
#import "AttachmentTableViewCell.h"
#import "AttachmentModel.h"
#define kAttachmentTableCell @"sopAttachmentCell"
#define SELECTED_VIEW_CONTROLLER_TAG 39998 #define SELECTED_VIEW_CONTROLLER_TAG 39998
@interface SOPViewController () <GroupTabBarDelegate, SOPTableViewDelegate> @interface SOPViewController () <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;
...@@ -33,6 +37,10 @@ ...@@ -33,6 +37,10 @@
@property (nonatomic, strong) UIButton *resetBtn; @property (nonatomic, strong) UIButton *resetBtn;
@property (nonatomic, strong) UIButton *queryBtn; @property (nonatomic, strong) UIButton *queryBtn;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *attachmentArray;
@end @end
...@@ -49,6 +57,8 @@ ...@@ -49,6 +57,8 @@
self.navigationController.navigationBar.translucent = NO; self.navigationController.navigationBar.translucent = NO;
} }
self.attachmentArray = [NSMutableArray array];
self.titleArray = [NSArray arrayWithObjects:@"质量管理",@"价格管理",@"现场服务",@"售后服务",@"环境管理",@"现场管理", @"400呼叫管理",@"单品管理",nil]; self.titleArray = [NSArray arrayWithObjects:@"质量管理",@"价格管理",@"现场服务",@"售后服务",@"环境管理",@"现场管理", @"400呼叫管理",@"单品管理",nil];
...@@ -79,16 +89,140 @@ ...@@ -79,16 +89,140 @@
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kGetAttachmentsURL]; NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kGetAttachmentsURL];
HttpClient *http = [[HttpClient alloc] initWithUrl:url]; HttpClient *http = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"type":@"sop", NSDictionary *parameters = @{@"type":@"sop",
// @"category1":_titleArray[_groupTabBar.selectNumber], @"encode":@"123"
// @"category2":_detailTitle
@"category1":@"11",
@"category2":@"22"
}; };
[http getAttachmentsWithParameters:parameters completion:^(id response, NSError *error) { [http getAttachmentsWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"7.1 口碑标注附件列表 = %@, error = %@", response, error); NSLog(@"7.1 口碑标注附件列表 = %@, error = %@", response, error);
NSArray *dataArray = response[@"data"];
for (NSDictionary *attaDict in dataArray) {
AttachmentModel *atta = [[AttachmentModel alloc] init];
[atta setValuesForKeysWithDictionary:attaDict];
[_attachmentArray addObject:atta];
}
CGFloat tableH = _attachmentArray.count * 45;
if (!_bgView) {
_bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
UITapGestureRecognizer *tapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeRedView)];
[_bgView addGestureRecognizer:tapGR];
}
CGRect toFrame = CGRectMake(0, 0, kScreenWidth - 50, tableH + 40);
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:toFrame style:UITableViewStyleGrouped];
_tableView.backgroundColor = [UIColor whiteColor];
}
_tableView.delegate = self;
_tableView.dataSource = self;
[self.view addSubview:_bgView];
[self.view insertSubview:_tableView aboveSubview:_bgView];
_bgView.alpha = 0;
_bgView.backgroundColor = [UIColor blackColor];
_tableView.alpha = 0.0;
_tableView.center = CGPointMake( _bgView.center.x, _bgView.center.y - 74);
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = 0.6;
_tableView.alpha = 1.0;
}];
}];
}
- (void)closeRedView
{
[UIView animateWithDuration:0.3 animations:^{
_bgView.alpha = .0f;
_tableView.alpha = 0.0;
} completion:^(BOOL finished) {
[_bgView removeFromSuperview];
[_tableView removeFromSuperview];
}];
}
- (void)showFile:(UIButton *)sender
{
NSInteger row = sender.tag - 998473;
AttachmentModel *atta = _attachmentArray[row];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject;
NSString *url = [NSString stringWithFormat:@"%@/%@", path, atta.fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:url]) {
UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:url]];//为该对象初始化一个加载路径
docController.delegate = self;//设置代理
[docController presentPreviewAnimated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"文件不存在,请先下载在查看!" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
}
}
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
- (void)downloadFile:(UIButton *)sender
{
NSInteger row = sender.tag - 998473;
AttachmentModel *atta = _attachmentArray[row];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject;
[self downloadFileURL:[NSString stringWithFormat:@"%@%@", kRedStarURL, atta.fileUrl] savePath:path fileName:atta.fileName];
}
- (void)downloadFileURL:(NSString *)aUrl savePath:(NSString *)aSavePath fileName:(NSString *)aFileName
{
NSFileManager *fileManager = [NSFileManager defaultManager];
//检查本地文件是否已存在
NSString *fileName = [NSString stringWithFormat:@"%@/%@", aSavePath, aFileName];
//检查附件是否存在
if ([fileManager fileExistsAtPath:fileName]) {
NSLog(@"存在了");
}else{
NSLog(@"不存在");
//创建附件存储目录
if (![fileManager fileExistsAtPath:aSavePath]) {
[fileManager createDirectoryAtPath:aSavePath withIntermediateDirectories:YES attributes:nil error:nil];
}
//下载附件
NSURL *url = [[NSURL alloc] initWithString:aUrl];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.inputStream = [NSInputStream inputStreamWithURL:url];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:fileName append:NO];
//下载进度控制
//已完成下载
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"下载成功");
[self.tableView reloadData];
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"下载失败");
}]; }];
[operation start];
}
} }
- (void)setupNav - (void)setupNav
{ {
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
...@@ -177,7 +311,68 @@ ...@@ -177,7 +311,68 @@
{ {
[self.navigationController dismissViewControllerAnimated:YES completion:nil]; [self.navigationController dismissViewControllerAnimated:YES completion:nil];
} }
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _attachmentArray.count;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
AttachmentTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kAttachmentTableCell];
if (!cell) {
cell = [[AttachmentTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAttachmentTableCell];
}
AttachmentModel *atta = _attachmentArray[indexPath.row];
NSString *name = atta.fileName;
[cell.nameBtn setTitle:name forState:UIControlStateNormal];
[cell.nameBtn addTarget:self action:@selector(showFile:) forControlEvents:UIControlEventTouchUpInside];
[cell.downloadBtn addTarget:self action:@selector(downloadFile:) forControlEvents:UIControlEventTouchUpInside];
cell.downloadBtn.tag = 998473 + indexPath.row;
cell.nameBtn.tag = 998473 + indexPath.row;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = paths.lastObject;
NSString *url = [NSString stringWithFormat:@"%@/%@", path, atta.fileName];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:url]) {
cell.downloadBtn.selected = YES;
cell.downloadBtn.backgroundColor = [UIColor grayColor];
} else {
cell.downloadBtn.selected = NO;
cell.downloadBtn.backgroundColor = [UIColor colorWithRed:47 / 255.0 green:209/ 255.0 blue:92 / 255.0 alpha:1.0];
}
return cell;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 40)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, kScreenWidth - 20, 40)];
label.text = @"附件";
label.textColor = kNavigationBarColor;
label.font = [UIFont systemFontOfSize:14.0];
[view addSubview:label];
return view;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40;
}
#pragma mark - SOPTableViewDelegate #pragma mark - SOPTableViewDelegate
- (void)selectRowWithDetailTitle:(NSString *)detailTitle - (void)selectRowWithDetailTitle:(NSString *)detailTitle
......
...@@ -116,7 +116,6 @@ ...@@ -116,7 +116,6 @@
- (void)requestMoreList - (void)requestMoreList
{ {
_page++; _page++;
NSLog(@"_page = %d", (int)_page);
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL]; NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url]; HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{ NSDictionary *parameters = @{
......
...@@ -49,14 +49,17 @@ ...@@ -49,14 +49,17 @@
#import <MJRefresh.h> #import <MJRefresh.h>
#import "SearchViewController.h" #import "SearchViewController.h"
#import "PicCategoryViewController.h"
@interface SearchViewController ()<UITableViewDelegate, UITableViewDataSource> @interface SearchViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *titleArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *sectionArray; // section标题
@property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *allRankListArray; @property (nonatomic, strong) NSMutableArray *allRankListArray;
@property (nonatomic, strong) NSMutableArray *allPraiseListArray;
@end @end
@implementation SearchViewController @implementation SearchViewController
...@@ -64,9 +67,7 @@ ...@@ -64,9 +67,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
//NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"]; self.sectionArray = [NSMutableArray array];
NSArray *titleArray = [NSArray arrayWithObjects:@"口碑巡检",@"口碑报告",@"问题知识", nil];
self.titleArray = [NSMutableArray arrayWithArray:titleArray];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)]; UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
[customLab setTextColor:[UIColor whiteColor]]; [customLab setTextColor:[UIColor whiteColor]];
...@@ -90,30 +91,34 @@ ...@@ -90,30 +91,34 @@
} }
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; [MBProgressHUD showHUDAddedTo:self.view animated:YES];
if ([self.titleArray containsObject:@"口碑巡检"]) {
self.taskListDataArray = [NSMutableArray array];
if (_taskListDataArray.count == 0) {
[_titleArray removeObject:@"口碑巡检"];
}
[self requestAllTaskList];
NSArray *permissions = [[NSUserDefaults standardUserDefaults] objectForKey:@"permissions"];
// 口碑报告 商场风采 图说口碑 口碑标准 问题知识 口碑巡检
if ([permissions containsObject:@"500201"]) {
[self requestRankingList];
} }
if ([self.titleArray containsObject:@"口碑报告"]) { [self requestPicturePraise];
self.allRankListArray = [NSMutableArray array];
if (_allRankListArray.count == 0) {
[_titleArray removeObject:@"口碑报告"];
if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) {
[self requestQuestionList];
} }
[self requestAllRankList];
if ([permissions containsObject:@"500101"] || [permissions containsObject:@"500102"]) {
[self requestInspectList];
} }
if ([self.titleArray containsObject:@"问题知识"]) { self.allRankListArray = [NSMutableArray array];
self.taskListDataArray = [NSMutableArray array];
self.allQuestionArray = [NSMutableArray array]; self.allQuestionArray = [NSMutableArray array];
if (_allRankListArray.count == 0) { self.allPraiseListArray = [NSMutableArray array];
[_titleArray removeObject:@"问题知识"];
}
[self requestAllQuestion];
}
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
...@@ -134,105 +139,67 @@ ...@@ -134,105 +139,67 @@
// 更多按钮点击事件 // 更多按钮点击事件
- (void)moreButtonClick:(UIButton *)sender - (void)moreButtonClick:(UIButton *)sender
{ {
NSInteger section = sender.tag - 332892;
if (_titleArray.count == 5) {
UIButton *button = (UIButton *)sender;
UINavigationController *nav; UINavigationController *nav;
if ([_sectionArray[section] isEqualToString:@"在线抽查"]) {
if (button.tag - 332892 == 0) { SpotCheckOnLineViewController *spotOnline = [[SpotCheckOnLineViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:spotOnline];
} else if ([_sectionArray[section] isEqualToString:@"口碑巡检"]) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init]; InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC]; nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else { } else if ([_sectionArray[section] isEqualToString:@"口碑标准"]) {
StandardViewController *standardVC = [[StandardViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:standardVC];
} else if ([_sectionArray[section] isEqualToString:@"图说口碑"]) {
PicCategoryViewController *pictureVC = [[PicCategoryViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:pictureVC];
} else if ([_sectionArray[section] isEqualToString:@"问题知识"]) {
QuestionViewController *questionVC = [[QuestionViewController alloc] init]; QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC]; nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} } else if ([_sectionArray[section] isEqualToString:@"口碑报告"]){
[nav.navigationBar setBarTintColor:kNavigationBarColor];
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil];
} else {
UIButton *button = (UIButton *)sender;
UINavigationController *nav;
if (button.tag - 332892 == 0) {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
} else if (button.tag - 332892 == 1) {
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init]; RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC]; nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else if ([_sectionArray[section] isEqualToString:@"查看抽查"]){
} else { LookOnLineViewController *lookOnLine = [[LookOnLineViewController alloc] init];
QuestionViewController *questionVC = [[QuestionViewController alloc] init]; nav = [[UINavigationController alloc] initWithRootViewController:lookOnLine];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC]; } else if ([_sectionArray[section] isEqualToString:@"商场风采"]) {
PictureViewController *pic = [[PictureViewController alloc] init];
pic.come = @"首页";
pic.category = @"store";
nav = [[UINavigationController alloc] initWithRootViewController:pic];
} }
[nav.navigationBar setBarTintColor:kNavigationBarColor]; [nav.navigationBar setBarTintColor:kNavigationBarColor];
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]]; [nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil]; [self presentViewController:nav animated:YES completion:nil];
}
} }
- (void)requestAllTaskList #pragma mark - 请求数据
- (void)requestRankingList
{ {
NSString *url3 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL]; NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
HttpClient *httpCilent3 = [[HttpClient alloc] initWithUrl:url3]; HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters3 = @{ NSDictionary *parameters = @{@"keyword":self.customStr,
@"keyword":self.customStr, @"praiseUuid":@"",
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"], @"statisMode":@(0),
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
[httpCilent3 getInspectListWithParameters:parameters3 completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response); [httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑报告response = %@", response);
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *inspectTempArr = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[inspectTempArr addObject:taskList];
}
_taskListDataArray = inspectTempArr;
if (_taskListDataArray.count != 0) { NSMutableArray *tgArray = [NSMutableArray array];
if (![_titleArray containsObject:@"口碑巡检"]) {
[_titleArray addObject:@"口碑巡检"];
}
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestAllRankList
{
NSString *url1 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kRankingListURL];
HttpClient *httpCilent1 = [[HttpClient alloc] initWithUrl:url1];
NSDictionary *parameters1 = @{
@"praiseUuid":@"5a7417015157efa6015158f52be8004e",
@"statisMode":@(0),
@"keyword":self.customStr
};
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"口碑报告response = %@", response);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSArray *dataArray = response[@"data"];
NSMutableArray *rankTempArr = [NSMutableArray array];
for (NSDictionary *ListDict in dataArray) { for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict]; RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[rankTempArr addObject:rankList]; [tgArray addObject:rankList];
} }
_allRankListArray = (NSMutableArray *)[self sortRankListWithRankListArray:rankTempArr]; _allRankListArray = (NSMutableArray *)[self sortRankListWithRankListArray:tgArray];
for (int i = 0 ; i < _allRankListArray.count; i++) { for (int i = 0 ; i < _allRankListArray.count; i++) {
RankListModel *rank = _allRankListArray[i]; RankListModel *rank = _allRankListArray[i];
...@@ -243,61 +210,135 @@ ...@@ -243,61 +210,135 @@
rank.index = rank.score == prevRank.score ? prevRank.index: i + 1; rank.index = rank.score == prevRank.score ? prevRank.index: i + 1;
} }
} }
if (_allRankListArray.count != 0) { if (_allRankListArray.count != 0) {
if (![_titleArray containsObject:@"口碑报告"]) { [_sectionArray addObject:@"口碑报告"];
[_titleArray addObject:@"口碑报告"];
} }
}
[self.tableView reloadData]; [self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}];
} }
- (NSArray *)sortRankListWithRankListArray:(NSMutableArray *)allRanking - (NSArray *)sortRankListWithRankListArray:(NSMutableArray *)allRanking
{ {
NSArray *sortedArray = [allRanking sortedArrayUsingComparator:^NSComparisonResult(RankListModel *p1, RankListModel *p2){ NSArray *sortedArray = [allRanking sortedArrayUsingComparator:^NSComparisonResult(RankListModel *p1, RankListModel *p2){
// return [p2.score compare:p1.score]; //return [p2.score compare:p1.score];
return [@(p2.score) compare:@(p1.score)]; return [@(p2.score) compare:@(p1.score)];
}]; }];
return sortedArray; return sortedArray;
} }
- (void)requestAllQuestion
- (void)requestInspectList
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
NSLog(@"uuuurl = %@", url);
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"keyword":self.customStr,
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":@[@{@"field":@"lastModifyInfo", @"direction":@"desc"}],
@"pageNumber":@(0),
@"pageSize":@(10)
};
NSLog(@"parrrrr = %@", parameters);
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSLog(@"error = %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
}
if (_taskListDataArray.count != 0) {
[_sectionArray addObject:@"口碑巡检"];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestQuestionList
{ {
NSString *url2 = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL]; // 初始化数组
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQuestionListURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"]; NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters2 = @{ // 请求参数
@"keyword":self.customStr, NSDictionary *parameters = @{@"keyword":self.customStr,
@"user":user_uuid, @"user":user_uuid,
@"scope":@"all", @"scope":@"all",
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(10) @"pageSize":@(10)
}; };
__block SearchViewController *weakSelf = self; // 发起请求
HttpClient *httpClient2 = [[HttpClient alloc] initWithUrl:url2]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[httpClient2 getQuestionListWithParameters:parameters2 completion:^(id response, NSError *error) { //
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"]; NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"]; NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response); NSLog(@"问题与知识列表recods = %@", response);
NSLog(@"error = %@", error);
NSMutableArray *questionTempArr = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) { for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init]; QuestionModel *question = [[QuestionModel alloc] init];
[question setValuesForKeysWithDictionary:questionDict]; [question setValuesForKeysWithDictionary:questionDict];
[questionTempArr addObject:question]; [_allQuestionArray addObject:question];
}
if (_allQuestionArray.count != 0) {
[_sectionArray addObject:@"问题知识"];
} }
[self.tableView reloadData];
weakSelf.allQuestionArray = questionTempArr; [MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
if (_allQuestionArray.count != 0) { - (void)requestPicturePraise
if (![_titleArray containsObject:@"问题知识"]) { {
[_titleArray addObject:@"问题知识"];
// 请求地址
NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRedStarURL, kQueryPicturePraiseURL];
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{
@"keyword":self.customStr,
@"scope":@"all",
@"user":user_uuid,
@"type":@"store",
@"pageNumber":@(0),
@"pageSize":@(10)
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"图说口碑 response = %@ error = %@" , response, error);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
PictureListModel *picList = [[PictureListModel alloc] init];
[picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList];
} }
_allPraiseListArray = tempArray;
if (_allPraiseListArray.count != 0) {
[_sectionArray addObject:@"商场风采"];
} }
[self.tableView reloadData]; [self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
...@@ -305,7 +346,6 @@ ...@@ -305,7 +346,6 @@
} }
// 返回上一页面 // 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender - (void)doBack:(UIBarButtonItem *)sender
{ {
...@@ -313,39 +353,44 @@ ...@@ -313,39 +353,44 @@
} }
#pragma mark - TableView Delegate/DataSource
#pragma mark - TableView Delegate/DataSource #pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
return _titleArray.count; return _sectionArray.count;
} }
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
NSUInteger s1 = [_titleArray indexOfObject:@"口碑巡检"]; NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s2 = [_titleArray indexOfObject:@"口碑报告"]; NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_titleArray indexOfObject:@"问题知识"]; NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
if ([_titleArray[section] isEqualToString:@"口碑巡检"] && section == s1) { NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
return _taskListDataArray.count; return _taskListDataArray.count;
} else if ([_titleArray[section] isEqualToString:@"口碑报告"] && section == s2) { } else if ([_sectionArray[section] isEqualToString:@"口碑报告"] && section == s2) {
return _allRankListArray.count + 1; return _allRankListArray.count + 1;
} else if ([_titleArray[section] isEqualToString:@"问题知识"] && section == s3) { } else if ([_sectionArray[section] isEqualToString:@"问题知识"] && section == s3) {
return _allQuestionArray.count; return _allQuestionArray.count;
} else if ([_sectionArray[section] isEqualToString:@"商场风采"] && section == s4) {
return _allPraiseListArray.count;
} else { } else {
return 0; return 0;
} }
} }
// cell显示的内容 // cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s1 = [_titleArray indexOfObject:@"口碑巡检"]; if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
NSUInteger s2 = [_titleArray indexOfObject:@"口碑报告"];
NSUInteger s3 = [_titleArray indexOfObject:@"问题知识"];
if ([_titleArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell]; InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
if (!cell) { if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell]; cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
...@@ -358,7 +403,7 @@ ...@@ -358,7 +403,7 @@
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image; cell.alreadyView.image = image;
return cell; return cell;
} else if ([_titleArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) { } else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
if (indexPath.row == 0) { if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell]; HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) { if (!cell) {
...@@ -373,11 +418,11 @@ ...@@ -373,11 +418,11 @@
} }
RankListModel *rankList = _allRankListArray[indexPath.row - 1]; RankListModel *rankList = _allRankListArray[indexPath.row - 1];
cell.rankList = rankList; cell.rankList = rankList;
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index]]; cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index+ 1]];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; return cell;
} }
} else if ([_titleArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) { } else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
// 问题与知识 // 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell]; QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) { if (!cell) {
...@@ -387,33 +432,30 @@ ...@@ -387,33 +432,30 @@
QuestionModel *question = _allQuestionArray[indexPath.row]; QuestionModel *question = _allQuestionArray[indexPath.row];
cell.question = question; cell.question = question;
return cell; return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"商场风采"] && indexPath.section == s4) {
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomePictureListCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomePictureListCell];
}
cell.pictureList = _allPraiseListArray[indexPath.row];
return cell;
} else { } else {
return nil; return nil;
} }
} }
// cell点击事件 // cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (_titleArray.count == 5) { NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
if (indexPath.section == 0) { NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
TaskListModel *taskList = self.taskListDataArray[indexPath.row]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
inspectTaskVC.uuid = taskList.uuid; if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
inspectTaskVC.store_uuid = taskList.store_uuid;
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES];
} else {
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
QuestionModel *question = self.allQuestionArray[indexPath.row];
questionDetailVC.questionUuid = question.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionDetailVC animated:YES];
}
} else {
if (indexPath.section == 0) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row]; TaskListModel *taskList = self.taskListDataArray[indexPath.row];
inspectTaskVC.uuid = taskList.uuid; inspectTaskVC.uuid = taskList.uuid;
...@@ -421,34 +463,33 @@ ...@@ -421,34 +463,33 @@
inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ; inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES]; [self.navigationController pushViewController:inspectTaskVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
} else if (indexPath.section == 1) {
if (indexPath.row == 0) { if (indexPath.row == 0) {
NSLog(@"不能点击"); return;
} else { }
RankListModel *rankList = _allRankListArray[indexPath.row - 1]; RankListModel *rankList = _allRankListArray[indexPath.row - 1];
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init]; RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
rankDetailVC.indexRow = indexPath.section - 2; rankDetailVC.indexRow = rankList.index;
rankDetailVC.uuid = rankList.uuid; rankDetailVC.uuid = rankList.uuid;
rankDetailVC.store_uuid = rankList.store_uuid; rankDetailVC.store_uuid = rankList.store_uuid;
rankDetailVC.storeAddress = rankList.storeAddress; rankDetailVC.storeAddress = rankList.storeAddress;
rankDetailVC.storePictures = rankList.storePictures; rankDetailVC.storePictures = rankList.storePictures;
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:rankDetailVC animated:YES]; [self.navigationController pushViewController:rankDetailVC animated:YES];
} } else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
} else {
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init]; QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
QuestionModel *question = self.allQuestionArray[indexPath.row]; QuestionModel *question = self.allQuestionArray[indexPath.row];
questionDetailVC.questionUuid = question.uuid; questionDetailVC.questionUuid = question.uuid;
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionDetailVC animated:YES]; [self.navigationController pushViewController:questionDetailVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"商场风采"] && indexPath.section == s4) {
PictureListModel *picList = _allPraiseListArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
} storyVC.uuid = picList.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES];
} else {
return;
} }
} }
...@@ -495,7 +536,7 @@ ...@@ -495,7 +536,7 @@
titleLabel.translatesAutoresizingMaskIntoConstraints = NO; titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textColor = kPictureCellDetailsColor; titleLabel.textColor = kPictureCellDetailsColor;
titleLabel.font = [UIFont systemFontOfSize:17.0]; titleLabel.font = [UIFont systemFontOfSize:17.0];
titleLabel.text = _titleArray[section]; titleLabel.text = _sectionArray[section];
[sectionView addSubview:titleLabel]; [sectionView addSubview:titleLabel];
......
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