Explorar o código

3.3.9,短信验证的添加

15555599100 %!s(int64=5) %!d(string=hai) anos
pai
achega
d7deb56537

+ 10 - 4
HappyJob/HappyJob.xcodeproj/project.pbxproj

@@ -116,6 +116,7 @@
 		713E8DB92372C30C00EE66DC /* HJMyIntegralAlipayPayAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 713E8DB82372C30C00EE66DC /* HJMyIntegralAlipayPayAPI.m */; };
 		714396AE236A6A5C00EA1789 /* WechatPay.m in Sources */ = {isa = PBXBuildFile; fileRef = 714396AD236A6A5C00EA1789 /* WechatPay.m */; };
 		714396B1236A6BDA00EA1789 /* AlipayPay.m in Sources */ = {isa = PBXBuildFile; fileRef = 714396B0236A6BDA00EA1789 /* AlipayPay.m */; };
+		7144F24B24B7667E003F00F4 /* HJSMSValidationWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7144F24A24B7667E003F00F4 /* HJSMSValidationWebView.m */; };
 		71465FCC239F61E4004FBF7D /* HJReturnFeeDataBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 71465FCB239F61E4004FBF7D /* HJReturnFeeDataBox.m */; };
 		71465FCF239F64CE004FBF7D /* HJReturnFeeListAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 71465FCE239F64CE004FBF7D /* HJReturnFeeListAPI.m */; };
 		71465FD2239F6ED7004FBF7D /* HJReturnFeeDetailAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 71465FD1239F6ED7004FBF7D /* HJReturnFeeDetailAPI.m */; };
@@ -701,6 +702,8 @@
 		714396AD236A6A5C00EA1789 /* WechatPay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WechatPay.m; sourceTree = "<group>"; };
 		714396AF236A6BDA00EA1789 /* AlipayPay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AlipayPay.h; sourceTree = "<group>"; };
 		714396B0236A6BDA00EA1789 /* AlipayPay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AlipayPay.m; sourceTree = "<group>"; };
+		7144F24924B7667E003F00F4 /* HJSMSValidationWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HJSMSValidationWebView.h; sourceTree = "<group>"; };
+		7144F24A24B7667E003F00F4 /* HJSMSValidationWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HJSMSValidationWebView.m; sourceTree = "<group>"; };
 		71465FCA239F61E4004FBF7D /* HJReturnFeeDataBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HJReturnFeeDataBox.h; sourceTree = "<group>"; };
 		71465FCB239F61E4004FBF7D /* HJReturnFeeDataBox.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HJReturnFeeDataBox.m; sourceTree = "<group>"; };
 		71465FCD239F64CE004FBF7D /* HJReturnFeeListAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HJReturnFeeListAPI.h; sourceTree = "<group>"; };
@@ -2962,6 +2965,8 @@
 				C41393E3225324CE009F61FE /* HJLoginAgreementView.m */,
 				713CBBCF2444A5C200D9F011 /* HJLoginCodeView.h */,
 				713CBBD02444A5C200D9F011 /* HJLoginCodeView.m */,
+				7144F24924B7667E003F00F4 /* HJSMSValidationWebView.h */,
+				7144F24A24B7667E003F00F4 /* HJSMSValidationWebView.m */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -4685,6 +4690,7 @@
 				C4109C432251E559007A2FC1 /* HJLoginWeChatLoginAPIManager.m in Sources */,
 				C41907D1227EBF5B00E1F482 /* HJBenefitDetailDataBox.m in Sources */,
 				C40F6EF2225E25B80034BEF8 /* HJBenefitDetailHeaderView.m in Sources */,
+				7144F24B24B7667E003F00F4 /* HJSMSValidationWebView.m in Sources */,
 				715E5CDC22D2D32800AAFA24 /* BHomeCertificationingEnterpriseVC.m in Sources */,
 				C4F657AA224DAE6800E1E625 /* FBNetworkingConfig.m in Sources */,
 				714A0130235810BC0090EBB6 /* HJMyIntegralExchangeRecordModel.m in Sources */,
@@ -5057,7 +5063,7 @@
 				CODE_SIGN_ENTITLEMENTS = HappyJob/HappyJob.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 2;
 				DEVELOPMENT_TEAM = 6TLH64Q4Z4;
 				GCC_PREFIX_HEADER = "HappyJob/HappyJob-Prefix.pch";
 				INFOPLIST_FILE = HappyJob/Info.plist;
@@ -5066,7 +5072,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.3.5;
+				MARKETING_VERSION = 3.3.9;
 				PRODUCT_BUNDLE_IDENTIFIER = com.huijiabo.kaixing;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -5083,7 +5089,7 @@
 				CODE_SIGN_ENTITLEMENTS = HappyJob/HappyJob.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 3;
+				CURRENT_PROJECT_VERSION = 2;
 				DEVELOPMENT_TEAM = 6TLH64Q4Z4;
 				GCC_PREFIX_HEADER = "HappyJob/HappyJob-Prefix.pch";
 				INFOPLIST_FILE = HappyJob/Info.plist;
@@ -5092,7 +5098,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 3.3.5;
+				MARKETING_VERSION = 3.3.9;
 				PRODUCT_BUNDLE_IDENTIFIER = com.huijiabo.kaixing;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 1 - 2
HappyJob/HappyJob/CClass/Home_首页/HJHomeViewController.m

@@ -240,7 +240,7 @@ HJPageListViewDelegate
     
     UIButton * imageV = (UIButton *)pan.view ;
     CGPoint point = [pan translationInView:imageV] ;
-    pan.view.transform =CGAffineTransformTranslate(pan.view.transform, point.x, point.y);
+    pan.view.transform = CGAffineTransformTranslate(pan.view.transform, point.x, point.y);
     [pan setTranslation:CGPointZero inView:pan.view];
 }
 
@@ -277,7 +277,6 @@ HJPageListViewDelegate
     {
         return [self.pageListView manager:manager shouldStartCallAPIWithParams:params];
     }
-    
     return YES;
 }
 

+ 26 - 19
HappyJob/HappyJob/CClass/Me_我/Reward_入职奖励/ViewController/HJReturnFeeCodeViewController.m

@@ -9,16 +9,17 @@
 #import "HJReturnFeeCodeViewController.h"
 #import "HJReturnFeeListViewController.h"
 #import "HJSalaryCodeView.h"
-#import "HJLoginGetAuthCodeAPIManager.h"//获取验证码
+//#import "HJLoginGetAuthCodeAPIManager.h"//获取验证码
 #import "HJSalaryAuthAPIManager.h"//校验验证码
+#import "HJSMSValidationWebView.h"//短信验证
 
 @interface HJReturnFeeCodeViewController ()<FBAPIManagerDelegate>
 
 @property (nonatomic, strong) HJSalaryCodeView *codeView;
 @property (nonatomic, assign) NSInteger        second;//定时器,时间
 @property (nonatomic, strong) NSTimer          *timer;//定时器
-
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获取验证码
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
+//@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获取验证码
 @property (nonatomic, strong) HJSalaryAuthAPIManager       *salaryAuthAPIManager;
 
 @end
@@ -37,6 +38,7 @@
     
     [super viewDidDisappear:animated];
     [self.timer invalidate];
+    [self.validationWebView removeFromSuperview];
 }
 
 - (void)viewDidLoad {
@@ -111,13 +113,18 @@
 
 - (void)codeButtonClick:(UIButton *)btn {
     
-    self.codeView.codeBtn.userInteractionEnabled = NO;
-    self.codeView.phonelabel.text = [NSString stringWithFormat:@"已发送验证码至%@",[HJMemberInfoModel memberInfo].phone];
-    [self.codeView.codeView.textView becomeFirstResponder];
-    self.getAuthCodeAPIManager.phone = [HJMemberInfoModel memberInfo].phone;
-    [self.getAuthCodeAPIManager start];
-    self.second = 60;
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(runTimer) userInfo:self repeats:YES];
+    __weak typeof(self) weakSelf = self;
+    [self.validationWebView removeFromSuperview];
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:[HJMemberInfoModel memberInfo].phone];
+    self.validationWebView.successfulBlock = ^{
+        
+        weakSelf.codeView.codeBtn.userInteractionEnabled = NO;
+        weakSelf.codeView.phonelabel.text = [NSString stringWithFormat:@"已发送验证码至%@",[HJMemberInfoModel memberInfo].phone];
+        [weakSelf.codeView.codeView.textView becomeFirstResponder];
+        weakSelf.second = 60;
+        weakSelf.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:weakSelf selector:@selector(runTimer) userInfo:weakSelf repeats:YES];
+    };
 }
 
 - (void)runTimer {
@@ -165,15 +172,15 @@
     return _salaryAuthAPIManager;
 }
 
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
+//- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
+//
+//    if (_getAuthCodeAPIManager == nil)
+//    {
+//        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
+//        _getAuthCodeAPIManager.APIManagerDelegate = self;
+//    }
+//    return _getAuthCodeAPIManager;
+//}
 /*
 #pragma mark - Navigation
 

+ 1 - 0
HappyJob/HappyJob/CClass/Me_我/Salary_薪资查询/SalaryAPIManager/HJSalaryListAPIManager.m

@@ -44,6 +44,7 @@
 }
 
 - (NSString *)methodName {
+    
     return @"payroll/myPayRollList";
 }
 

+ 26 - 19
HappyJob/HappyJob/CClass/Me_我/Salary_薪资查询/ViewController/HJSalaryCodeViewController.m

@@ -10,11 +10,11 @@
 #import "HJSalaryAgreementViewController.h"
 #import "HJSalaryDataBox.h"
 #import "HJSalaryDetailViewController.h"
-#import "HJLoginGetAuthCodeAPIManager.h"
 #import "HJSalaryAuthAPIManager.h"
 #import "HJUserInfoModel.h"
 #import "HJSalaryCodeView.h"
 #import "HJSalaryListViewController.h"//薪资查询列表
+#import "HJSMSValidationWebView.h"//短信验证
 
 @interface HJSalaryCodeViewController ()
 <
@@ -25,8 +25,8 @@ FBAPIManagerDelegate
 @property (nonatomic, strong) HJSalaryDataBox  *dataBox;
 @property (nonatomic, assign) NSInteger        second;//倒计时时间
 @property (nonatomic, strong) NSTimer          *timer;//定时器
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获取验证码
-@property (nonatomic, strong) HJSalaryAuthAPIManager       *salaryAuthAPIManager;//校验验证码
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
+@property (nonatomic, strong) HJSalaryAuthAPIManager  *salaryAuthAPIManager;//校验验证码
 
 @end
 
@@ -44,6 +44,7 @@ FBAPIManagerDelegate
     
     [super viewDidDisappear:animated];
     [self.timer invalidate];
+    [self.validationWebView removeFromSuperview];
 }
 
 - (void)viewDidLoad {
@@ -88,13 +89,19 @@ FBAPIManagerDelegate
 /* 获取验证码 */
 - (void)codeButtonClick:(UIButton *)btn {
 
-    self.codeView.codeBtn.userInteractionEnabled = NO;
-    [self.codeView.codeView.textView becomeFirstResponder];
-    self.codeView.phonelabel.text = [NSString stringWithFormat:@"验证码已发送至%@",[HJMemberInfoModel memberInfo].phone];
-    self.second = 60;
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(runTimer) userInfo:self repeats:YES];
-    self.getAuthCodeAPIManager.phone = [HJMemberInfoModel memberInfo].phone;
-    [self.getAuthCodeAPIManager start];
+    __weak typeof(self) weakSelf = self;
+    [self.validationWebView removeFromSuperview];
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:[HJMemberInfoModel memberInfo].phone];
+    self.validationWebView.successfulBlock = ^{
+        
+        weakSelf.codeView.codeBtn.userInteractionEnabled = NO;
+        [weakSelf.codeView.codeView.textView becomeFirstResponder];
+        weakSelf.codeView.phonelabel.text = [NSString stringWithFormat:@"验证码已发送至%@",[HJMemberInfoModel memberInfo].phone];
+        weakSelf.second = 60;
+        weakSelf.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:weakSelf selector:@selector(runTimer) userInfo:weakSelf repeats:YES];
+    };
+       
 }
 
 - (void)runTimer {
@@ -189,14 +196,14 @@ FBAPIManagerDelegate
     return _salaryAuthAPIManager;
 }
 
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
+//- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
+//    
+//    if (_getAuthCodeAPIManager == nil)
+//    {
+//        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
+//        _getAuthCodeAPIManager.APIManagerDelegate = self;
+//    }
+//    return _getAuthCodeAPIManager;
+//}
 
 @end

+ 22 - 0
HappyJob/HappyJob/Login_登录/View/HJSMSValidationWebView.h

@@ -0,0 +1,22 @@
+//
+//  HJSMSValidationWebView.h
+//  HappyJob
+//
+//  Created by 张晓光 on 2020/7/9.
+//  Copyright © 2020 Bob. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <WebKit/WebKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface HJSMSValidationWebView : UIView<WKNavigationDelegate,WKScriptMessageHandler>
+
+@property (nonatomic, strong) WKWebView *webView;
+@property (nonatomic, copy) void(^successfulBlock)(void);
+- (void)createWebViewPhone:(NSString *)phone;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 106 - 0
HappyJob/HappyJob/Login_登录/View/HJSMSValidationWebView.m

@@ -0,0 +1,106 @@
+//
+//  HJSMSValidationWebView.m
+//  HappyJob
+//
+//  Created by 张晓光 on 2020/7/9.
+//  Copyright © 2020 Bob. All rights reserved.
+//
+
+#import "HJSMSValidationWebView.h"
+
+@implementation HJSMSValidationWebView
+
+- (instancetype)initWithFrame:(CGRect)frame {
+    
+    if (self = [super initWithFrame:frame])
+    {
+        self.frame = [UIScreen mainScreen].bounds;
+    }
+    return self;
+}
+
+- (void)createWebViewPhone:(NSString *)phone {
+    
+    __weak typeof(self) weakself = self;
+    [[self.webView configuration].userContentController addScriptMessageHandler:weakself name:@"returnVerificationCode"];
+    [[[[UIApplication sharedApplication] delegate] window] addSubview:self];
+    [self addSubview:self.webView];
+    
+    [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
+       
+        make.center.equalTo(weakself);
+        make.size.mas_equalTo(CGSizeMake(300, 300));
+    }];
+    
+
+//    dispatch_async(dispatch_get_main_queue(), ^{
+        
+        NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?phone=%@",kSMSValidation,phone]]];
+        [self.webView loadRequest:request];
+        
+//    });
+    
+    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapClick)];
+    [self addGestureRecognizer:tap];
+    
+}
+- (void)tapClick {
+    
+    [self removeFromSuperview];
+}
+#pragma mark - WWKNavigationDelegate
+
+//开始加载,页面开始加载.可以在这里做加载动画,然后在加载完成代理里面移除动画即可!
+-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
+    
+    self.backgroundColor = [UIColor colorFromHexString:@"000000" Alpha:0.5];
+}
+
+//网络错误
+-(void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error{
+    
+}
+
+//网页加载完成
+-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
+
+    //设置JS
+//    NSString *js = @"document.getElementsByTagName('h1')[0].innerText";
+//    //执行JS
+//    [webView evaluateJavaScript:js completionHandler:^(id _Nullable response, NSError * _Nullable error) {
+//        NSLog(@"value: %@ error: %@", response, error);
+//
+//    }];
+}
+
+
+#pragma mark - WLScriptMessageHandler
+//js传递过来的数据
+-(void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
+{
+    //0认证成功,2关闭页面
+    [self removeFromSuperview];
+    NSString *code = message.body;
+    if ([code isEqualToString:@"0"])
+    {
+        self.successfulBlock();
+    }
+}
+
+#pragma mark - lazy
+
+- (WKWebView *)webView {
+    
+    if (_webView == nil)
+    {
+        WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
+        _webView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];
+        _webView.navigationDelegate = self;
+        [_webView setOpaque:NO];
+        _webView.layer.cornerRadius = 5;
+        _webView.layer.masksToBounds = YES;
+    }
+    return _webView;
+}
+
+@end

+ 36 - 14
HappyJob/HappyJob/Login_登录/ViewController/HJLoginBindPhoneViewController.m

@@ -10,9 +10,9 @@
 #import "HJLoginPhoneView.h"
 #import "HJLoginInfoMergeViewController.h"//合并简历
 #import "HJMainViewController.h"
-#import "HJLoginGetAuthCodeAPIManager.h"
 #import "HJLoginDataBox.h"
 #import "HJWeChatLoginViewController.h"
+#import "HJSMSValidationWebView.h"//短信验证
 
 
 @interface HJLoginBindPhoneViewController () <FBScrollLayoutViewDelegate, FBAPIManagerDelegate, FBAPIManagerInterceptor>
@@ -22,8 +22,8 @@
 @property (nonatomic, strong) UIButton             *codeButton;
 
 @property (nonatomic, strong) HJMainViewController         *mainViewController;
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;
 @property (nonatomic, strong) HJLoginDataBox               *dataBox;
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
 
 @end
 
@@ -31,6 +31,12 @@
 
 #pragma mark - life cycle
 
+- (void)viewDidDisappear:(BOOL)animated {
+    
+    [super viewDidDisappear:animated];
+    [self.validationWebView removeFromSuperview];
+    self.codeButton.userInteractionEnabled = YES;
+}
 - (void)viewWillAppear:(BOOL)animated {
     
     [super viewWillAppear:animated];
@@ -147,8 +153,24 @@
         [self.view fb_showFailureWithStatus:@"请输入正确的手机号"];
         return;
     }
-    self.getAuthCodeAPIManager.phone = self.naviView.phoneTF.text;
-    [self.getAuthCodeAPIManager start];
+    
+    __weak typeof(self) weakSelf = self;
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:self.naviView.phoneTF.text];
+    self.validationWebView.successfulBlock = ^{
+        
+        weakSelf.codeButton.userInteractionEnabled = NO;
+        HJWeChatLoginViewController *WeChatVC = [[HJWeChatLoginViewController alloc] init];
+        WeChatVC.bindingPhoneAPIManager = weakSelf.bindingPhoneAPIManager;
+        WeChatVC.phoneStr = weakSelf.naviView.phoneTF.text;
+        [weakSelf.navigationController pushViewController:WeChatVC animated:YES];
+    };
+       
+    
+    
+    
+//    self.getAuthCodeAPIManager.phone = self.naviView.phoneTF.text;
+//    [self.getAuthCodeAPIManager start];
 }
 
 #pragma mark - private methods
@@ -163,16 +185,16 @@
     }
     return _dataBox;
 }
-
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
+//
+//- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
+//    
+//    if (_getAuthCodeAPIManager == nil)
+//    {
+//        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
+//        _getAuthCodeAPIManager.APIManagerDelegate = self;
+//    }
+//    return _getAuthCodeAPIManager;
+//}
 
 - (HJMainViewController *)mainViewController {
     

+ 23 - 18
HappyJob/HappyJob/Login_登录/ViewController/HJLoginCodeViewController.m

@@ -9,26 +9,32 @@
 #import "HJLoginCodeViewController.h"
 #import "HJLoginCodeView.h"
 #import "HJLoginDataBox.h"
-#import "HJLoginGetAuthCodeAPIManager.h"
 #import "HJLoginPhoneLoginAPIManager.h"
 #import "HJLoginInfoMergeViewController.h"
 #import "HJLogonLog.h"//登录日志
-
+#import "HJSMSValidationWebView.h"
 
 @interface HJLoginCodeViewController ()<FBAPIManagerDelegate,FBAPIManagerInterceptor>
  
 @property (nonatomic, strong) HJLoginCodeView  *codeView;
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获得验证码
 @property (nonatomic, strong) HJLoginPhoneLoginAPIManager  *phoneLoginAPIManager;//手机号登录
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
 @property (nonatomic, assign) NSInteger         second;
 @property (nonatomic, strong) NSTimer           *timer;
 
+
 @end
 
 @implementation HJLoginCodeViewController
 
 #pragma mark - life cycle
 
+- (void)viewDidDisappear:(BOOL)animated {
+    
+    [super viewDidDisappear:animated];
+    [self.validationWebView removeFromSuperview];
+}
+
 - (void)viewWillAppear:(BOOL)animated {
     
     [super viewWillAppear:animated];
@@ -106,6 +112,7 @@
 - (void)managerCallAPIDidFailed:(FBBaseAPIManager *)manager {
     
     NSDictionary *errorDict = [manager fetchDataWithBox:nil];
+    
     if ([errorDict[@"errcode"] integerValue] == 4000)
     {
         HJConfirmPanelViewController *vc = [[HJConfirmPanelViewController alloc] init];
@@ -137,14 +144,21 @@
     
     [self.navigationController popViewControllerAnimated:YES];
 }
+/* webView */
 - (void)codeBtnClick:(UIButton *)btn {
+
+    __weak typeof(self) weakSelf = self;
     
-    self.getAuthCodeAPIManager.phone = self.phoneStr;
-    [self.getAuthCodeAPIManager start];
-    btn.userInteractionEnabled = NO;
-    self.second = 60;
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(runTimer) userInfo:self repeats:YES];
-    
+    [self.validationWebView removeFromSuperview];
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:self.phoneStr];
+    self.validationWebView.successfulBlock = ^{
+        
+        btn.userInteractionEnabled = NO;
+        weakSelf.second = 60;
+        weakSelf.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:weakSelf selector:@selector(runTimer) userInfo:weakSelf repeats:YES];
+    };
+   
 }
 - (void)runTimer {
     
@@ -186,13 +200,4 @@
     return _phoneLoginAPIManager;
 }
 
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
 @end

+ 29 - 22
HappyJob/HappyJob/Login_登录/ViewController/HJLoginPhoneViewController.m

@@ -18,11 +18,10 @@
 
 #import "HJLoginDataBox.h"
 #import "HJWeiXinAPIManager.h"
-#import "HJLoginGetAuthCodeAPIManager.h"
+//#import "HJLoginGetAuthCodeAPIManager.h"
 #import "HJloginWeChatLoginAPIManager.h"
-
 #import "HJLogonLog.h"//登录日志
-
+#import "HJSMSValidationWebView.h"//短信验证
 
 @interface HJLoginPhoneViewController ()
 <
@@ -43,16 +42,24 @@ FBAPIManagerInterceptor
 @property (nonatomic, strong) HJMainViewController *mainViewController;
 @property (nonatomic, strong) BMainViewController  *bmainTabBar;
 
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获得验证码
 @property (nonatomic, strong) HJWeiXinAPIManager           *wxAPIManager;//微信
 @property (nonatomic, strong) HJLoginWeChatLoginAPIManager *wechatLgoinAPIManager;//微信登录
 
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
+
+
 @end
 
 @implementation HJLoginPhoneViewController
 
 #pragma mark - life cycle
 
+- (void)viewDidDisappear:(BOOL)animated {
+    
+    [super viewDidDisappear:animated];
+    [self.validationWebView removeFromSuperview];
+}
+
 - (void)viewWillAppear:(BOOL)animated {
     
     [super viewWillAppear:animated];
@@ -90,7 +97,10 @@ FBAPIManagerInterceptor
     [vc title:vc.titleLabel.text cancelTitle:@"" confirmTitle:@"" singleTitle:@"好的" hiddenSingleButton:NO];
     [vc.singleButton addTarget:self action:@selector(editButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
     [self presentViewController:vc animated:YES completion:nil];
+    
+    self.wechatLoginButton.hidden = YES;
 }
+
 - (void)editButtonClicked:(UIButton *)btn {
     
     [self dismissViewControllerAnimated:NO completion:^{
@@ -189,12 +199,10 @@ FBAPIManagerInterceptor
     HJLoginDataBox *loginDataBox = [[HJLoginDataBox alloc] init];
     id fetchData = [manager fetchDataWithBox:loginDataBox];
 
-    if (manager == self.getAuthCodeAPIManager)
-    {
-        HJLoginCodeViewController *loginVC = [[HJLoginCodeViewController alloc] init];
-        loginVC.phoneStr = self.phoneView.phoneTF.text;
-        [self.navigationController pushViewController:loginVC animated:YES];
-    }
+//    if (manager == self.getAuthCodeAPIManager)
+//    {//验证码获取成功
+//
+//    }
     if (manager == self.wechatLgoinAPIManager && self.wechatLgoinAPIManager.type == HJLoginWeChatLoginAPIManagerTypeNotBinding)
     {
         if ([fetchData[@"errcode"] integerValue] == 0)
@@ -272,8 +280,17 @@ FBAPIManagerInterceptor
         [self.view fb_showFailureWithStatus:@"请输入正确的手机号"];
         return;
     }
-   self.getAuthCodeAPIManager.phone = self.phoneView.phoneTF.text;
-   [self.getAuthCodeAPIManager start];
+    
+    __weak typeof(self) weakSelf = self;
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:self.phoneView.phoneTF.text];
+    self.validationWebView.successfulBlock = ^{
+        
+      HJLoginCodeViewController *loginVC = [[HJLoginCodeViewController alloc] init];
+      loginVC.phoneStr = weakSelf.phoneView.phoneTF.text;
+      [weakSelf.navigationController pushViewController:loginVC animated:YES];
+        
+    };
 
 }
 
@@ -300,16 +317,6 @@ FBAPIManagerInterceptor
 
 #pragma mark - lazy
 
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
-
 - (HJLoginWeChatLoginAPIManager *)wechatLgoinAPIManager {
     
     if (_wechatLgoinAPIManager == nil)

+ 0 - 9
HappyJob/HappyJob/Login_登录/ViewController/HJLoginUserAgreementViewController.m

@@ -47,11 +47,7 @@
     if (self.uesr)
     {
         self.title = @"开心工作用户协议";
-//        NSString *path = [[NSBundle mainBundle] pathForResource:@"用户协议" ofType:@"docx"];
-//        NSURL *url = [NSURL fileURLWithPath:path];
-//        [_webView loadRequest:[NSURLRequest requestWithURL:url]];
 
-        
         NSString *urlStr = [NSString stringWithFormat:@"%@%@",kHJWebBaseURL,@"/apk-download/uploadfiles/security/userAgreement.html"];
         [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
         WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init];
@@ -64,11 +60,6 @@
     else
     {
         self.title = @"开心工作隐私政策";
-//        NSString *path = [[NSBundle mainBundle] pathForResource:@"隐私政策" ofType:@"docx"];
-//        NSURL *url = [NSURL fileURLWithPath:path];
-//
-//        [_webView loadRequest:[NSURLRequest requestWithURL:url]];
-        
         NSString *urlStr = [NSString stringWithFormat:@"%@%@",kHJWebBaseURL,@"/apk-download/uploadfiles/security/privacyPolicy.html"];
          [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlStr]]];
         WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc]init];

+ 28 - 16
HappyJob/HappyJob/Login_登录/ViewController/HJWeChatLoginViewController.m

@@ -9,16 +9,18 @@
 #import "HJWeChatLoginViewController.h"
 #import "HJLoginCodeView.h"
 #import "HJLoginDataBox.h"
-#import "HJLoginGetAuthCodeAPIManager.h"
+//#import "HJLoginGetAuthCodeAPIManager.h"
 #import "HJLoginInfoMergeViewController.h"
 #import "HJLoginBindPhoneAPIManager.h"
 #import "HJLogonLog.h"//登录日志
+#import "HJSMSValidationWebView.h"//短信验证
 
 @interface HJWeChatLoginViewController ()<FBAPIManagerDelegate,FBAPIManagerInterceptor>
 
 @property (nonatomic, strong) HJLoginCodeView  *codeView;
 @property (nonatomic, strong) HJLoginDataBox   *dataBox;
-@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获得验证码
+//@property (nonatomic, strong) HJLoginGetAuthCodeAPIManager *getAuthCodeAPIManager;//获得验证码
+@property (nonatomic, strong) HJSMSValidationWebView *validationWebView;
 @property (nonatomic, assign) NSInteger         second;
 @property (nonatomic, strong) NSTimer           *timer;
 
@@ -134,13 +136,21 @@
     
     [self dismissViewControllerAnimated:NO completion:nil];
 }
+- (void)backClick:(UIButton *)btn {
+    
+    [self.navigationController popViewControllerAnimated:YES];
+}
 - (void)codeBtnClick:(UIButton *)btn {
     
-    self.getAuthCodeAPIManager.phone = self.phoneStr;
-    [self.getAuthCodeAPIManager start];
-    btn.userInteractionEnabled = NO;
-    self.second = 60;
-    self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(runTimer) userInfo:self repeats:YES];
+    __weak typeof(self) weakSelf = self;
+    self.validationWebView = [[HJSMSValidationWebView alloc] init];
+    [self.validationWebView createWebViewPhone:self.phoneStr];
+    self.validationWebView.successfulBlock = ^{
+        
+        btn.userInteractionEnabled = NO;
+        weakSelf.second = 60;
+        weakSelf.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:weakSelf selector:@selector(runTimer) userInfo:weakSelf repeats:YES];
+    };
 }
 - (void)runTimer {
     
@@ -167,9 +177,11 @@
         _codeView.titleLabel.text = @"输入验证码";
         _codeView.codeTitleLabel.text = [NSString stringWithFormat:@"验证码已发送至 %@",self.phoneStr];
         [_codeView.codeBtn addTarget:self action:@selector(codeBtnClick:) forControlEvents:UIControlEventTouchUpInside];
+        [_codeView.backBtn addTarget:self action:@selector(backClick:) forControlEvents:UIControlEventTouchUpInside];
     }
     return _codeView;
 }
+
 - (HJLoginDataBox *)dataBox {
     
     if (_dataBox == nil)
@@ -179,14 +191,14 @@
     return _dataBox;
 }
 
-- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
-    
-    if (_getAuthCodeAPIManager == nil)
-    {
-        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
-        _getAuthCodeAPIManager.APIManagerDelegate = self;
-    }
-    return _getAuthCodeAPIManager;
-}
+//- (HJLoginGetAuthCodeAPIManager *)getAuthCodeAPIManager {
+//    
+//    if (_getAuthCodeAPIManager == nil)
+//    {
+//        _getAuthCodeAPIManager = [[HJLoginGetAuthCodeAPIManager alloc] init];
+//        _getAuthCodeAPIManager.APIManagerDelegate = self;
+//    }
+//    return _getAuthCodeAPIManager;
+//}
 
 @end

+ 13 - 11
HappyJob/HappyJob/Support/HJConfig.h

@@ -10,22 +10,24 @@
 #define HJConfig_h
 
 /* ---- 测试服接口地址 ------*/
-//static NSString * const kHJBaseURL = @"https://kf.hap-job.com/happyjob/f/api/";
-//static NSString * const kHJWebBaseURL = @"https://kf.hap-job.com/";
-//static NSString * const kBuglyAppID = @"d3e4636207";
-//static NSString * const kWeiXinAPIKey = @"wx9c053f7126db0b28";
-//static NSString * const kuniversalLink = @"https://kf.hap-job.com/happyjob/";
+static NSString * const kHJBaseURL = @"https://kf.hap-job.com/happyjob/f/api/";
+static NSString * const kHJWebBaseURL = @"https://kf.hap-job.com/";
+static NSString * const kBuglyAppID = @"d3e4636207";
+static NSString * const kWeiXinAPIKey = @"wx9c053f7126db0b28";
+static NSString * const kuniversalLink = @"https://kf.hap-job.com/happyjob/";
+static NSString * const kSMSValidation = @"https://dk.hap-job.com/captcha/captcha";
 
 
 /* ------ 正式服接口地址 -------*/
-static NSString * const kHJBaseURL = @"https://web.hap-job.com/happyjob/f/api/";
-static NSString * const kHJWebBaseURL = @"https://web.hap-job.com";
-static NSString * const kBuglyAppID = @"b532795704";
-static NSString * const kWeiXinAPIKey = @"wxeb8c2418a8ace030";
-static NSString * const kuniversalLink = @"https://web.hap-job.com/happyjob/";
+//static NSString * const kHJBaseURL = @"https://web.hap-job.com/happyjob/f/api/";
+//static NSString * const kHJWebBaseURL = @"https://web.hap-job.com";
+//static NSString * const kBuglyAppID = @"b532795704";
+//static NSString * const kWeiXinAPIKey = @"wxeb8c2418a8ace030";
+//static NSString * const kuniversalLink = @"https://web.hap-job.com/happyjob/";
+//static NSString * const kSMSValidation = @"https://tw.hap-job.com/captcha/captcha";
 
 
-/* ---------公共的---------- */
+/* -------- 公共的 --------- */
 static NSString * const kGAODEAPIKey = @"ec6c542ecc7faeaac443d9c2a0b74d67";//高德地图API
 static NSString * const kCustomerServiceURL = @"http://s.zhimakf.com/s/15421ibrr";//客服