|
|
@@ -17,22 +17,21 @@
|
|
|
#import "BHomeEnterpriseAuthAPI.h"//查询企业认证结果
|
|
|
#import "BHomeChangeIdentityAPI.h"//自发布切换身份
|
|
|
#import "BHomeListAPI.h"//简历列表
|
|
|
-#import "BHomeListModel.h"
|
|
|
+#import "BHomeDataBox.h"
|
|
|
|
|
|
|
|
|
@interface BHomeViewController ()
|
|
|
<
|
|
|
UITableViewDelegate,
|
|
|
-UITableViewDataSource,
|
|
|
UITextFieldDelegate,
|
|
|
FBAPIManagerDelegate,
|
|
|
FBAPIManagerInterceptor
|
|
|
>
|
|
|
|
|
|
@property (nonatomic, strong) BHomeNoCertificationView *certificationView;
|
|
|
-@property (nonatomic, strong) TableViewListView *tableView;
|
|
|
+@property (nonatomic, strong) HJPageListView *tableView;
|
|
|
@property (nonatomic, strong) BHomeSearchView *searchView;
|
|
|
-@property (nonatomic, strong) NSMutableArray *listArray;//简历列表
|
|
|
+@property (nonatomic, strong) BHomeDataBox *dataBox;
|
|
|
@property (nonatomic, strong) BHomeEnterpriseAuthAPI *authAPI;//查询企业认证结果
|
|
|
@property (nonatomic, strong) BHomeChangeIdentityAPI *IDAPI;//自发布切换身份
|
|
|
@property (nonatomic, strong) BHomeListAPI *listAPI;//简历列表
|
|
|
@@ -41,6 +40,10 @@ FBAPIManagerInterceptor
|
|
|
|
|
|
@implementation BHomeViewController
|
|
|
|
|
|
+- (void)dealloc {
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:@"refreshEnterpriseAuthResult" object:nil];
|
|
|
+}
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
|
|
[super viewWillAppear:animated];
|
|
|
@@ -58,24 +61,24 @@ FBAPIManagerInterceptor
|
|
|
IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
|
|
|
keyboardManager.enable = YES;
|
|
|
keyboardManager.enableAutoToolbar = YES;
|
|
|
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"refreshEnterpriseAuthResult" object:nil];
|
|
|
}
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
+
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
[self hj_setupWhiteColorNavBar];
|
|
|
self.navigationItem.title = @"简历";
|
|
|
- self.listArray = [NSMutableArray array];
|
|
|
- [self.authAPI start];
|
|
|
//认证成功回调(只有提交里信息)
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshEnterpriseAuthResult:) name:@"refreshEnterpriseAuthResult" object:nil];
|
|
|
// 错误页面刷新事件
|
|
|
- [self.view.errorView.refreshButton addTarget:self
|
|
|
- action:@selector(refreshButtonClicked:)
|
|
|
- forControlEvents:UIControlEventTouchUpInside];
|
|
|
-
|
|
|
+ [self.view.errorView.refreshButton addTarget:self action:@selector(refreshButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
|
+ [self.authAPI start];
|
|
|
}
|
|
|
+
|
|
|
+#pragma mark - event response
|
|
|
+/* 认证成功回调(只有提交里信息) */
|
|
|
- (void)refreshEnterpriseAuthResult:(NSNotificationCenter *)noti {
|
|
|
|
|
|
[self.authAPI start];
|
|
|
@@ -100,6 +103,8 @@ FBAPIManagerInterceptor
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+#pragma mark - UITextFieldDelegate
|
|
|
+
|
|
|
/* 当点击键盘上的return键*/
|
|
|
- (BOOL)textFieldShouldReturn:(UITextField *)textField
|
|
|
{
|
|
|
@@ -108,6 +113,7 @@ FBAPIManagerInterceptor
|
|
|
[self.listAPI start];
|
|
|
return YES ;
|
|
|
}
|
|
|
+
|
|
|
#pragma mark - FBAPIManagerInterceptor
|
|
|
|
|
|
- (BOOL)manager:(FBBaseAPIManager *)manager shouldStartCallAPIWithParams:(NSDictionary *)params {
|
|
|
@@ -120,6 +126,7 @@ FBAPIManagerInterceptor
|
|
|
|
|
|
[self.view fb_dismiss];
|
|
|
}
|
|
|
+
|
|
|
#pragma mark - FBPageableAPIManager
|
|
|
|
|
|
- (void)managerCallAPIDidSuccess:(FBBaseAPIManager *)manager {
|
|
|
@@ -127,57 +134,33 @@ FBAPIManagerInterceptor
|
|
|
[self.view dismissErrorView];
|
|
|
if (manager == self.authAPI)
|
|
|
{
|
|
|
- NSDictionary *dict = [manager fetchDataWithBox:nil];
|
|
|
- if ([[dict valueForKeyPath:@"data.isAuth"] boolValue] == NO)
|
|
|
- {//没有提交企业认证
|
|
|
+ id fetchData = [manager fetchDataWithBox:self.dataBox];
|
|
|
+ if ([[fetchData valueForKeyPath:@"data.isAuth"] boolValue] == NO)
|
|
|
+ { //没有提交企业认证
|
|
|
[self createCertificationView];
|
|
|
}
|
|
|
- else if ([[dict valueForKeyPath:@"data.isAuth"] boolValue] == YES)
|
|
|
- {//有提交企业认证
|
|
|
+ else if ([[fetchData valueForKeyPath:@"data.isAuth"] boolValue] == YES)
|
|
|
+ { //有提交企业认证
|
|
|
[self.IDAPI start];
|
|
|
}
|
|
|
}
|
|
|
if (manager == self.IDAPI)
|
|
|
{
|
|
|
- NSDictionary *dict = [manager fetchDataWithBox:nil];
|
|
|
+ id fetchData = [manager fetchDataWithBox:self.dataBox];
|
|
|
+ [self saveCompanyInfo:fetchData];
|
|
|
[self createTableView];
|
|
|
- [self saveCompanyInfo:dict];
|
|
|
[self.listAPI start];
|
|
|
}
|
|
|
if (manager == self.listAPI)
|
|
|
{
|
|
|
- NSDictionary *dict = [manager fetchDataWithBox:nil];
|
|
|
[self.tableView managerCallAPIDidSuccess:manager];
|
|
|
- if (self.listAPI.isFirstPage)
|
|
|
- {
|
|
|
- if (![dict[@"data"][@"applyResume"] isKindOfClass:[NSNull class]])
|
|
|
- {
|
|
|
- self.listArray = [NSMutableArray arrayWithArray:dict[@"data"][@"applyResume"]];
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (![dict[@"data"][@"applyResume"] isKindOfClass:[NSNull class]])
|
|
|
- {
|
|
|
- [self.listArray addObjectsFromArray:dict[@"data"][@"applyResume"]];
|
|
|
- }
|
|
|
- }
|
|
|
- [self.tableView.tableView reloadData];
|
|
|
}
|
|
|
}
|
|
|
- (void)managerCallAPIDidFailed:(FBBaseAPIManager *)manager {
|
|
|
|
|
|
[self.view showErrorView];
|
|
|
- FBAPIManagerErrorType type = manager.errorType;
|
|
|
- if (type == FBAPIManagerErrorTypeNoContent)
|
|
|
- {
|
|
|
- id fetchData = [manager fetchDataWithBox:nil];
|
|
|
- if ([fetchData isKindOfClass:[NSDictionary class]])
|
|
|
- {
|
|
|
- [self.view fb_showFailureWithStatus:fetchData[@"errmsg"]];
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ id fetchData = [manager fetchDataWithBox:self.dataBox];
|
|
|
+ if ([fetchData isKindOfClass:[NSString class]])
|
|
|
{
|
|
|
[self.view fb_showFailureWithStatus:manager.errorMessage];
|
|
|
}
|
|
|
@@ -186,41 +169,19 @@ FBAPIManagerInterceptor
|
|
|
[self.tableView managerCallAPIDidFailed:manager];
|
|
|
}
|
|
|
}
|
|
|
-/* 存储公司信息 */
|
|
|
-- (void)saveCompanyInfo:(NSDictionary *)dict {
|
|
|
-
|
|
|
- HJCompanyInfoModel *userInfo = [HJCompanyInfoModel yy_modelWithJSON:[dict valueForKeyPath:@"data.dpEnterpriseAuthentication"]];
|
|
|
- [HJCompanyInfoModel setCompanyInfo:userInfo];
|
|
|
-}
|
|
|
|
|
|
#pragma mark - UItableView代理
|
|
|
|
|
|
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
- return self.listArray.count;
|
|
|
-}
|
|
|
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ UIViewController *vc = [self.dataBox positionDetailViewControllerAtIndexPath:indexPath];
|
|
|
+ vc.hidesBottomBarWhenPushed = YES;
|
|
|
+ [self.navigationController pushViewController:vc animated:YES];
|
|
|
|
|
|
- static NSString *listCell = @"listCell";
|
|
|
- BHomeListCell *cell = [tableView dequeueReusableCellWithIdentifier:listCell];
|
|
|
- if (cell == nil)
|
|
|
- {
|
|
|
- cell = [[BHomeListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:listCell];
|
|
|
- }
|
|
|
- [cell bHomeCellListArray:self.listArray andIndexPath:indexPath];
|
|
|
- return cell;
|
|
|
}
|
|
|
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
-
|
|
|
- BHomeListModel *model = [BHomeListModel yy_modelWithJSON:self.listArray[indexPath.row]];
|
|
|
- BHomeResumeDetailViewController *detail = [[BHomeResumeDetailViewController alloc]init];
|
|
|
- detail.hidesBottomBarWhenPushed = YES;
|
|
|
- detail.resumeID = model.ID;
|
|
|
- detail.dpPositionName = model.dpPositionName;
|
|
|
- detail.applyId = model.applyId;
|
|
|
- [self.navigationController pushViewController:detail animated:YES];
|
|
|
|
|
|
-}
|
|
|
+#pragma mark - private methods
|
|
|
+
|
|
|
/* 创建TableView */
|
|
|
- (void)createTableView {
|
|
|
|
|
|
@@ -250,7 +211,7 @@ FBAPIManagerInterceptor
|
|
|
};
|
|
|
|
|
|
}
|
|
|
-/* 没有认证和认证中的页面 */
|
|
|
+/* 没有认证页面 */
|
|
|
- (void)createCertificationView {
|
|
|
|
|
|
__weak typeof(self) weakSelf = self;
|
|
|
@@ -260,8 +221,9 @@ FBAPIManagerInterceptor
|
|
|
|
|
|
make.left.right.offset(0);
|
|
|
make.centerY.equalTo(weakSelf.view);
|
|
|
+
|
|
|
}];
|
|
|
-// [self.certificationView showCertificationResultView];
|
|
|
+
|
|
|
_certificationView.certificationBlock = ^{
|
|
|
|
|
|
BHomeCertificationEnterpriseVC *enterpriseVC = [[BHomeCertificationEnterpriseVC alloc]init];
|
|
|
@@ -269,8 +231,24 @@ FBAPIManagerInterceptor
|
|
|
[weakSelf.navigationController pushViewController:enterpriseVC animated:YES];
|
|
|
};
|
|
|
}
|
|
|
-#pragma mark - setter&getter
|
|
|
|
|
|
+/* 存储公司信息 */
|
|
|
+- (void)saveCompanyInfo:(NSDictionary *)dict {
|
|
|
+
|
|
|
+ HJCompanyInfoModel *userInfo = [HJCompanyInfoModel yy_modelWithJSON:[dict valueForKeyPath:@"data.dpEnterpriseAuthentication"]];
|
|
|
+ [HJCompanyInfoModel setCompanyInfo:userInfo];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - setter & getter
|
|
|
+
|
|
|
+- (BHomeDataBox *)dataBox {
|
|
|
+
|
|
|
+ if (_dataBox == nil)
|
|
|
+ {
|
|
|
+ _dataBox = [[BHomeDataBox alloc] init];
|
|
|
+ }
|
|
|
+ return _dataBox;
|
|
|
+}
|
|
|
- (BHomeNoCertificationView *)certificationView {
|
|
|
|
|
|
if (_certificationView == nil)
|
|
|
@@ -317,15 +295,17 @@ FBAPIManagerInterceptor
|
|
|
return _searchView;
|
|
|
}
|
|
|
|
|
|
-- (TableViewListView *)tableView {
|
|
|
+- (HJPageListView *)tableView {
|
|
|
|
|
|
if (_tableView == nil)
|
|
|
{
|
|
|
- _tableView = [[TableViewListView alloc] init];
|
|
|
+ _tableView = [[HJPageListView alloc] init];
|
|
|
_tableView.tableView.delegate = self;
|
|
|
- _tableView.tableView.dataSource = self;
|
|
|
+ _tableView.tableView.dataSource = self.dataBox;
|
|
|
_tableView.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
|
_tableView.APIManager = self.listAPI;
|
|
|
+ _tableView.dataBox = self.dataBox;
|
|
|
+ //自定义空白页
|
|
|
_tableView.blankView.imageView.image = [UIImage imageNamed:@"b_home_empty"];
|
|
|
NSMutableAttributedString *countAtt1 = [[NSMutableAttributedString alloc]initWithString:@"暂时还没有简历投递进来\n\n岗位信息内容填写越丰富\n越容易收到高质量的简历"];
|
|
|
[countAtt1 addAttribute:NSForegroundColorAttributeName value:COLOR_BACK3 range:NSMakeRange(0, 11)];
|