|
@@ -21,7 +21,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
-@interface JYNewMineViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,SKProductsRequestDelegate>
|
|
|
+@interface JYNewMineViewController ()<WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler,CLLocationManagerDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate,SKProductsRequestDelegate,WBFaceVerifyCustomerServiceDelegate,ZKClipboardViewDelegate>
|
|
|
{
|
|
|
CGPoint startTouch;
|
|
|
BOOL _isMoving;
|
|
@@ -32,6 +32,8 @@
|
|
|
@property(nonatomic, assign)BOOL updateNotify;
|
|
|
@property(nonatomic, strong)NoNetView *noNetView;
|
|
|
@property(nonatomic, strong)UIPanGestureRecognizer *recognizer;
|
|
|
+@property(nonatomic, strong)ZKClipboardView *clipboardView;
|
|
|
+@property(nonatomic, strong)ZKFaceVerifyMsgView *verifyMsgView;
|
|
|
|
|
|
@end
|
|
|
|
|
@@ -51,6 +53,17 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
[self webViewFirstRequest];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//弹框
|
|
|
+-(ZKFaceVerifyMsgView *)verifyMsgView
|
|
|
+{
|
|
|
+ if(!_verifyMsgView) {
|
|
|
+ _verifyMsgView = [[ZKFaceVerifyMsgView alloc]initWithFrame:CGRectMake(0, 0, WIDTH*0.8, 150)];
|
|
|
+ _verifyMsgView.titleName = @"温馨提示";
|
|
|
+ }
|
|
|
+ return _verifyMsgView;
|
|
|
+}
|
|
|
+
|
|
|
//进度条
|
|
|
- (UIProgressView *)progressView
|
|
|
{
|
|
@@ -61,6 +74,16 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
return _progressView;
|
|
|
}
|
|
|
+//弹框
|
|
|
+-(ZKClipboardView *)clipboardView
|
|
|
+{
|
|
|
+ if(!_clipboardView) {
|
|
|
+ _clipboardView = [[ZKClipboardView alloc]initWithFrame:CGRectMake(0, 0, WIDTH*0.8, 175)];
|
|
|
+ _clipboardView.delegate = self;
|
|
|
+ }
|
|
|
+ return _clipboardView;
|
|
|
+}
|
|
|
+
|
|
|
//懒加载
|
|
|
- (WKWebView *)webView
|
|
|
{
|
|
@@ -98,6 +121,9 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
@"inPurchasingVip",
|
|
|
@"wirteRight",
|
|
|
@"clearRight",
|
|
|
+ @"savePic",
|
|
|
+ @"ocrVerifyService",
|
|
|
+ @"faceVerifyService",
|
|
|
];
|
|
|
for (NSString*jsName in jsArr) {
|
|
|
[config.userContentController addScriptMessageHandler:self name:jsName];
|
|
@@ -312,6 +338,12 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
[self jsWirteRight:message.body];
|
|
|
}else if ([message.name isEqualToString:@"clearRight"]) {
|
|
|
[self jsClearRight:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"savePic"]) {
|
|
|
+ [self jsSavePic:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"ocrVerifyService"]) {
|
|
|
+ [self jsOcrVerifyService:message.body];
|
|
|
+ }else if ([message.name isEqualToString:@"faceVerifyService"]) {
|
|
|
+ [self jsFaceVerifyService:message.body];
|
|
|
}else {
|
|
|
|
|
|
}
|
|
@@ -397,7 +429,7 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
-(void)isExitCallToJS:(NSString *)jsStr withMethodName:(NSString *)name{
|
|
|
NSString *jsName = [NSString stringWithFormat:@"function exist(){return !window['%@']};exist()",name];
|
|
|
[_webView evaluateJavaScript:jsName completionHandler:^(id _Nullable result, NSError * _Nullable error) {
|
|
|
- NSLog(@"是否存在 result:%@,error:%@",result,error);
|
|
|
+// NSLog(@"是否存在 result:%@,error:%@",result,error);
|
|
|
if ([result intValue]==0) {
|
|
|
[self executeCallJS:jsStr];
|
|
|
}else {
|
|
@@ -437,6 +469,7 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
|
|
|
//监听底部栏
|
|
|
[NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(bottomFourListening) userInfo:nil repeats:YES];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)bottomFourListening {
|
|
@@ -893,6 +926,107 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
[[LXViewControllerManager shareViewControllerManager] showHudOnlyText:appName delay:2];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+#pragma mark *****人脸核身
|
|
|
+//ocr验证
|
|
|
+-(void)jsOcrVerifyService:(NSDictionary *)dict{
|
|
|
+ NSLog(@"ocr:%@",dict);
|
|
|
+ NSString *orderNo = [NSString stringWithFormat:@"%@",dict[@"orderNo"]];
|
|
|
+ NSString *nonce = [NSString stringWithFormat:@"%@",dict[@"nonce"]];
|
|
|
+ NSString *userId = [NSString stringWithFormat:@"%@",dict[@"userId"]];
|
|
|
+ NSString *sign = [NSString stringWithFormat:@"%@",dict[@"sign"]];
|
|
|
+ kMainQueue((^{
|
|
|
+ WBOCRConfig *config = [WBOCRConfig sharedConfig];
|
|
|
+ config.needRecordVideo = NO;
|
|
|
+ config.SDKType = WBOCRSDKTypeIDCardNormal; // 身份证两面识别
|
|
|
+ [[WBOCRService sharedService] startOCRServiceWithConfig:config version:@"1.0.0" appId:OCRAPPID nonce:nonce userId:userId sign:sign orderNo:orderNo startSucceed:^{
|
|
|
+ /** SDK服务拉起成功回调 */
|
|
|
+ NSLog(@"启动SDK成功!!!");
|
|
|
+ } recognizeSucceed:^(id _Nonnull resultModel, id _Nullable extension) {
|
|
|
+ /** SDK本次识别成功回调 */
|
|
|
+ NSLog(@"SDK识别成功!!!");
|
|
|
+ //调用js - 告知成功
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"ocrVerifyResult('%@')",orderNo];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"getParam"];
|
|
|
+ } failed:^(NSError * _Nonnull error, id _Nullable extension) {
|
|
|
+ /** SDK异常回调 */
|
|
|
+ NSLog(@"识别出错!!!"); //200101 用户取消操作
|
|
|
+ //弹出页面
|
|
|
+ if (error.code == 200101) {
|
|
|
+ self.verifyMsgView.descTitle = @"您取消了身份验证";
|
|
|
+ }else {
|
|
|
+ self.verifyMsgView.descTitle = @"身份验证失败";
|
|
|
+ }
|
|
|
+ [self.verifyMsgView show];
|
|
|
+
|
|
|
+ }];
|
|
|
+ }));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+//人脸核身
|
|
|
+-(void)jsFaceVerifyService:(NSDictionary *)dict {
|
|
|
+ NSLog(@"face:%@",dict);
|
|
|
+ NSString *orderNo = [NSString stringWithFormat:@"%@",dict[@"orderNo"]];
|
|
|
+ NSString *nonce = [NSString stringWithFormat:@"%@",dict[@"nonce"]];
|
|
|
+ NSString *userId = [NSString stringWithFormat:@"%@",dict[@"userId"]];
|
|
|
+ NSString *sign = [NSString stringWithFormat:@"%@",dict[@"sign"]];
|
|
|
+ NSString *faceId = [NSString stringWithFormat:@"%@",dict[@"faceId"]];
|
|
|
+ kMainQueue((^{
|
|
|
+ [WBFaceVerifyCustomerService sharedInstance].delegate = self;
|
|
|
+ WBFaceVerifySDKConfig *config = [WBFaceVerifySDKConfig sdkConfig];
|
|
|
+ config.recordVideo = NO;
|
|
|
+ config.theme = WBFaceVerifyThemeDarkness;
|
|
|
+ [[WBFaceVerifyCustomerService sharedInstance] loginInLiveCheckAndCompareWithSourceImageService:userId nonce:nonce sign:sign appid:OCRAPPID orderNo:orderNo apiVersion:@"1.0.0" licence:LICENCE faceType:WBFaceVerifyLivingType_Action faceId:faceId sdkConfig:config success:^{
|
|
|
+
|
|
|
+ } failure:^(WBFaceError * _Nonnull error) {
|
|
|
+ self.verifyMsgView.descTitle = @"活体检测失败";
|
|
|
+ [self.verifyMsgView show];
|
|
|
+ }];
|
|
|
+ }));
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - WBFaceVerifyCustomerServiceDelegate
|
|
|
+-(void)wbfaceVerifyCustomerServiceDidFinishedWithFaceVerifyResult:(WBFaceVerifyResult *)faceVerifyResult{
|
|
|
+ if (faceVerifyResult.isSuccess) {
|
|
|
+ NSLog(@"活体检测成功:%@",faceVerifyResult.orderNo);
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"faceVerifyResult('%@')",faceVerifyResult.orderNo];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"faceEnd"];
|
|
|
+ self.verifyMsgView.descTitle = @"活体检测成功";
|
|
|
+ [self.verifyMsgView show];
|
|
|
+ }else {
|
|
|
+ NSLog(@"活体检测失败");
|
|
|
+ self.verifyMsgView.descTitle = @"活体检测失败";
|
|
|
+ [self.verifyMsgView show];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//保存图片到相册
|
|
|
+#pragma mark 保存图片
|
|
|
+-(void)jsSavePic:(NSDictionary *)dict {
|
|
|
+ NSString *base64ImgData = [NSString stringWithFormat:@"%@",dict[@"imgbase64"]];
|
|
|
+ base64ImgData = [base64ImgData stringByReplacingOccurrencesOfString:@"data:image/png;base64," withString:@""];
|
|
|
+ NSData *data = [[NSData alloc]initWithBase64EncodedString:base64ImgData options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
|
|
+ UIImage *saveImg = [UIImage imageWithData:data];
|
|
|
+ UIImageWriteToSavedPhotosAlbum(saveImg, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL);
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 系统的完成保存图片的方法
|
|
|
+- (void)image: (UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo
|
|
|
+{
|
|
|
+ NSString *msg = nil ;
|
|
|
+ if (error != NULL) {
|
|
|
+ msg = @"保存图片失败" ;
|
|
|
+ } else {
|
|
|
+ msg = @"保存图片成功" ;
|
|
|
+ }
|
|
|
+ [[LXViewControllerManager shareViewControllerManager] showHudOnlyText:msg delay:1];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
|
|
|
#pragma mark 粘贴板
|
|
|
-(void)jsWirteRight:(NSDictionary *)dict {
|
|
@@ -1300,9 +1434,10 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
}
|
|
|
}
|
|
|
-(void)alipayWXpayStatus:(NSNotification *)notification{
|
|
|
-
|
|
|
- NSString * status = [notification object];
|
|
|
- [self performSelector:@selector(payStatus:) withObject:status afterDelay:2];
|
|
|
+ if(self.tabBarController.selectedIndex == 3) {
|
|
|
+ NSString * status = [notification object];
|
|
|
+ [self performSelector:@selector(payStatus:) withObject:status afterDelay:2];
|
|
|
+ }
|
|
|
}
|
|
|
-(void)payStatus:(NSString *)status
|
|
|
{
|
|
@@ -1403,15 +1538,50 @@ NSString *const new_AesKey_4 = @"mGlAgnIBB8bx2nch";
|
|
|
//粘贴板相关-梳理
|
|
|
-(void)updateClipboard:(NSNotification *)notificaition{
|
|
|
if(self.tabBarController.selectedIndex == 3) {
|
|
|
+ NSString *current_url = [self stringByEvaluatingJavaScriptFromString:@"document.location.href"];
|
|
|
NSDictionary *dict = notificaition.userInfo;
|
|
|
NSString *content = [NSString stringWithFormat:@"%@",dict[@"content"]];
|
|
|
- //调用js
|
|
|
- NSString *textJS = [NSString stringWithFormat:@"distribInfo('%@')",content];
|
|
|
- [self isExitCallToJS:textJS withMethodName:@"distribInfo"];
|
|
|
-
|
|
|
+ if ([current_url containsString:@"jyapp/free/login"]) {
|
|
|
+ NSLog(@"登录页面-调用js");
|
|
|
+ NSString *textJS = [NSString stringWithFormat:@"distribInfo('%@')",content];
|
|
|
+ [self isExitCallToJS:textJS withMethodName:@"distribInfo"];
|
|
|
+
|
|
|
+ }else {
|
|
|
+
|
|
|
+ [[LXNetworkManager shareLXNetworkManager]postWithURLStr:[NSString stringWithFormat:@"%@distribution/share/getWordInfo",kHost] parameters:@{@"copyTxt":content} progress:^(NSProgress *progress) {
|
|
|
+ NSLog(@"%@",progress);
|
|
|
+ } success:^(id responseObject) {
|
|
|
+ NSLog(@"responseObject=%@",responseObject);
|
|
|
+ if ([responseObject objectForKey:@"data"]) {
|
|
|
+ NSDictionary *dict = [[NSDictionary alloc]initWithDictionary:responseObject[@"data"]];
|
|
|
+ self.clipboardView.title =dict[@"title"];
|
|
|
+ self.clipboardView.subTitle =dict[@"subTitle"];
|
|
|
+ self.clipboardView.imgUrl =dict[@"imgUrl"];
|
|
|
+ self.clipboardView.appUrl =dict[@"appUrl"];
|
|
|
+ self.clipboardView.butTxt =dict[@"butTxt"];
|
|
|
+ self.clipboardView.bottomTxt =dict[@"bottomTxt"];
|
|
|
+ [self.clipboardView show];
|
|
|
+ }
|
|
|
+ } failure:^(NSError *error) {
|
|
|
+ NSLog(@"error=%@",error);
|
|
|
+ }];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#pragma mark **** 代理方法
|
|
|
+-(void)clipboardClick:(NSString *)url {
|
|
|
+ NSString *tmpUrl = [NSString stringWithFormat:@"%@%@", kHost, url];
|
|
|
+ tmpUrl = [tmpUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
|
+ kMainQueue(^{
|
|
|
+ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:tmpUrl]]];
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-(void)clearWeb{
|
|
|
NSURLCache * cache = [NSURLCache sharedURLCache];
|