Commit e9bb3198 authored by admin's avatar admin

首页及首页搜索完善 添加在线抽查

parent bd40f854
...@@ -51,7 +51,9 @@ ...@@ -51,7 +51,9 @@
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = NO;
self.tabBarController.tabBar.hidden = YES;
} }
#pragma mark - Private Mothods #pragma mark - Private Mothods
......
...@@ -26,7 +26,13 @@ ...@@ -26,7 +26,13 @@
@end @end
@implementation OnLineCompleteViewController @implementation OnLineCompleteViewController
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.navigationController.navigationBar.hidden = NO;
self.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad]; [super viewDidLoad];
......
...@@ -129,7 +129,8 @@ ...@@ -129,7 +129,8 @@
[spot setValuesForKeysWithDictionary:dict]; [spot setValuesForKeysWithDictionary:dict];
[tempArray addObject:spot]; [tempArray addObject:spot];
} }
[_allSpotCheckList addObjectsFromArray:tempArray]; _allSpotCheckList = [NSMutableArray arrayWithArray:tempArray];
// [_allSpotCheckList addObjectsFromArray:tempArray];
if (_allSpotCheckList.count == 0) { if (_allSpotCheckList.count == 0) {
if (_tableView) { if (_tableView) {
......
...@@ -50,6 +50,16 @@ ...@@ -50,6 +50,16 @@
#import "LookOnLineViewController.h" #import "LookOnLineViewController.h"
#import "StandardViewController.h" #import "StandardViewController.h"
#import "LookOnLineModel.h"
#import "LookOnLineTableViewCell.h"
#define kHomeLookOnLineCell @"homeLookOnLineTableViewCell.h"
#import "SpotCheckModel.h"
#import "SpotCheckTableViewCell.h"
#define kHomeSpotCehcekCell @"homeSpotCheckCell"
#import "OnLineCompleteViewController.h"
#import "LookOnLineDetailViewController.h"
#import "HttpClient.h" #import "HttpClient.h"
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
...@@ -79,6 +89,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -79,6 +89,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
@property (nonatomic, strong) NSMutableArray *allPraiseListArray; @property (nonatomic, strong) NSMutableArray *allPraiseListArray;
@property (nonatomic, strong) NSMutableArray *allExcellentCaseArray; // 优秀案例 @property (nonatomic, strong) NSMutableArray *allExcellentCaseArray; // 优秀案例
@property (nonatomic, strong) NSMutableArray *allPatrolReportArray; // 巡店报告 @property (nonatomic, strong) NSMutableArray *allPatrolReportArray; // 巡店报告
@property (nonatomic, strong) NSMutableArray *allLookOnLineList; //
@property (nonatomic, strong) NSMutableArray *allSpotCheckList; //
@end @end
...@@ -97,11 +109,13 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -97,11 +109,13 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
self.navigationItem.titleView = customLab; self.navigationItem.titleView = customLab;
self.titleArray = [NSMutableArray array]; self.titleArray = [NSMutableArray array];
self.sectionArray = [NSMutableArray arrayWithObjects:@"口碑报告",@"商场风采",@"优秀案例",@"巡店报告", @"问题知识",@"口碑巡检",nil]; self.sectionArray = [NSMutableArray arrayWithObjects:@"口碑报告",@"商场风采",@"优秀案例",@"巡店报告", @"问题知识",@"口碑巡检",@"在线抽查", @"查看抽查",nil];
self.allRankListArray = [NSMutableArray array]; self.allRankListArray = [NSMutableArray array];
self.taskListDataArray = [NSMutableArray array]; self.taskListDataArray = [NSMutableArray array];
self.allQuestionArray = [NSMutableArray array]; self.allQuestionArray = [NSMutableArray array];
self.allPraiseListArray = [NSMutableArray array]; self.allPraiseListArray = [NSMutableArray array];
self.allSpotCheckList = [NSMutableArray array];
self.allLookOnLineList = [NSMutableArray array];
[self setupNav]; [self setupNav];
...@@ -117,10 +131,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -117,10 +131,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[_sectionArray removeObject:@"口碑报告"]; [_sectionArray removeObject:@"口碑报告"];
} }
// @"casus";
//
// sopVC.category = @"report";
[self.titleArray addObject:@"商场风采"]; [self.titleArray addObject:@"商场风采"];
NSArray *typeArray = [NSArray arrayWithObjects:@"store", @"casus",@"report",nil]; NSArray *typeArray = [NSArray arrayWithObjects:@"store", @"casus",@"report",nil];
...@@ -155,6 +165,16 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -155,6 +165,16 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[_sectionArray removeObject:@"口碑巡检"]; [_sectionArray removeObject:@"口碑巡检"];
} }
if ([permissions containsObject:@"500701"]) {
[self.titleArray addObject:@"在线抽查"];
[self requestSpotCheckList];
}
if ([permissions containsObject:@"500702"]) {
[self.titleArray addObject:@"查看抽查"];
[self requestLookOnLineList];
}
[self setupTableView]; [self setupTableView];
...@@ -176,12 +196,21 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -176,12 +196,21 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
- (void)viewWillAppear:(BOOL)animated - (void)viewWillAppear:(BOOL)animated
{ {
[super viewWillAppear:animated]; [super viewWillAppear:animated];
self.hidesBottomBarWhenPushed = NO;
self.tabBarController.tabBar.hidden = NO; self.tabBarController.tabBar.hidden = NO;
self.navigationController.navigationBar.hidden = YES; self.navigationController.navigationBar.hidden = YES;
[self.tableView.header beginRefreshing]; [self.tableView.header beginRefreshing];
} }
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[self.tabBarController.tabBar setHidden:NO];
}
#pragma mark - 刷新数据 #pragma mark - 刷新数据
- (void)refreshAllData - (void)refreshAllData
{ {
...@@ -189,6 +218,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -189,6 +218,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[self refreshRankingList]; [self refreshRankingList];
[self refreshQuestionList]; [self refreshQuestionList];
[self refreshPraiseList]; [self refreshPraiseList];
[self refreshSpotCheckList];
[self requestLookOnLineList];
} }
- (void)refreshPraiseList - (void)refreshPraiseList
...@@ -242,7 +273,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -242,7 +273,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}; };
[httpCilent3 getInspectListWithParameters:parameters3 completion:^(id response, NSError *error) { [httpCilent3 getInspectListWithParameters:parameters3 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 巡检列表%@", response);
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *inspectTempArr = [NSMutableArray array]; NSMutableArray *inspectTempArr = [NSMutableArray array];
...@@ -271,8 +301,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -271,8 +301,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}; };
__block HomeViewController *weakSelf = self; __block HomeViewController *weakSelf = self;
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) { [httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 口碑报告response = %@", response);
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
...@@ -318,11 +346,78 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -318,11 +346,78 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[self.tableView reloadData]; [self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
[self.tableView.header endRefreshing];
}]; }];
} }
- (void)refreshSpotCheckList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kManageSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"pageNumber":@(0),
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getManageSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"管理层的抽查列表 response= %@", response);
NSLog(@"管理层的抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
SpotCheckModel *spot = [[SpotCheckModel alloc] init];
[spot setValuesForKeysWithDictionary:dict];
[tempArray addObject:spot];
}
_allSpotCheckList = [NSMutableArray arrayWithArray:tempArray];
[self.tableView.header endRefreshing];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)refreshLookOnLineList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kStoreSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"pageNumber":@(0),
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getStoreSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"获取 商场 抽查列表 response= %@", response);
NSLog(@"获取 商场 抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
LookOnLineModel *lookOnline = [[LookOnLineModel alloc] init];
[lookOnline setValuesForKeysWithDictionary:dict];
[tempArray addObject:lookOnline];
}
_allLookOnLineList = [NSMutableArray arrayWithArray:tempArray];
[self.tableView.header endRefreshing];
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
#pragma mark - 请求数据 #pragma mark - 请求数据
- (void)requestRankingList - (void)requestRankingList
{ {
...@@ -337,12 +432,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -337,12 +432,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) { [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 *tgArray = [NSMutableArray array]; NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *ListDict in dataArray) { for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict]; RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[tgArray addObject:rankList]; [tgArray addObject:rankList];
...@@ -372,7 +464,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -372,7 +464,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
- (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)];
}]; }];
...@@ -396,8 +487,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -396,8 +487,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}; };
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) { [httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSLog(@"error = %@", error);
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
...@@ -435,13 +524,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -435,13 +524,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// 请求问题列表 // 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) { [httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
// [self requestInspectList];
NSDictionary *dataDict = (NSDictionary *)response[@"data"]; NSDictionary *dataDict = (NSDictionary *)response[@"data"];
NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"]; NSDictionary *recordsDict = (NSDictionary *)dataDict[@"records"];
NSLog(@"问题与知识列表recods = %@", response);
NSLog(@"error = %@", error);
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *questionDict in recordsDict) { for (NSDictionary *questionDict in recordsDict) {
QuestionModel *question = [[QuestionModel alloc] init]; QuestionModel *question = [[QuestionModel alloc] init];
...@@ -479,7 +563,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -479,7 +563,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
// 请求问题列表 // 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) { [httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
// [self requestQuestionList];
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
...@@ -507,11 +590,80 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -507,11 +590,80 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
} }
[self.tableView reloadData]; [self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}]; }];
} }
- (void)requestSpotCheckList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kManageSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"pageNumber":@(0),
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getManageSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"管理层的抽查列表 response= %@", response);
NSLog(@"管理层的抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
SpotCheckModel *spot = [[SpotCheckModel alloc] init];
[spot setValuesForKeysWithDictionary:dict];
[tempArray addObject:spot];
}
_allSpotCheckList = [NSMutableArray arrayWithArray:tempArray];
if (_allSpotCheckList.count == 0) {
[_sectionArray removeObject:@"在线抽查"];
}
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
}];
}
- (void)requestLookOnLineList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kStoreSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"pageNumber":@(0),
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getStoreSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"获取 商场 抽查列表 response= %@", response);
NSLog(@"获取 商场 抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
LookOnLineModel *lookOnline = [[LookOnLineModel alloc] init];
[lookOnline setValuesForKeysWithDictionary:dict];
[tempArray addObject:lookOnline];
}
_allLookOnLineList = [NSMutableArray arrayWithArray:tempArray];
if (_allLookOnLineList.count == 0) {
[_sectionArray removeObject:@"查看抽查"];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
#pragma mark - Private Methods #pragma mark - Private Methods
- (void)setupNav - (void)setupNav
...@@ -667,7 +819,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -667,7 +819,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"]; NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"]; NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) { if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
return _taskListDataArray.count; return _taskListDataArray.count;
...@@ -681,6 +834,10 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -681,6 +834,10 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
return _allExcellentCaseArray.count; return _allExcellentCaseArray.count;
} else if ([_sectionArray[section] isEqualToString:@"巡店报告"] && section == s6) { } else if ([_sectionArray[section] isEqualToString:@"巡店报告"] && section == s6) {
return _allPatrolReportArray.count; return _allPatrolReportArray.count;
} else if ([_sectionArray[section] isEqualToString:@"在线抽查"] && section == s7) {
return _allSpotCheckList.count;
} else if ([_sectionArray[section] isEqualToString:@"查看抽查"] && section == s8) {
return _allLookOnLineList.count;
} else { } else {
return 0; return 0;
} }
...@@ -696,6 +853,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -696,6 +853,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"]; NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"]; NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) { if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell]; InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
...@@ -769,7 +928,25 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -769,7 +928,25 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
} }
cell.pictureList = _allPatrolReportArray[indexPath.row]; cell.pictureList = _allPatrolReportArray[indexPath.row];
return cell; return cell;
} else { } else if ([_sectionArray[indexPath.section] isEqualToString:@"在线抽查"] && indexPath.section == s7) {
SpotCheckTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeSpotCehcekCell];
if (!cell) {
cell = [[SpotCheckTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeSpotCehcekCell];
}
cell.spotCheck = _allSpotCheckList[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"查看抽查"] && indexPath.section == s8) {
LookOnLineTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeLookOnLineCell];
if (!cell) {
cell = [[LookOnLineTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeLookOnLineCell];
}
cell.lookOnLine = _allLookOnLineList[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
return nil; return nil;
} }
...@@ -787,6 +964,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -787,6 +964,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"]; NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"]; NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) { if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row]; TaskListModel *taskList = self.taskListDataArray[indexPath.row];
...@@ -836,7 +1015,19 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -836,7 +1015,19 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
storyVC.titleStr = @"巡店报告"; storyVC.titleStr = @"巡店报告";
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES]; [self.navigationController pushViewController:storyVC animated:YES];
} else { } else if ([_sectionArray[indexPath.section] isEqualToString:@"在线抽查"] && indexPath.section == s7) {
SpotCheckModel *spot = _allSpotCheckList[indexPath.row];
OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init];
completeVC.uuid = spot.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:completeVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"查看抽查"] && indexPath.section == s8) {
LookOnLineModel *lookOnLine = _allLookOnLineList[indexPath.row];
LookOnLineDetailViewController *lookDetailVC = [[LookOnLineDetailViewController alloc] init];
lookDetailVC.lookOnLine = lookOnLine;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:lookDetailVC animated:YES];
} else {
return; return;
} }
} }
...@@ -1084,6 +1275,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); ...@@ -1084,6 +1275,8 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell]; [_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell];
[_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kHomeRankingListCell]; [_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kHomeRankingListCell];
[_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell]; [_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell];
[_tableView registerClass:[SpotCheckTableViewCell class] forCellReuseIdentifier:kHomeSpotCehcekCell];
[_tableView registerClass:[LookOnLineTableViewCell class] forCellReuseIdentifier:kHomeLookOnLineCell];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
......
...@@ -52,6 +52,18 @@ ...@@ -52,6 +52,18 @@
#import "SearchViewController.h" #import "SearchViewController.h"
#import "PicCategoryViewController.h" #import "PicCategoryViewController.h"
#import "LookOnLineModel.h"
#import "LookOnLineTableViewCell.h"
#define kSearchLookOnLineCell @"searchLookOnLineTableViewCell.h"
#import "SpotCheckModel.h"
#import "SpotCheckTableViewCell.h"
#define kSearchSpotCehcekCell @"searchSpotCheckCell"
#import "OnLineCompleteViewController.h"
#import "LookOnLineDetailViewController.h"
@interface SearchViewController ()<UITableViewDelegate, UITableViewDataSource> @interface SearchViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
...@@ -60,6 +72,11 @@ ...@@ -60,6 +72,11 @@
@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; @property (nonatomic, strong) NSMutableArray *allPraiseListArray;
@property (nonatomic, strong) NSMutableArray *allExcellentCaseArray; // 优秀案例
@property (nonatomic, strong) NSMutableArray *allPatrolReportArray; // 巡店报告
@property (nonatomic, strong) NSMutableArray *allLookOnLineList; //
@property (nonatomic, strong) NSMutableArray *allSpotCheckList; //
@property (nonatomic, strong) NoDataView *noDataView; @property (nonatomic, strong) NoDataView *noDataView;
@end @end
...@@ -71,7 +88,7 @@ ...@@ -71,7 +88,7 @@
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.sectionArray = [NSMutableArray arrayWithObjects:@"口碑报告",@"商场风采", @"问题知识",@"口碑巡检",nil]; self.sectionArray = [NSMutableArray arrayWithObjects:@"口碑报告",@"商场风采",@"优秀案例",@"巡店报告", @"问题知识",@"口碑巡检",@"在线抽查", @"查看抽查",nil];
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]];
...@@ -108,7 +125,15 @@ ...@@ -108,7 +125,15 @@
[_sectionArray removeObject:@"口碑报告"]; [_sectionArray removeObject:@"口碑报告"];
} }
[self requestPicturePraise]; NSArray *typeArray = [NSArray arrayWithObjects:@"store", @"casus",@"report",nil];
// 商场风采
[self requestPicturePraiseWithType:typeArray[0]];
// 优秀案例
[self requestPicturePraiseWithType:typeArray[1]];
// 巡店报告
[self requestPicturePraiseWithType:typeArray[2]];
if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) { if ([permissions containsObject:@"500501"] || [permissions containsObject:@"500502"]) {
[self requestQuestionList]; [self requestQuestionList];
...@@ -122,12 +147,26 @@ ...@@ -122,12 +147,26 @@
[_sectionArray removeObject:@"口碑巡检"]; [_sectionArray removeObject:@"口碑巡检"];
} }
if ([permissions containsObject:@"500701"]) {
[self requestSpotCheckList];
} else {
[_sectionArray removeObject:@"在线抽查"];
}
if ([permissions containsObject:@"500702"]) {
[self requestLookOnLineList];
} else {
[_sectionArray removeObject:@"查看抽查"];
}
self.allRankListArray = [NSMutableArray array]; self.allRankListArray = [NSMutableArray array];
self.taskListDataArray = [NSMutableArray array]; self.taskListDataArray = [NSMutableArray array];
self.allQuestionArray = [NSMutableArray array]; self.allQuestionArray = [NSMutableArray array];
self.allPraiseListArray = [NSMutableArray array]; self.allPraiseListArray = [NSMutableArray array];
self.allExcellentCaseArray = [NSMutableArray array]; // 优秀案例
self.allPatrolReportArray = [NSMutableArray array]; // 优秀案例
self.allLookOnLineList = [NSMutableArray array]; // 优秀案例
self.allSpotCheckList = [NSMutableArray array]; // 优秀案例
} }
- (void)didReceiveMemoryWarning { - (void)didReceiveMemoryWarning {
...@@ -537,7 +576,8 @@ ...@@ -537,7 +576,8 @@
}]; }];
} }
- (void)requestPicturePraise
- (void)requestPicturePraiseWithType:(NSString *)type
{ {
// 请求地址 // 请求地址
...@@ -546,11 +586,12 @@ ...@@ -546,11 +586,12 @@
NSDictionary *parameters = @{ NSDictionary *parameters = @{
@"scope":@"all", @"scope":@"all",
@"user":user_uuid, @"user":user_uuid,
@"type":@"store", @"type":type,
@"keyword":self.customStr, @"keyword":self.customStr,
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(2) @"pageSize":@(2)
}; };
// 发起请求 // 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr]; HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
...@@ -558,7 +599,6 @@ ...@@ -558,7 +599,6 @@
// 请求问题列表 // 请求问题列表
[httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) { [httpClient queryPicturePraiseWithParameters:parameters completion:^(id response, NSError *error) {
// [self requestQuestionList];
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *tempArray = [NSMutableArray array];
...@@ -567,10 +607,24 @@ ...@@ -567,10 +607,24 @@
[picList setValuesForKeysWithDictionary:dict]; [picList setValuesForKeysWithDictionary:dict];
[tempArray addObject:picList]; [tempArray addObject:picList];
} }
_allPraiseListArray = [NSMutableArray arrayWithArray:tempArray];
if (_allPraiseListArray.count == 0) { if ([type isEqualToString:@"store"]) {
[_sectionArray removeObject:@"商场风采"]; _allPraiseListArray = [NSMutableArray arrayWithArray:tempArray];
if (_allPraiseListArray.count == 0) {
[_sectionArray removeObject:@"商场风采"];
}
} else if ([type isEqualToString:@"casus"]) {
_allExcellentCaseArray = [NSMutableArray arrayWithArray:tempArray];
if (_allExcellentCaseArray.count == 0) {
[_sectionArray removeObject:@"优秀案例"];
}
} else {
_allPatrolReportArray = [NSMutableArray arrayWithArray:tempArray];
if (_allPatrolReportArray.count == 0) {
[_sectionArray removeObject:@"巡店报告"];
}
} }
if (_sectionArray.count == 0) { if (_sectionArray.count == 0) {
if (_tableView) { if (_tableView) {
[_tableView removeFromSuperview]; [_tableView removeFromSuperview];
...@@ -584,11 +638,116 @@ ...@@ -584,11 +638,116 @@
} }
[self.tableView reloadData]; [self.tableView reloadData];
} }
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
}]; }];
} }
- (void)requestSpotCheckList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kManageSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"keyword":self.customStr,
@"pageNumber":@(0),
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getManageSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"管理层的抽查列表 response= %@", response);
NSLog(@"管理层的抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
SpotCheckModel *spot = [[SpotCheckModel alloc] init];
[spot setValuesForKeysWithDictionary:dict];
[tempArray addObject:spot];
}
_allSpotCheckList = [NSMutableArray arrayWithArray:tempArray];
if (_allSpotCheckList.count == 0) {
[_sectionArray removeObject:@"在线抽查"];
}
if (_sectionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
[self.tableView reloadData];
}
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
- (void)requestLookOnLineList
{
HttpClient *http = [[HttpClient alloc] initWithUrl:[NSString stringWithFormat:@"%@%@", kRedStarURL, kStoreSportcheckURL]];
// 相关参数
NSString *user_uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"];
NSDictionary *parameters = @{@"userUuid":user_uuid,
@"pageNumber":@(0),
@"keyword":self.customStr,
@"pageSize":@(2)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[http getStoreSportCheckListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"获取 商场 抽查列表 response= %@", response);
NSLog(@"获取 商场 抽查列表 error= %@", error);
NSDictionary *dataDict = response[@"data"];
NSArray *recordsArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in recordsArray) {
LookOnLineModel *lookOnline = [[LookOnLineModel alloc] init];
[lookOnline setValuesForKeysWithDictionary:dict];
[tempArray addObject:lookOnline];
}
_allLookOnLineList = [NSMutableArray arrayWithArray:tempArray];
if (_allLookOnLineList.count == 0) {
[_sectionArray removeObject:@"查看抽查"];
}
if (_sectionArray.count == 0) {
if (_tableView) {
[_tableView removeFromSuperview];
_tableView = nil;
}
self.noDataView.backgroundColor = [UIColor whiteColor];
} else {
if (_noDataView) {
[_noDataView removeFromSuperview];
_noDataView = nil;
}
[self.tableView reloadData];
}
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
// 返回上一页面 // 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender - (void)doBack:(UIBarButtonItem *)sender
{ {
...@@ -604,12 +763,148 @@ ...@@ -604,12 +763,148 @@
} }
//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
//{
// NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
// NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
// NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
// NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
//
// if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
// return _taskListDataArray.count;
// } else if ([_sectionArray[section] isEqualToString:@"口碑报告"] && section == s2) {
// return _allRankListArray.count + 1;
// } else if ([_sectionArray[section] isEqualToString:@"问题知识"] && section == s3) {
// return _allQuestionArray.count;
// } else if ([_sectionArray[section] isEqualToString:@"商场风采"] && section == s4) {
// return _allPraiseListArray.count;
// } else {
// return 0;
// }
//}
//
//
//// cell显示的内容
//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//{
// NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
// NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
// NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
// NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
//
// if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
// InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
// if (!cell) {
// cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
// }
// TaskListModel *taskList = _taskListDataArray[indexPath.row];
// cell.taskList = taskList;
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// cell.allView.backgroundColor = kProgressViewAllBackColor;
// UIImage *image = [UIImage imageNamed:@"progress-bar"];
// image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
// cell.alreadyView.image = image;
// return cell;
// } else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
// if (indexPath.row == 0) {
// HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
// if (!cell) {
// cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell];
// }
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// return cell;
// } else {
// RankingListCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
// if (!cell) {
// cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
// }
// RankListModel *rankList = _allRankListArray[indexPath.row - 1];
// cell.rankList = rankList;
// cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", rankList.index]];
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// return cell;
// }
// } else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
// // 问题与知识
// QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
// if (!cell) {
// cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeQuestionListTableCell];
// }
// cell.selectionStyle = UITableViewCellSelectionStyleNone;
// QuestionModel *question = _allQuestionArray[indexPath.row];
// cell.question = question;
// 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 {
// return nil;
// }
//
//
//
//
//}
//
//// cell点击事件
//- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
//{
// NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
// NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
// NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
// NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
// if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
// InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
// TaskListModel *taskList = self.taskListDataArray[indexPath.row];
// inspectTaskVC.uuid = taskList.uuid;
// inspectTaskVC.store_uuid = taskList.store_uuid;
// inspectTaskVC.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount ;
// self.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:inspectTaskVC animated:YES];
// } else if ([_sectionArray[indexPath.section] isEqualToString:@"口碑报告"] && indexPath.section == s2) {
// if (indexPath.row == 0) {
// return;
// }
// RankListModel *rankList = _allRankListArray[indexPath.row - 1];
// RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
// rankDetailVC.indexRow = rankList.index;
// rankDetailVC.uuid = rankList.uuid;
// rankDetailVC.store_uuid = rankList.store_uuid;
// rankDetailVC.storeAddress = rankList.storeAddress;
// rankDetailVC.storePictures = rankList.storePictures;
// self.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:rankDetailVC animated:YES];
// } else if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
// 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 ([_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;
// }
//}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"]; NSUInteger s2 = [_sectionArray indexOfObject:@"口碑报告"];
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"]; NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"]; NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) { if ([_sectionArray[section] isEqualToString:@"口碑巡检"] && section == s1) {
return _taskListDataArray.count; return _taskListDataArray.count;
...@@ -619,6 +914,14 @@ ...@@ -619,6 +914,14 @@
return _allQuestionArray.count; return _allQuestionArray.count;
} else if ([_sectionArray[section] isEqualToString:@"商场风采"] && section == s4) { } else if ([_sectionArray[section] isEqualToString:@"商场风采"] && section == s4) {
return _allPraiseListArray.count; return _allPraiseListArray.count;
} else if ([_sectionArray[section] isEqualToString:@"优秀案例"] && section == s5) {
return _allExcellentCaseArray.count;
} else if ([_sectionArray[section] isEqualToString:@"巡店报告"] && section == s6) {
return _allPatrolReportArray.count;
} else if ([_sectionArray[section] isEqualToString:@"在线抽查"] && section == s7) {
return _allSpotCheckList.count;
} else if ([_sectionArray[section] isEqualToString:@"查看抽查"] && section == s8) {
return _allLookOnLineList.count;
} else { } else {
return 0; return 0;
} }
...@@ -632,6 +935,10 @@ ...@@ -632,6 +935,10 @@
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"]; NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"]; NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) { if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell]; InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
...@@ -659,6 +966,15 @@ ...@@ -659,6 +966,15 @@
if (!cell) { if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell]; cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
} }
for (int i = 0 ; i < _allRankListArray.count; i++) {
RankListModel *rank = _allRankListArray[i];
if (i == 0) {
rank.index = i + 1;
} else {
RankListModel *prevRank = _allRankListArray[i-1];
rank.index = rank.score == prevRank.score ? prevRank.index: i + 1;
}
}
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]];
...@@ -682,7 +998,39 @@ ...@@ -682,7 +998,39 @@
} }
cell.pictureList = _allPraiseListArray[indexPath.row]; cell.pictureList = _allPraiseListArray[indexPath.row];
return cell; return cell;
} else { } else if ([_sectionArray[indexPath.section] isEqualToString:@"优秀案例"] && indexPath.section == s5) {
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomePictureListCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomePictureListCell];
}
cell.pictureList = _allExcellentCaseArray[indexPath.row];
return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"巡店报告"] && indexPath.section == s6) {
PictureTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomePictureListCell];
if (!cell) {
cell = [[PictureTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomePictureListCell];
}
cell.pictureList = _allPatrolReportArray[indexPath.row];
return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"在线抽查"] && indexPath.section == s7) {
SpotCheckTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kSearchSpotCehcekCell];
if (!cell) {
cell = [[SpotCheckTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kSearchSpotCehcekCell];
}
cell.spotCheck = _allSpotCheckList[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else if ([_sectionArray[indexPath.section] isEqualToString:@"查看抽查"] && indexPath.section == s8) {
LookOnLineTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kSearchLookOnLineCell];
if (!cell) {
cell = [[LookOnLineTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kSearchLookOnLineCell];
}
cell.lookOnLine = _allLookOnLineList[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
return nil; return nil;
} }
...@@ -698,6 +1046,10 @@ ...@@ -698,6 +1046,10 @@
NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"]; NSUInteger s4 = [_sectionArray indexOfObject:@"商场风采"];
NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"]; NSUInteger s3 = [_sectionArray indexOfObject:@"问题知识"];
NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"]; NSUInteger s1 = [_sectionArray indexOfObject:@"口碑巡检"];
NSUInteger s5 = [_sectionArray indexOfObject:@"优秀案例"];
NSUInteger s6 = [_sectionArray indexOfObject:@"巡店报告"];
NSUInteger s7 = [_sectionArray indexOfObject:@"在线抽查"];
NSUInteger s8 = [_sectionArray indexOfObject:@"查看抽查"];
if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) { if ([_sectionArray[indexPath.section] isEqualToString:@"口碑巡检"] && indexPath.section == s1) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row]; TaskListModel *taskList = self.taskListDataArray[indexPath.row];
...@@ -717,6 +1069,7 @@ ...@@ -717,6 +1069,7 @@
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;
rankDetailVC.commentId = rankList.commentId;
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 if ([_sectionArray[indexPath.section] isEqualToString:@"问题知识"] && indexPath.section == s3) {
...@@ -729,14 +1082,42 @@ ...@@ -729,14 +1082,42 @@
PictureListModel *picList = _allPraiseListArray[indexPath.row]; PictureListModel *picList = _allPraiseListArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init]; PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
storyVC.uuid = picList.uuid; storyVC.uuid = picList.uuid;
storyVC.titleStr = @"商场风采";
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES]; [self.navigationController pushViewController:storyVC animated:YES];
} else { } else if ([_sectionArray[indexPath.section] isEqualToString:@"优秀案例"] && indexPath.section == s5) {
PictureListModel *picList = _allExcellentCaseArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
storyVC.uuid = picList.uuid;
storyVC.titleStr = @"优秀案例";
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"巡店报告"] && indexPath.section == s6) {
PictureListModel *picList = _allPatrolReportArray[indexPath.row];
PictureStoryViewController *storyVC = [[PictureStoryViewController alloc] init];
storyVC.uuid = picList.uuid;
storyVC.titleStr = @"巡店报告";
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:storyVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"在线抽查"] && indexPath.section == s7) {
SpotCheckModel *spot = _allSpotCheckList[indexPath.row];
OnLineCompleteViewController *completeVC = [[OnLineCompleteViewController alloc] init];
completeVC.uuid = spot.uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:completeVC animated:YES];
} else if ([_sectionArray[indexPath.section] isEqualToString:@"查看抽查"] && indexPath.section == s8) {
LookOnLineModel *lookOnLine = _allLookOnLineList[indexPath.row];
LookOnLineDetailViewController *lookDetailVC = [[LookOnLineDetailViewController alloc] init];
lookDetailVC.lookOnLine = lookOnLine;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:lookDetailVC animated:YES];
} else {
return; return;
} }
} }
// section高度 // section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{ {
...@@ -864,7 +1245,9 @@ ...@@ -864,7 +1245,9 @@
[_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell]; [_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell];
[_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kHomeRankingListCell]; [_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kHomeRankingListCell];
[_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell]; [_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell];
[_tableView registerClass:[SpotCheckTableViewCell class] forCellReuseIdentifier:kSearchSpotCehcekCell];
[_tableView registerClass:[LookOnLineTableViewCell class] forCellReuseIdentifier:kSearchLookOnLineCell];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
......
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