|
|
@@ -7,17 +7,16 @@
|
|
|
//
|
|
|
|
|
|
#import "HJClockInViewController.h"
|
|
|
+#import "HJClockView.h"
|
|
|
#import "HJClockInAuthView.h"
|
|
|
-#import "HJClockInInfoView.h"
|
|
|
-#import "HJClockInStateView.h"
|
|
|
#import "HJClockInRuleView.h"
|
|
|
#import "HJClockInPlayerView.h"
|
|
|
#import <AMapLocationKit/AMapLocationKit.h>//定位
|
|
|
#import "HJClockInSuccessViewController.h"//打卡成功
|
|
|
#import "HJClockInStatisticViewController.h"//统计
|
|
|
-#import "HJClockInRuleViewController.h"//规则
|
|
|
#import "HJAuthViewController.h"//实名认证
|
|
|
#import "HJClockInCustomerServiceView.h"//客服
|
|
|
+#import "HJGetUserInfoAPIManager.h"
|
|
|
#import "HJClockInInfoAPI.h"//打卡信息
|
|
|
#import "HJClockInAPI.h"//打卡
|
|
|
#import "HJClockInInfoModel.h"
|
|
|
@@ -25,25 +24,24 @@
|
|
|
|
|
|
@interface HJClockInViewController ()
|
|
|
<
|
|
|
-FBScrollLayoutViewDelegate,
|
|
|
FBAPIManagerInterceptor,
|
|
|
-FBAPIManagerDelegate,
|
|
|
-UIScrollViewDelegate
|
|
|
+FBAPIManagerDelegate
|
|
|
>
|
|
|
-
|
|
|
-@property (nonatomic, strong) FBScrollLayoutView *scrollLayoutView;
|
|
|
+@property (nonatomic, strong) UIScrollView *scrollView;
|
|
|
+@property (nonatomic, strong) HJClockView *clockView;
|
|
|
@property (nonatomic, strong) HJClockInAuthView *authView;
|
|
|
-@property (nonatomic, strong) HJClockInInfoView *infoView;
|
|
|
-@property (nonatomic, strong) HJClockInStateView *stateView;
|
|
|
-@property (nonatomic, strong) HJClockInRuleView *ruleView;
|
|
|
+@property (nonatomic, strong) UIButton *customerServiceBtn;//客服按钮,
|
|
|
@property (nonatomic, strong) HJRefreshHeaderView *refreshHeader;//头部刷新视图
|
|
|
-@property (nonatomic, copy) NSString *latitude;
|
|
|
-@property (nonatomic, copy) NSString *longitude;
|
|
|
+@property (nonatomic, copy) NSString *latitude;//经度
|
|
|
+@property (nonatomic, copy) NSString *longitude;//纬度
|
|
|
@property (nonatomic, strong) AMapLocationManager *locationManager;//高德定位
|
|
|
+@property (nonatomic, strong) HJGetUserInfoAPIManager *userInfoAPI;//用户信息
|
|
|
@property (nonatomic, strong) HJClockInInfoAPI *clockInInfoAPI;//打卡信息
|
|
|
@property (nonatomic, strong) HJClockInAPI *clockInAPI;//打卡
|
|
|
@property (nonatomic, strong) HJClockInInfoModel *infoModel;
|
|
|
@property (nonatomic, strong) HJClockInDataBox *dataBox;
|
|
|
+@property (nonatomic, strong) NSTimer *timer;
|
|
|
+
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -51,30 +49,51 @@ UIScrollViewDelegate
|
|
|
|
|
|
#pragma mark - life cycle
|
|
|
|
|
|
+- (void)dealloc {
|
|
|
+
|
|
|
+ [_timer invalidate];
|
|
|
+ _timer = nil;
|
|
|
+// NSLog(@"dealloc----dealloc----dealloc----dealloc");
|
|
|
+}
|
|
|
- (void)viewDidDisappear:(BOOL)animated {
|
|
|
|
|
|
[super viewDidDisappear:animated];
|
|
|
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
|
|
+ [_timer invalidate];
|
|
|
+ _timer = nil;
|
|
|
+// NSLog(@"++++++viewDidDisappea销毁++++++++");
|
|
|
}
|
|
|
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|
|
|
|
|
[super viewWillAppear:animated];
|
|
|
- [self.navigationController setNavigationBarHidden:YES animated:animated];
|
|
|
- //监听是否重新进入程序程序.
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterPlayground:) name:UIApplicationDidBecomeActiveNotification object:nil];
|
|
|
+ [self.navigationController setNavigationBarHidden:NO animated:animated];
|
|
|
+ [self locationShowLoadingView:YES showLoading:NO];
|
|
|
+// NSLog(@"-------viewWillAppear---------");
|
|
|
}
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
|
|
|
[super viewDidLoad];
|
|
|
|
|
|
+ [self hj_setupNavBar];
|
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
|
- [self locationShowLoading:NO clockInAPI:NO];
|
|
|
self.edgesForExtendedLayout = UIRectEdgeNone;
|
|
|
[self locationPermissionJudgment];
|
|
|
}
|
|
|
|
|
|
+/* 开启定时器 */
|
|
|
+- (void)openTime {
|
|
|
+
|
|
|
+ if (_timer == nil)
|
|
|
+ {
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ _timer = [NSTimer scheduledTimerWithTimeInterval:60 target:weakSelf selector:@selector(runTime) userInfo:nil repeats:YES];
|
|
|
+ }
|
|
|
+}
|
|
|
+- (void)runTime {
|
|
|
+
|
|
|
+ [self locationShowLoadingView:NO showLoading:NO];
|
|
|
+}
|
|
|
#pragma mark - Private methods
|
|
|
|
|
|
/* 设置状态了为白色 */
|
|
|
@@ -108,54 +127,68 @@ UIScrollViewDelegate
|
|
|
//0:未认证 1:等待认证 2:未通过 3:已认证
|
|
|
if (self.infoModel.authenticationStatus == 0 || self.infoModel.authenticationStatus == 2)
|
|
|
{
|
|
|
- [self.view addSubview:self.authView];
|
|
|
self.authView.type = self.infoModel.authenticationStatus == 0 ? HJClockInAuthStateTypeNoAuth : HJClockInAuthStateTypeFial;
|
|
|
//实名认证通知
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(realNameNotification:) name:HJRealNameAuthenticationNotification object:nil];
|
|
|
- [self.authView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-
|
|
|
- make.left.top.right.bottom.offset(0);
|
|
|
+
|
|
|
+ [self.view addSubview:self.scrollView];
|
|
|
+ [self.scrollView addSubview:self.authView];
|
|
|
+ self.scrollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
|
+ self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT+1);
|
|
|
+ self.scrollView.contentOffset = CGPointMake(0, 0);
|
|
|
+ if (SCREEN_HEIGHT >= 812)
|
|
|
+ {
|
|
|
+ self.authView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-STATUS_BAR_H - NAVIGATION_BAR_H - 49-34);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ self.authView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-STATUS_BAR_H - NAVIGATION_BAR_H - 49);
|
|
|
+ }
|
|
|
+
|
|
|
+ [self.view insertSubview:self.customerServiceBtn aboveSubview:self.scrollView];
|
|
|
+ [self.customerServiceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.right.equalTo(self.view).offset(-5);
|
|
|
+ make.bottom.equalTo(self.view).offset(-10);
|
|
|
}];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [self.view addSubview:self.scrollLayoutView];
|
|
|
- [self.scrollLayoutView.contentView addSubview:self.infoView];
|
|
|
- [self.scrollLayoutView.contentView addSubview:self.stateView];
|
|
|
- [self.scrollLayoutView.contentView addSubview:self.ruleView];
|
|
|
- [self.scrollLayoutView makeConstraints];
|
|
|
+ [self initAddClickView];
|
|
|
+ [self.view insertSubview:self.customerServiceBtn aboveSubview:self.scrollView];
|
|
|
+ [self.customerServiceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.right.equalTo(self.view).offset(-5);
|
|
|
+ make.bottom.equalTo(self.view).offset(-10);
|
|
|
+ }];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* 定位,请求信息 */
|
|
|
-- (void)locationShowLoading:(BOOL)show clockInAPI:(BOOL)clockIn {
|
|
|
+- (void)locationShowLoadingView:(BOOL)showView showLoading:(BOOL)show {
|
|
|
|
|
|
- if (show)
|
|
|
+ if (showView)
|
|
|
{
|
|
|
- [self.view fb_showLoading];
|
|
|
+ [self.view showLoadingView];
|
|
|
}
|
|
|
- else
|
|
|
+ if (show)
|
|
|
{
|
|
|
- [self.view showLoadingView];
|
|
|
+ [self.view fb_showLoading];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
[self.view dismissErrorView];
|
|
|
+
|
|
|
[self.locationManager requestLocationWithReGeocode:YES completionBlock:^(CLLocation *location, AMapLocationReGeocode *regeocode, NSError *error) {
|
|
|
|
|
|
if (error == nil && regeocode)
|
|
|
- {
|
|
|
+ {//定位成功
|
|
|
+ [self openTime];
|
|
|
self.latitude = [NSString stringWithFormat:@"%f",location.coordinate.latitude];
|
|
|
self.longitude = [NSString stringWithFormat:@"%f",location.coordinate.longitude];
|
|
|
- if (clockIn)
|
|
|
- { //打卡
|
|
|
- self.clockInAPI.latitude = self.latitude;
|
|
|
- self.clockInAPI.longitude = self.longitude;
|
|
|
- [self.clockInAPI start];
|
|
|
- }
|
|
|
- else
|
|
|
- { //打卡信息
|
|
|
- [self requestClockIninfo];
|
|
|
- }
|
|
|
+// self.latitude = @"31.535788";
|
|
|
+// self.longitude = @"120.352949";
|
|
|
+ [self requestClockIninfo];
|
|
|
+ [self.userInfoAPI start];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -163,7 +196,8 @@ UIScrollViewDelegate
|
|
|
[self.view fb_dismiss];
|
|
|
[self.view fb_showFailureWithStatus:@"获取位置失败"];
|
|
|
[self locationPermissionJudgment];
|
|
|
- self.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
+ self.clockView.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
+ [self.userInfoAPI start];
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
@@ -186,118 +220,67 @@ UIScrollViewDelegate
|
|
|
/* 打卡的按钮的状态 */
|
|
|
- (void)clockInButtonState {
|
|
|
|
|
|
- self.infoView.timeLabel.attributedText = [self.infoView attributedText:[NSString stringWithFormat:@"%@ 小时",self.infoModel.sumDuration] DINCondensedBlod:self.infoModel.sumDuration];
|
|
|
-
|
|
|
- self.infoView.advanceLabel.attributedText = [self.infoView attributedText:[NSString stringWithFormat:@"%.2f 元",[self.infoModel.sumMoney floatValue]] DINCondensedBlod:[NSString stringWithFormat:@"%.2f",[self.infoModel.sumMoney floatValue]]];
|
|
|
-
|
|
|
//上班打卡时间
|
|
|
if ([self.infoModel.startPunch isEqualToString:@"未完成"])
|
|
|
{
|
|
|
- self.stateView.goWorkStateView.textLabel.text = self.infoModel.startPunch;
|
|
|
+ self.clockView.stateView.goWorkStateView.textLabel.text = self.infoModel.startPunch;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- self.stateView.goWorkStateView.textLabel.text = [HJAppService time_timestampToString:self.infoModel.startPunch withType:kTimeStampDateOnlyHMS];
|
|
|
+ self.clockView.stateView.goWorkStateView.textLabel.text = [HJAppService time_timestampToString:self.infoModel.startPunch withType:kTimeStampDateOnlyHMS];
|
|
|
}
|
|
|
|
|
|
//下班打卡时间
|
|
|
if ([self.infoModel.endPunch isEqualToString:@"未完成"])
|
|
|
{
|
|
|
- self.stateView.afterWorkStateView.textLabel.text = self.infoModel.endPunch;
|
|
|
+ self.clockView.stateView.afterWorkStateView.textLabel.text = self.infoModel.endPunch;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- self.stateView.afterWorkStateView.textLabel.text = [HJAppService time_timestampToString:self.infoModel.endPunch withType:kTimeStampDateOnlyHMS];
|
|
|
+ self.clockView.stateView.afterWorkStateView.textLabel.text = [HJAppService time_timestampToString:self.infoModel.endPunch withType:kTimeStampDateOnlyHMS];
|
|
|
}
|
|
|
|
|
|
if (self.infoModel.authenticationStatus == 1)
|
|
|
{//1:等待认证
|
|
|
- self.stateView.stateType = HJClockInStateTypeAuthing;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeAuthing;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ([self.infoModel.clockType integerValue] == 1)
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeGoWork;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeGoWork;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([self.infoModel.clockType integerValue] == 1 && ![self.infoModel.startPunch isEqualToString: @"未完成"])
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeGoWorkComplete;
|
|
|
- self.stateView.promptView.textLabel.text = [NSString stringWithFormat:@"上班%@小时后才能进行上班打卡",self.infoModel.dailyAvailableMinHour];
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeGoWorkComplete;
|
|
|
+ self.clockView.stateView.promptView.textLabel.text = [NSString stringWithFormat:@"上班%@小时后才能进行下班打卡",self.infoModel.dailyAvailableMinHour];
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([self.infoModel.clockType integerValue] == 2)
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeAfterWork;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeAfterWork;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([self.infoModel.clockType integerValue] == 3)
|
|
|
{
|
|
|
if ([self.infoModel.startPunch isEqualToString:@"未完成"])
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeGoWorkOutOfRange;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeGoWorkOutOfRange;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeAfterWorkOutOfRange;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeAfterWorkOutOfRange;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ([self.infoModel.clockType integerValue] == 4)
|
|
|
{
|
|
|
- self.stateView.stateType = HJClockInStateTypeComplete;
|
|
|
- self.stateView.wageView.moneyLabel.text = self.infoModel.todayMoney;
|
|
|
+ self.clockView.stateView.stateType = HJClockInStateTypeComplete;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#pragma mark - UIScrollViewDelegate
|
|
|
-
|
|
|
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
|
-
|
|
|
- if (scrollView.contentOffset.y <= 0)
|
|
|
- {
|
|
|
- [_scrollLayoutView az_setGradientBackgroundWithColors:@[[UIColor colorFromHexString:@"016DFF"],[UIColor colorFromHexString:@"0254FF"]] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- [_scrollLayoutView az_setGradientBackgroundWithColors:@[COLOR_F5F5F5,COLOR_F5F5F5] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-#pragma mark - FBScrollLayoutViewDelegate
|
|
|
-
|
|
|
-- (void)scrollLayoutViewMakeConstraints:(FBScrollLayoutView *)scrollLayoutView {
|
|
|
-
|
|
|
- [scrollLayoutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-
|
|
|
- make.left.right.top.equalTo(self.view).offset(0);
|
|
|
- make.bottom.equalTo(self.view.mas_bottom).offset(0);
|
|
|
- }];
|
|
|
-}
|
|
|
-
|
|
|
-- (void)subviewsMakeConstraintsInScrollLayoutView:(FBScrollLayoutView *)scrollLayoutView contentView:(UIView *)contentView {
|
|
|
-
|
|
|
- [self.infoView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-
|
|
|
- make.top.left.right.equalTo(contentView);
|
|
|
- }];
|
|
|
- [self.stateView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-
|
|
|
- make.top.equalTo(self.infoView.mas_bottom).offset(0);
|
|
|
- make.left.right.equalTo(contentView);
|
|
|
- }];
|
|
|
- [self.ruleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
-
|
|
|
- make.top.equalTo(self.stateView.mas_bottom).offset(0);
|
|
|
- make.left.right.equalTo(contentView);
|
|
|
- }];
|
|
|
- [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.bottom.equalTo(self.ruleView.mas_bottom).offset(0);
|
|
|
- }];
|
|
|
-}
|
|
|
-
|
|
|
#pragma mark - FBAPIManagerInterceptor
|
|
|
|
|
|
- (BOOL)manager:(FBBaseAPIManager *)manager shouldStartCallAPIWithParams:(NSDictionary *)params {
|
|
|
@@ -316,28 +299,50 @@ UIScrollViewDelegate
|
|
|
|
|
|
- (void)managerCallAPIDidSuccess:(FBBaseAPIManager *)manager {
|
|
|
|
|
|
+ if (manager == self.userInfoAPI)
|
|
|
+ {//用户信息
|
|
|
+ NSDictionary *dataDict = [manager fetchDataWithBox:self.dataBox];
|
|
|
+ HJClockInInfoModel *userModel = [HJClockInInfoModel yy_modelWithDictionary:dataDict[@"hpUser"]];
|
|
|
+ HJClockInInfoModel *memberModel = [HJClockInInfoModel yy_modelWithDictionary:dataDict[@"hpMember"]];
|
|
|
+
|
|
|
+ [self.clockView.infoView.headerIcon sd_setImageWithURL:[NSURL URLWithString:userModel.headImgUrl] placeholderImage:[UIImage imageNamed:@"me_portrait_default"]];
|
|
|
+ self.clockView.infoView.nameLabel.text = memberModel.realName;
|
|
|
+ if (memberModel.authenticationStatus == 1)
|
|
|
+ {//认证中
|
|
|
+ self.clockView.infoView.icon.image = [UIImage imageNamed:@"clockin_anth_audit"];
|
|
|
+ self.clockView.infoView.tagLabel.text = @"认证信息审核中";
|
|
|
+ self.clockView.infoView.tagLabel.textColor = COLOR_999999;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {//认证成功
|
|
|
+ self.clockView.infoView.icon.image = [UIImage imageNamed:@"clockIn_auth_icon"];
|
|
|
+ self.clockView.infoView.tagLabel.text = @"已认证";
|
|
|
+ self.clockView.infoView.tagLabel.textColor = COLOR_0177FF;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (manager == self.clockInInfoAPI)
|
|
|
- {//信息
|
|
|
+ {//打卡信息
|
|
|
NSDictionary *dataDict = [manager fetchDataWithBox:self.dataBox];
|
|
|
self.infoModel = [HJClockInInfoModel yy_modelWithDictionary:dataDict];
|
|
|
[self makeConstraintsViews];
|
|
|
[self clockInButtonState];
|
|
|
}
|
|
|
if (manager == self.clockInAPI)
|
|
|
- {//打卡成功
|
|
|
- self.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
+ {//打卡---成功
|
|
|
+ self.clockView.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
HJClockInSuccessViewController *successVC = [[HJClockInSuccessViewController alloc] init];
|
|
|
successVC.dataDict = [manager fetchDataWithBox:self.dataBox];
|
|
|
- if (self.stateView.stateType == HJClockInStateTypeGoWork)
|
|
|
+ if (self.clockView.stateView.stateType == HJClockInStateTypeGoWork)
|
|
|
{
|
|
|
successVC.successType = HJClockInSuccessTypeGoWork;
|
|
|
}
|
|
|
- if (self.stateView.stateType == HJClockInStateTypeAfterWork)
|
|
|
+ if (self.clockView.stateView.stateType == HJClockInStateTypeAfterWork)
|
|
|
{
|
|
|
successVC.successType = HJClockInSuccessTypeAfterWork;
|
|
|
}
|
|
|
successVC.modalPresentationStyle = UIModalPresentationFullScreen;
|
|
|
[self presentViewController:successVC animated:YES completion:nil];
|
|
|
+
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1*NSEC_PER_SEC)),dispatch_get_main_queue(), ^{
|
|
|
|
|
|
[self requestClockIninfo];//打卡成功更新数据
|
|
|
@@ -351,10 +356,11 @@ UIScrollViewDelegate
|
|
|
{
|
|
|
[self showErrorView];
|
|
|
}
|
|
|
+
|
|
|
if (manager == self.clockInAPI)
|
|
|
{
|
|
|
[self requestClockIninfo];//打卡成功更新数据
|
|
|
- self.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
+ self.clockView.stateView.clockInButton.userInteractionEnabled = YES;
|
|
|
}
|
|
|
|
|
|
id fetchData = [manager fetchDataWithBox:self.dataBox];
|
|
|
@@ -362,24 +368,15 @@ UIScrollViewDelegate
|
|
|
{
|
|
|
[self.view fb_showFailureWithStatus:fetchData];
|
|
|
}
|
|
|
+
|
|
|
+// NSLog(@"fetchData ===== %@",fetchData);
|
|
|
}
|
|
|
|
|
|
#pragma mark - Notification
|
|
|
|
|
|
- (void)realNameNotification:(NSNotification *)notification {
|
|
|
|
|
|
- [self locationShowLoading:YES clockInAPI:NO];
|
|
|
-}
|
|
|
-
|
|
|
-/* 应用进入前台 */
|
|
|
-- (void)appDidEnterPlayground:(NSNotification *)notify {
|
|
|
-
|
|
|
- if (self.infoView.serviceButton.selected == YES)
|
|
|
- {
|
|
|
- self.infoView.serviceButton.selected = NO;
|
|
|
- return;
|
|
|
- }
|
|
|
- [self locationShowLoading:NO clockInAPI:NO];
|
|
|
+ [self locationShowLoadingView:NO showLoading:YES];
|
|
|
}
|
|
|
|
|
|
#pragma mark - event
|
|
|
@@ -397,14 +394,15 @@ UIScrollViewDelegate
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- [[UIApplication sharedApplication]openURL:url];
|
|
|
+ self.automaticallyAdjustsScrollViewInsets = NO;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/* 错误刷新 */
|
|
|
- (void)refreshButtonAction:(UIButton *)btn {
|
|
|
|
|
|
- [self locationShowLoading:NO clockInAPI:NO];
|
|
|
+ [self locationShowLoadingView:NO showLoading:YES];
|
|
|
}
|
|
|
|
|
|
/* 认证 */
|
|
|
@@ -423,18 +421,9 @@ UIScrollViewDelegate
|
|
|
[self.navigationController pushViewController:statisticsVC animated:YES];
|
|
|
}
|
|
|
|
|
|
-/* 规则 */
|
|
|
-- (void)ruleButtonClick:(UIButton *)btn {
|
|
|
-
|
|
|
- HJClockInRuleViewController *ruleVC = [[HJClockInRuleViewController alloc] init];
|
|
|
- ruleVC.hidesBottomBarWhenPushed = YES;
|
|
|
- [self.navigationController pushViewController:ruleVC animated:YES];
|
|
|
-}
|
|
|
-
|
|
|
/* 客服 */
|
|
|
-- (void)serviceButtonClick:(UIButton *)btn {
|
|
|
+- (void)customerServiceClick:(UIButton *)btn {
|
|
|
|
|
|
- self.infoView.serviceButton.selected = YES;
|
|
|
HJClockInCustomerServiceView *CSView = [[HJClockInCustomerServiceView alloc] init];
|
|
|
[CSView makeConstraintsSubViews];
|
|
|
}
|
|
|
@@ -442,99 +431,95 @@ UIScrollViewDelegate
|
|
|
/* 打卡 */
|
|
|
- (void)clockInClick:(UIButton *)btn {
|
|
|
|
|
|
- if (self.stateView.stateType == HJClockInStateTypeGoWork)
|
|
|
+ if (self.clockView.stateView.stateType == HJClockInStateTypeGoWork)
|
|
|
{//上班打卡
|
|
|
- self.stateView.clockInButton.userInteractionEnabled = NO;
|
|
|
+ self.clockView.stateView.clockInButton.userInteractionEnabled = NO;
|
|
|
self.clockInAPI.clockType = @"1";
|
|
|
self.clockInAPI.wsPunchClockId = @"";
|
|
|
- [self locationShowLoading:YES clockInAPI:YES];
|
|
|
+ self.clockInAPI.latitude = self.latitude;
|
|
|
+ self.clockInAPI.longitude = self.longitude;
|
|
|
+ [self.clockInAPI start];
|
|
|
}
|
|
|
- if (self.stateView.stateType == HJClockInStateTypeAfterWork)
|
|
|
+ if (self.clockView.stateView.stateType == HJClockInStateTypeAfterWork)
|
|
|
{//下班打卡
|
|
|
- self.stateView.clockInButton.userInteractionEnabled = NO;
|
|
|
+ self.clockView.stateView.clockInButton.userInteractionEnabled = NO;
|
|
|
self.clockInAPI.clockType = @"2";
|
|
|
self.clockInAPI.wsPunchClockId = self.infoModel.wsPunchClockId;
|
|
|
- [self locationShowLoading:YES clockInAPI:YES];
|
|
|
+ self.clockInAPI.latitude = self.latitude;
|
|
|
+ self.clockInAPI.longitude = self.longitude;
|
|
|
+ [self.clockInAPI start];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* 重新定位 */
|
|
|
- (void)retryButtonAction:(UIButton *)tap {
|
|
|
|
|
|
- [self locationShowLoading:YES clockInAPI:NO];
|
|
|
+ [self locationShowLoadingView:NO showLoading:YES];
|
|
|
}
|
|
|
|
|
|
/* 下拉刷新 */
|
|
|
- (void)loadNewData {
|
|
|
|
|
|
[self.refreshHeader beginRefreshing];
|
|
|
- [self locationShowLoading:YES clockInAPI:NO];
|
|
|
+ [self locationShowLoadingView:NO showLoading:YES];
|
|
|
}
|
|
|
|
|
|
-#pragma mark - lazy
|
|
|
+#pragma mark -- 布局
|
|
|
+- (void)initAddClickView {
|
|
|
|
|
|
-- (FBScrollLayoutView *)scrollLayoutView {
|
|
|
-
|
|
|
- if (_scrollLayoutView == nil)
|
|
|
+ [self.view addSubview:self.scrollView];
|
|
|
+ [self.scrollView addSubview:self.clockView];
|
|
|
+ self.scrollView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
|
+ self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT+1);
|
|
|
+ self.scrollView.contentOffset = CGPointMake(0, 0);
|
|
|
+ if (SCREEN_HEIGHT >= 812)
|
|
|
{
|
|
|
- _scrollLayoutView = [[FBScrollLayoutView alloc] init];
|
|
|
- _scrollLayoutView.delegate = self;
|
|
|
- [_scrollLayoutView az_setGradientBackgroundWithColors:@[COLOR_F5F5F5,COLOR_F5F5F5] locations:@[@(0.0),@(1.0f)] startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
|
|
- _scrollLayoutView.contentView.backgroundColor = COLOR_F5F5F5;
|
|
|
- _scrollLayoutView.scrollView.mj_header = self.refreshHeader;
|
|
|
- _scrollLayoutView.scrollView.delegate = self;
|
|
|
- // 去除顶部空白
|
|
|
- if (@available(iOS 11.0, *))
|
|
|
- {
|
|
|
- _scrollLayoutView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- self.automaticallyAdjustsScrollViewInsets = NO;
|
|
|
- }
|
|
|
+ self.clockView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-STATUS_BAR_H - NAVIGATION_BAR_H - 49-34);
|
|
|
}
|
|
|
- return _scrollLayoutView;
|
|
|
-}
|
|
|
-- (HJClockInAuthView *)authView {
|
|
|
-
|
|
|
- if (_authView == nil)
|
|
|
+ else
|
|
|
{
|
|
|
- _authView = [[HJClockInAuthView alloc] init];
|
|
|
- [_authView.authenticationBtn addTarget:self action:@selector(authenticationBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [_authView.ruleBtn addTarget:self action:@selector(ruleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ self.clockView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-STATUS_BAR_H - NAVIGATION_BAR_H - 49);
|
|
|
}
|
|
|
- return _authView;
|
|
|
+ [self.clockView.infoView.lookBtn layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleRight imageTitleSpace:5];
|
|
|
}
|
|
|
-- (HJClockInInfoView *)infoView {
|
|
|
+
|
|
|
+#pragma mark - lazy
|
|
|
+
|
|
|
+- (UIScrollView *)scrollView {
|
|
|
|
|
|
- if (_infoView == nil)
|
|
|
+ if (_scrollView == nil)
|
|
|
{
|
|
|
- _infoView = [[HJClockInInfoView alloc] init];
|
|
|
- [_infoView.statisticsButton addTarget:self action:@selector(statisticsButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [_infoView.ruleButton addTarget:self action:@selector(ruleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [_infoView.serviceButton addTarget:self action:@selector(serviceButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _scrollView = [[UIScrollView alloc] init];
|
|
|
+ _scrollView.mj_header = self.refreshHeader;
|
|
|
+ if (@available(iOS 11.0, *))
|
|
|
+ {
|
|
|
+ _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
|
+ }
|
|
|
}
|
|
|
- return _infoView;
|
|
|
+ return _scrollView;
|
|
|
}
|
|
|
-- (HJClockInStateView *)stateView {
|
|
|
+- (HJClockView *)clockView {
|
|
|
|
|
|
- if (_stateView == nil)
|
|
|
+ if (_clockView == nil)
|
|
|
{
|
|
|
- _stateView = [[HJClockInStateView alloc] init];
|
|
|
- [_stateView.clockInButton addTarget:self action:@selector(clockInClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [_stateView.retryButton addTarget:self action:@selector(retryButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _clockView = [[HJClockView alloc] init];
|
|
|
+ [_clockView.infoView.lookBtn addTarget:self action:@selector(statisticsButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_clockView.stateView.clockInButton addTarget:self action:@selector(clockInClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_clockView.stateView.retryButton addTarget:self action:@selector(retryButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
- return _stateView;
|
|
|
+ return _clockView;
|
|
|
}
|
|
|
-- (HJClockInRuleView *)ruleView {
|
|
|
+
|
|
|
+- (HJClockInAuthView *)authView {
|
|
|
|
|
|
- if (_ruleView == nil)
|
|
|
+ if (_authView == nil)
|
|
|
{
|
|
|
- _ruleView = [[HJClockInRuleView alloc] init];
|
|
|
- [_ruleView.ruleButton addTarget:self action:@selector(ruleButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _authView = [[HJClockInAuthView alloc] init];
|
|
|
+ [_authView.authenticationBtn addTarget:self action:@selector(authenticationBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
- return _ruleView;
|
|
|
+ return _authView;
|
|
|
}
|
|
|
+
|
|
|
- (AMapLocationManager *)locationManager {
|
|
|
|
|
|
if (_locationManager == nil)
|
|
|
@@ -554,6 +539,16 @@ UIScrollViewDelegate
|
|
|
}
|
|
|
return _dataBox;
|
|
|
}
|
|
|
+- (HJGetUserInfoAPIManager *)userInfoAPI {
|
|
|
+
|
|
|
+ if (_userInfoAPI == nil)
|
|
|
+ {
|
|
|
+ _userInfoAPI = [[HJGetUserInfoAPIManager alloc]init];
|
|
|
+ _userInfoAPI.APIManagerDelegate = self;
|
|
|
+ _userInfoAPI.APIManagerInterceptor = self;
|
|
|
+ }
|
|
|
+ return _userInfoAPI;
|
|
|
+}
|
|
|
- (HJClockInInfoAPI *)clockInInfoAPI {
|
|
|
|
|
|
if (_clockInInfoAPI == nil)
|
|
|
@@ -583,5 +578,14 @@ UIScrollViewDelegate
|
|
|
}
|
|
|
return _refreshHeader;
|
|
|
}
|
|
|
-
|
|
|
+- (UIButton *)customerServiceBtn {
|
|
|
+
|
|
|
+ if (_customerServiceBtn == nil)
|
|
|
+ {
|
|
|
+ _customerServiceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [_customerServiceBtn setImage:[UIImage imageNamed:@"clockin_customerService"] forState:UIControlStateNormal];
|
|
|
+ [_customerServiceBtn addTarget:self action:@selector(customerServiceClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ }
|
|
|
+ return _customerServiceBtn;
|
|
|
+}
|
|
|
@end
|