Commit 4f401008 authored by admin's avatar admin

添加上拉加载更多

parent e92ee35e
......@@ -134,6 +134,8 @@
#define kTaxisViewHeight 150
#define kScreenViewHeight 240
#define kMoreScreenViewHeight 410
#define kRefreshInspectPointNotification @"refreshInspectPoint"
#define kRefreshQuestionNotification @"refershQuestionList"
......
......@@ -24,6 +24,10 @@
@property (nonatomic, strong) ScopeTableView *scopeTableView;
@property (nonatomic, strong) GroupTableView *groupTableView;
@property (nonatomic, strong) CategoryTableView *categoryTableView;
@property (nonatomic, strong) UITextView *textView1;
@property (nonatomic, strong) UITextView *textView2;
@property (nonatomic, strong) StateTableView *stateTableView;
@property (nonatomic, strong) TimeTableView *timeTableView;
......
......@@ -39,22 +39,28 @@
- (void)setup
{
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 180)];
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 350)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
self.scopeTableView = [[ScopeTableView alloc] init];
GroupItems *scopeItem = [[GroupItems alloc] initWithTitle:@"问题范围" view:_scopeTableView];
self.groupTableView = [[GroupTableView alloc] init];
_groupTableView.groupDeleagte = self.categoryTableView;
GroupItems *groupItem = [[GroupItems alloc] initWithTitle:@"问题分组" view:_groupTableView];
self.categoryTableView = [[CategoryTableView alloc] init];
GroupItems *categoryItem = [[GroupItems alloc] initWithTitle:@"问题分类" view:_categoryTableView];
self.textView1 = [[UITextView alloc] init];
GroupItems *textViewItem1 = [[GroupItems alloc] initWithTitle:@"标题类似于" view:_textView1];
self.textView2 = [[UITextView alloc] init];
GroupItems *textViewItem2 = [[GroupItems alloc] initWithTitle:@"关键字类似于" view:_textView2];
self.stateTableView = [[StateTableView alloc] init];
GroupItems *stateItem = [[GroupItems alloc] initWithTitle:@"问题状态" view:_stateTableView];
......@@ -64,10 +70,12 @@
[self insertSubview:_scopeTableView belowSubview:_groupTabBar];
[self insertSubview:_groupTableView belowSubview:_groupTabBar];
[self insertSubview:_categoryTableView belowSubview:_groupTabBar];
[self insertSubview:_textView1 belowSubview:_groupTabBar];
[self insertSubview:_textView2 belowSubview:_groupTabBar];
[self insertSubview:_stateTableView belowSubview:_groupTabBar];
[self insertSubview:_timeTableView belowSubview:_groupTabBar];
_groupTabBar.items = @[scopeItem, groupItem, categoryItem, stateItem, timeItem];
_groupTabBar.items = @[scopeItem, groupItem, categoryItem, textViewItem1, textViewItem2, stateItem, timeItem];
[_groupTabBar showIndex:0];
self.backView.backgroundColor = [UIColor whiteColor];
......
......@@ -7,7 +7,15 @@
//
#import <UIKit/UIKit.h>
#import "GroupTableView.h"
@interface CategoryTableView : UITableView
@protocol CategoryTableViewDelegate <NSObject>
- (void)categoryTableViewClick:(NSInteger)row;
@end
@interface CategoryTableView : UITableView <GroupTableViewDelegate>
@property (nonatomic, assign) id <CategoryTableViewDelegate>categroyDeleagte;
@end
......@@ -33,15 +33,26 @@
- (void)setup
{
self.titleArray = [NSMutableArray arrayWithObjects:@"全部问题",@"我的问题", nil];
self.delegate = self;
self.dataSource = self;
self.titleArray = [NSMutableArray arrayWithObjects:@"111",@"222", nil];
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[self selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
//- (void)groupTableViewClick:(NSInteger)row
//{
// if (row == 0) {
// [self reloadData];
// } else {
// self.titleArray = [NSMutableArray arrayWithObjects:@"211",@"322", nil];
// [self reloadData];
//
// }
//}
#pragma mark - TableView Delegate/DataSource
......@@ -59,14 +70,17 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"categoryCell"];
}
cell.textLabel.text = _titleArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
return cell;
}
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_categroyDeleagte) {
[_categroyDeleagte categoryTableViewClick:indexPath.row];
}
}
......
......@@ -7,7 +7,12 @@
//
#import <UIKit/UIKit.h>
@protocol GroupTableViewDelegate <NSObject>
- (void)groupTableViewClick:(NSInteger)row;
@end
@interface GroupTableView : UITableView
@property (nonatomic, assign) id <GroupTableViewDelegate>groupDeleagte;
@end
......@@ -33,7 +33,7 @@
- (void)setup
{
self.titleArray = [NSMutableArray arrayWithObjects:@"全部问题",@"我的问题", nil];
self.titleArray = [NSMutableArray arrayWithObjects:@"全部",@"服务",@"环境企划",@"环境物业", nil];
self.delegate = self;
self.dataSource = self;
......@@ -59,14 +59,17 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"groupCell"];
}
cell.textLabel.text = _titleArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
return cell;
}
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_groupDeleagte) {
[_groupDeleagte groupTableViewClick:indexPath.row];
}
}
......
......@@ -8,6 +8,12 @@
#import <UIKit/UIKit.h>
@interface ScopeTableView : UITableView
@protocol ScopeTableViewDelegate <NSObject>
- (void)scopeTableViewClick:(NSInteger)row;
@end
@interface ScopeTableView : UITableView
@property (nonatomic, assign) id <ScopeTableViewDelegate>scopeDeleagte;
@end
......@@ -61,14 +61,17 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"scopeCell"];
}
cell.textLabel.text = _titleArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
return cell;
}
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_scopeDeleagte) {
[_scopeDeleagte scopeTableViewClick:indexPath.row];
}
}
......
......@@ -7,7 +7,12 @@
//
#import <UIKit/UIKit.h>
@protocol StateTableViewDelegate <NSObject>
- (void)stateTableViewClick:(NSInteger)row;
@end
@interface StateTableView : UITableView
@property (nonatomic, assign) id <StateTableViewDelegate>stateDeleagte;
@end
......@@ -33,7 +33,7 @@
- (void)setup
{
self.titleArray = [NSMutableArray arrayWithObjects:@"全部问题",@"我的问题", nil];
self.titleArray = [NSMutableArray arrayWithObjects:@"已创建",@"已完成",@"已作废",nil];
self.delegate = self;
self.dataSource = self;
......@@ -59,14 +59,17 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"stateCell"];
}
cell.textLabel.text = _titleArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
return cell;
}
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_stateDeleagte) {
[_stateDeleagte stateTableViewClick:indexPath.row];
}
}
......
......@@ -7,7 +7,12 @@
//
#import <UIKit/UIKit.h>
@protocol TimeTableViewDelegate <NSObject>
- (void)timeTableViewClick:(NSInteger)row;
@end
@interface TimeTableView : UITableView
@property (nonatomic, assign) id <TimeTableViewDelegate>timeDeleagte;
@end
......@@ -33,7 +33,7 @@
- (void)setup
{
self.titleArray = [NSMutableArray arrayWithObjects:@"全部问题",@"我的问题", nil];
self.titleArray = [NSMutableArray arrayWithObjects:@"全部",@"一周",@"一月",@"三月",@"一年",@"历史更多", nil];
self.delegate = self;
self.dataSource = self;
......@@ -59,14 +59,17 @@
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"timeCell"];
}
cell.textLabel.text = _titleArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
return cell;
}
// cell点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_timeDeleagte) {
[_timeDeleagte timeTableViewClick:indexPath.row];
}
}
......
......@@ -20,6 +20,7 @@
#import "TaskListModel.h"
#import <MBProgressHUD.h>
#import "NoDataView.h"
#import <MJRefresh.h>
#define kTAxisBtnTag 500232
......@@ -41,6 +42,7 @@
@property (nonatomic, assign) NSInteger selectRow;
@property (nonatomic, assign) NSInteger timeSelectNum;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, strong) NoDataView *noDataView;
......@@ -77,7 +79,7 @@
// 初始化数组
self.taskListDataArray = [NSMutableArray array];
// self.taskListDataArray = [NSMutableArray array];
[self requestInspectList];
......@@ -86,6 +88,8 @@
name:kRefreshInspectPointNotification
object:nil];
_page = 0;
}
- (void)dealloc
......@@ -115,6 +119,42 @@
}
#pragma mark - Private
- (void)requestMoreList
{
_page++;
NSLog(@"_page = %d", (int)_page);
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(_page),
@"pageSize":@(10)
};
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"巡检列表%@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *taskArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[taskArray addObject:taskList];
}
[_taskListDataArray addObjectsFromArray:taskArray];
if (taskArray.count < 10) {
[self.tableView.footer noticeNoMoreData];
} else {
[self.tableView.footer endRefreshing];
}
[self.tableView reloadData];
}];
}
- (void)requestCurrentList
{
......@@ -124,7 +164,7 @@
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(20)
@"pageSize":@(10)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
......@@ -153,7 +193,7 @@
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
[self.tableView reloadData];
}];
......@@ -180,7 +220,7 @@
@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(0),
@"pageSize":@(20)
@"pageSize":@(10)
};
NSLog(@"parameters = %@", parameters);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
......@@ -191,11 +231,13 @@
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[_taskListDataArray addObject:taskList];
[tempArray addObject:taskList];
}
_taskListDataArray = [NSMutableArray arrayWithArray:tempArray];
if (_taskListDataArray.count == 0) {
self.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:self.view animated:YES];
......@@ -203,9 +245,14 @@
} else {
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
[self requestMoreList];
}];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
}
......@@ -565,7 +612,7 @@
@"direction":@"asc"}];
}
NSDictionary *parameters = @{@"userUuid":@"",
NSDictionary *parameters = @{@"userUuid":[[NSUserDefaults standardUserDefaults] objectForKey:@"user_uuid"],
@"queryOrders":queryOrders,
@"pageNumber":@(0),
@"pageSize":@(10)
......
......@@ -242,6 +242,9 @@
rankDetailVC.indexRow = section;
rankDetailVC.uuid = rankList.uuid;
rankDetailVC.store_uuid = rankList.store_uuid;
rankDetailVC.storeAddress = rankList.storeAddress;
NSLog(@"storeAddress = %@", rankList.storePictures);
rankDetailVC.storePictures = rankList.storePictures;
[self.navigationController pushViewController:rankDetailVC animated:YES];
}
......
......@@ -119,14 +119,14 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
if ([permissions containsObject:@"500301"] || [permissions containsObject:@"500302"]) {
// [self.titleArray addObject:@"图说口碑"];
[self.titleArray addObject:@"图说口碑"];
}
if ([permissions containsObject:@"500401"] || [permissions containsObject:@"500402"]) {
// [self.titleArray addObject:@"口碑标准"];
[self.titleArray addObject:@"口碑标准"];
}
if ([permissions containsObject:@"500701"] || [permissions containsObject:@"500702"]) {
// [self.titleArray addObject:@"在线抽查"];
[self.titleArray addObject:@"在线抽查"];
}
[[NSUserDefaults standardUserDefaults] setObject:_titleArray forKey:@"function"];
......@@ -514,14 +514,14 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSMutableArray *titleArray = [[NSUserDefaults standardUserDefaults] objectForKey:@"function"];
return titleArray.count;
// if (_titleArray.count == 1) {
// return _titleArray.count;
// } else if (_titleArray.count == 5){
// return 2;
// } else {
// return 3;
// }
if (titleArray.count == 6) {
return 3;
} else if (titleArray.count == 5) {
return 2;
} else {
return titleArray.count;
}
}
......
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