Commit b5c77c912ea11fcb37c7d2d4a09a2815ea1edcae

Authored by yinqiaojuan
2 parents c73a123a 45f72e8e
CNLiveBPersonalVerificationModule.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveBPersonalVerificationModule'
11   - s.version = '0.1.1'
  11 + s.version = '0.1.2'
12 12 s.summary = 'B端个人资料认证开发'
13 13  
14 14  
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Controller/ApplyForShootController.m
... ... @@ -8,7 +8,6 @@
8 8  
9 9 #import "ApplyForShootController.h"
10 10 #import <AipOcrSdk/AipOcrSdk.h>
11   -#import <objc/runtime.h>
12 11 #import "AFNetworking.h"
13 12 #import "ApplyForShootCell.h"
14 13 #import "ApplyForConfirmCell.h"
... ... @@ -28,8 +27,9 @@
28 27 #import <CNLiveImagePickerController/TZImagePickerController.h>
29 28 #import <CNLiveImagePickerController/TZImageManager.h>
30 29 #import <CNLiveCommonCategory/CNLiveCommonCategory.h>
  30 +#import "CNLiveIDCardAuthAlertView.h"
31 31 #import "CNLiveBPersonAuthentProtocol.h"
32   -@interface ApplyForShootController ()<UIAlertViewDelegate,UITableViewDelegate,UITableViewDataSource,UINavigationControllerDelegate, UIImagePickerControllerDelegate>
  32 +@interface ApplyForShootController ()<UITableViewDelegate,UITableViewDataSource,UINavigationControllerDelegate, UIImagePickerControllerDelegate, IDCardAuthAlertViewDelegate>
33 33  
34 34 @property (nonatomic, strong) UITableView *tableView;
35 35 @property (nonatomic, strong) NSArray <AgreementModel*>*dataArray;
... ... @@ -66,50 +66,20 @@
66 66 [super viewDidLoad];
67 67 self.title = @"拍摄照片";
68 68 self.view.backgroundColor = [UIColor whiteColor];
  69 + self.edgesForExtendedLayout = UIRectEdgeNone;
  70 +// self.extendedLayoutIncludesOpaqueBars = YES;
69 71 self.imageDatas = [NSMutableArray array];
70 72 self.pickerVC = [[UIImagePickerController alloc] init];
71 73 self.pickerVC.delegate = self;
72 74 [[AipOcrService shardService] authWithAK:BDAppKey andSK:BDSecret];
73 75 [self loadData];
74 76 [self.view addSubview:self.tableView];
75   -// if (@available(iOS 11.0, *)) {
76   -// self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
77   -// }else{
78   -// self.automaticallyAdjustsScrollViewInsets = NO;
79   -// }
80   - [self configCallback];
81   -
82   -}
83   -
84   -- (void)loadData {
85   -
86   - NSArray *array = @[
87   - @{
88   - @"shootTitle":@"第一步",
89   - @"shootImage":@"observer_idcard_front",
90   - @"isFront":@"1",
91   - @"isOwn":@"0"
92   - },
93   - @{
94   - @"shootTitle":@"第二步",
95   - @"shootImage":@"observer_idcard_back",
96   - @"isFront":@"0",
97   - @"isOwn":@"0"
98   - },
99   - @{
100   - @"shootTitle":@"第三步",
101   - @"shootImage":@"observer_idcard_own",
102   - @"isFront":@"0",
103   - @"isOwn":@"1"
104   - },
105   - ];
106   - NSMutableArray *arrayM = [NSMutableArray array];
107   - for (NSDictionary *dic in array) {
108   - AgreementModel *model = [AgreementModel mj_objectWithKeyValues:dic];
109   - [arrayM addObject:model];
  77 + if (@available(iOS 11.0, *)) {
  78 + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  79 + }else{
  80 + self.automaticallyAdjustsScrollViewInsets = NO;
110 81 }
111   - self.dataArray = arrayM.copy;
112   - [self.tableView reloadData];
  82 + [self configCallback];
113 83  
114 84 }
115 85  
... ... @@ -119,6 +89,9 @@
119 89  
120 90 // 这是默认的识别成功的回调
121 91 _successHandler = ^(id result){
  92 + dispatch_async(dispatch_get_main_queue(), ^{
  93 + [weakSelf dismissViewControllerAnimated:YES completion:nil];
  94 + });
122 95 if (!weakSelf.isHandler) {
123 96 return ;
124 97 }
... ... @@ -132,12 +105,13 @@
132 105 if (weakSelf.isFont) { ///////// 前
133 106 if ([dict count] < 6) {
134 107 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
135   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  108 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf];
136 109 [alertView show];
137 110 weakSelf.isFontSucc = NO;
138 111 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
139 112 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
140 113 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  114 + cell.hideChangeLab = YES;
141 115 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
142 116 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
143 117 }];
... ... @@ -146,24 +120,26 @@
146 120 } else {
147 121 if ([dict count] < 3) {
148 122 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
149   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  123 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf];
150 124 [alertView show];
151 125 weakSelf.isBackSucc = NO;
152 126 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
153 127 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
154 128 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  129 + cell.hideChangeLab = YES;
155 130 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
156 131 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
157 132 }];
158 133 return ;
159 134 } else if ([[CNLiveTimeTools getyyMMddStr] integerValue] > [dict[@"失效日期"][@"words"] integerValue] && ![[NSString stringWithFormat:@"%@",dict[@"失效日期"][@"words"]] isEqualToString:@"长期"]) {
160 135 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
161   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"身份证已失效,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  136 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"身份证已失效,请重新拍摄" delegate:weakSelf];
162 137 [alertView show];
163 138 weakSelf.isBackSucc = NO;
164 139 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
165 140 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
166 141 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  142 + cell.hideChangeLab = YES;
167 143 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
168 144 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
169 145 }];
... ... @@ -186,7 +162,7 @@
186 162 }else{
187 163 [message appendFormat:@"%@: %@\n", key, obj];
188 164 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
189   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,获取信息失败,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  165 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,获取信息失败,请重新拍摄" delegate:weakSelf];
190 166 [alertView show];
191 167 weakSelf.isDataSucc = NO;
192 168 if (weakSelf.isFont) {
... ... @@ -194,6 +170,7 @@
194 170 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
195 171 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
196 172 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  173 + cell.hideChangeLab = YES;
197 174 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
198 175 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
199 176 } else {
... ... @@ -201,6 +178,7 @@
201 178 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
202 179 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
203 180 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  181 + cell.hideChangeLab = YES;
204 182 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
205 183 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
206 184 }
... ... @@ -221,10 +199,14 @@
221 199 weakSelf.idCardNo = dict[@"公民身份号码"][@"words"];
222 200 weakSelf.address = dict[@"住址"][@"words"];
223 201 weakSelf.isFontSucc = YES;
224   -
  202 + NSString *message = [NSString stringWithFormat:@"姓名:%@\n身份证号码:%@\n住址:%@",weakSelf.realName,weakSelf.idCardNo,weakSelf.address];
  203 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:@"请确认身份证信息是否准确" message:message delegate:weakSelf];
  204 + alertView.messageLabTextAlignmentLeft = YES;
  205 + [alertView show];
225 206 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
226 207 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
227 208 cell.imgV.image = weakSelf.fontImage;
  209 + cell.hideChangeLab = NO;
228 210 if (weakSelf.isBackSucc && weakSelf.isOwnSucc) {
229 211 weakSelf.confirmCell.confirmButton.backgroundColor = RGBA(76, 170, 252, 1);
230 212 [weakSelf.confirmCell.confirmButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
... ... @@ -235,6 +217,7 @@
235 217 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
236 218 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
237 219 cell.imgV.image = weakSelf.backImage;
  220 + cell.hideChangeLab = NO;
238 221 if (weakSelf.isFontSucc && weakSelf.isOwnSucc) {
239 222 weakSelf.confirmCell.confirmButton.backgroundColor = RGBA(76, 170, 252, 1);
240 223 [weakSelf.confirmCell.confirmButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
... ... @@ -256,12 +239,13 @@
256 239 if (weakSelf.isFont) {
257 240 if ([array count] < 6) {
258 241 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
259   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  242 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf];
260 243 [alertView show];
261 244 weakSelf.isFontSucc = NO;
262 245 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
263 246 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
264 247 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  248 + cell.hideChangeLab = YES;
265 249 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
266 250 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
267 251 }];
... ... @@ -270,12 +254,13 @@
270 254 } else {
271 255 if ([array count] < 3) {
272 256 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
273   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  257 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,信息不全,请重新拍摄" delegate:weakSelf];
274 258 [alertView show];
275 259 weakSelf.isBackSucc = NO;
276 260 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
277 261 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
278 262 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  263 + cell.hideChangeLab = YES;
279 264 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
280 265 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
281 266 }];
... ... @@ -289,7 +274,7 @@
289 274 }else{
290 275 [message appendFormat:@"%@\n", obj];
291 276 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
292   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片不规范,信息获取失败,请重新拍摄" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  277 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片不规范,信息获取失败,请重新拍摄" delegate:weakSelf];
293 278 [alertView show];
294 279 weakSelf.isDataSucc = NO;
295 280 if (weakSelf.isFont) {
... ... @@ -297,6 +282,7 @@
297 282 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
298 283 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
299 284 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  285 + cell.hideChangeLab = YES;
300 286 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
301 287 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
302 288 } else {
... ... @@ -304,6 +290,7 @@
304 290 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
305 291 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
306 292 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  293 + cell.hideChangeLab = YES;
307 294 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
308 295 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
309 296 }
... ... @@ -328,10 +315,14 @@
328 315 }
329 316 }];
330 317 }
331   -
  318 + NSString *message = [NSString stringWithFormat:@"姓名:%@\n身份证号码:%@\n住址:%@",weakSelf.realName,weakSelf.idCardNo,weakSelf.address];
  319 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:@"请确认身份证信息是否准确" message:message delegate:weakSelf];
  320 + alertView.messageLabTextAlignmentLeft = YES;
  321 + [alertView show];
332 322 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
333 323 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
334 324 cell.imgV.image = weakSelf.fontImage;
  325 + cell.hideChangeLab = NO;
335 326 if (weakSelf.isBackSucc && weakSelf.isOwnSucc) {
336 327 weakSelf.confirmCell.confirmButton.backgroundColor = RGBA(76, 170, 252, 1);
337 328 [weakSelf.confirmCell.confirmButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
... ... @@ -342,6 +333,7 @@
342 333 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
343 334 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
344 335 cell.imgV.image = weakSelf.backImage;
  336 + cell.hideChangeLab = NO;
345 337 if (weakSelf.isFontSucc && weakSelf.isOwnSucc) {
346 338 weakSelf.confirmCell.confirmButton.backgroundColor = RGBA(76, 170, 252, 1);
347 339 [weakSelf.confirmCell.confirmButton setTitleColor:kWhiteColor forState:UIControlStateNormal];
... ... @@ -355,13 +347,14 @@
355 347 }else{
356 348 [message appendFormat:@"%@", result];
357 349 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
358   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:@"照片识别失败,请重试" delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  350 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:title message:@"照片识别失败,请重试" delegate:weakSelf];
359 351 [alertView show];
360 352 if (weakSelf.isFont) {
361 353 weakSelf.isFontSucc = NO;
362 354 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
363 355 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
364 356 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  357 + cell.hideChangeLab = YES;
365 358 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
366 359 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
367 360 } else {
... ... @@ -369,6 +362,7 @@
369 362 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
370 363 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
371 364 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  365 + cell.hideChangeLab = YES;
372 366 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
373 367 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
374 368 }
... ... @@ -377,6 +371,9 @@
377 371 };
378 372  
379 373 _failHandler = ^(NSError *error){
  374 + dispatch_async(dispatch_get_main_queue(), ^{
  375 + [weakSelf dismissViewControllerAnimated:YES completion:nil];
  376 + });
380 377 if (!weakSelf.isHandler) {
381 378 return ;
382 379 }
... ... @@ -390,13 +387,14 @@
390 387 errorMsg = @"识别失败,请重拍";
391 388 }
392 389 [[NSOperationQueue mainQueue] addOperationWithBlock:^{
393   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"识别结果" message:[NSString stringWithFormat:@"%@",errorMsg] delegate:weakSelf cancelButtonTitle:@"确定" otherButtonTitles:nil];
  390 + CNLiveIDCardAuthAlertView *alertView = [[CNLiveIDCardAuthAlertView alloc] initWithTitle:@"识别结果" message:[NSString stringWithFormat:@"%@",errorMsg] delegate:weakSelf];
394 391 [alertView show];
395 392 if (weakSelf.isFont) {
396 393 weakSelf.isFontSucc = NO;
397 394 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
398 395 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
399 396 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  397 + cell.hideChangeLab = YES;
400 398 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
401 399 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
402 400 } else {
... ... @@ -404,6 +402,7 @@
404 402 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
405 403 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
406 404 cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[ApplyForShootController class]];
  405 + cell.hideChangeLab = YES;
407 406 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
408 407 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
409 408 }
... ... @@ -411,75 +410,8 @@
411 410 };
412 411 }
413 412  
414   -#pragma mark - 调用百度SDK 拍照Action !!!!!!!!!!!!!!!!
415   -- (void)takePhoto:(BOOL)isFront {
416   -
417   - self.isHandler = YES;
418   - AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
419   - if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
420   - {
421   - //无权限
422   - NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
423   -
424   - NSString *appName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
425   - if (appName == nil)
426   - {
427   - appName = @"APP";
428   - }
429   -// NSString *errorStr = @"无相机权限,请在设置中启用";
430   - NSString *message = [NSString stringWithFormat:@"请在iPhone的“设置-隐私”选项中,允许%@访问你的相机。", appName];
431   -
432   - UIAlertController *actionAlert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert];
433   -// UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
434   -// // 引导去设置
435   -// NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
436   -// if ([[UIApplication sharedApplication]canOpenURL:url]) {
437   -// [[UIApplication sharedApplication]openURL:url];
438   -// }
439   -// }];
440   - UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleCancel handler:NULL];
441   - [actionAlert addAction:action2];
442   -// [actionAlert addAction:action1];
443   - [self presentViewController:actionAlert animated:YES completion:nil];
444   -
445   -// [QMUITips showError:errorStr inView:self.view hideAfterDelay:1.5f];
446   - return;
447   - }
448   -
449   - if (isFront) {
450   - _isFont = YES;
451   - UIViewController * vc =
452   - [AipCaptureCardVC ViewControllerWithCardType:CardTypeIdCardFont
453   - andImageHandler:^(UIImage *image) {
454   -
455   - self.fontImage = image;
456   - [[AipOcrService shardService] detectIdCardFrontFromImage:image
457   - withOptions:nil
458   - successHandler:_successHandler
459   - failHandler:_failHandler];
460   - }];
461   -
462   - [self presentViewController:vc animated:YES completion:nil];
463   -
464   - } else if (!isFront) {
465   -
466   - _isFont = NO;
467   - UIViewController * vc =
468   - [AipCaptureCardVC ViewControllerWithCardType:CardTypeIdCardBack
469   - andImageHandler:^(UIImage *image) {
470   -
471   - self.backImage = image;
472   - [[AipOcrService shardService] detectIdCardBackFromImage:image
473   - withOptions:nil
474   - successHandler:_successHandler
475   - failHandler:_failHandler];
476   - }];
477   - [self presentViewController:vc animated:YES completion:nil];
478   - }
479   -}
480   -
481 413 #pragma mark -
482   -#pragma mark - 提交 Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  414 +#pragma mark - 提交 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
483 415 - (void)submit:(UIButton *)sender {
484 416  
485 417 sender.selected = !sender.selected;
... ... @@ -574,23 +506,7 @@
574 506 }];
575 507 }
576 508  
577   -#pragma mark - Action !!!!!!!!!!!!!!!!!!!
578   -- (void)backAction
579   -{
580   -// if (self.delegate && [self.delegate respondsToSelector:@selector(completeRefresh)]) {
581   -// [self.delegate completeRefresh];
582   -// }
583   -// [[AppDelegate sharedAppDelegate] popToRootViewController];
584   - [self.navigationController popViewControllerAnimated:YES];
585   -}
586   -
587   -- (BOOL)shouldPopViewControllerByBackButtonOrPopGesture:(BOOL)byPopGesture {
588   -
589   - [self backAction];
590   - return NO;
591   -}
592   -
593   -#pragma mark - Image 转 Data !!!!!!!!!!!!!!!!!!!!!!!!!!!!
  509 +// Image 转 Data
594 510 - (NSData *)imageDatasWithImage:(UIImage *)image {
595 511  
596 512 NSData *imageData;
... ... @@ -602,82 +518,105 @@
602 518 return imageData;
603 519 }
604 520  
605   -#pragma mark - UITableViewDataSource
606   -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
607   - return 1;
608   -}
609   -
610   -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
611   - return self.dataArray.count+1;
612   -}
613   -
614   -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  521 +#pragma mark - 调用百度SDK识别 !!!!!!!!!!!!!!!!
  522 +- (void)goToBaiDuOrcController:(BOOL)isFront {
615 523  
616   - if (indexPath.row < self.dataArray.count) {
617   - AgreementModel *model = self.dataArray[indexPath.row];
618   - NSString *shootCellId = [NSString stringWithFormat:@"%zd",indexPath.row];
619   - ApplyForShootCell *cell = [tableView dequeueReusableCellWithIdentifier:shootCellId];
620   - if (!cell) {
621   - cell = [[ApplyForShootCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:shootCellId];
622   - cell.model = model;
623   - cell.selectionStyle = UITableViewCellSelectionStyleNone;
624   - }
625   - __weak __typeof(self)weakSelf = self;
626   - cell.clickShootBtnBlock = ^() {
627   - if (model.isOwn) {
628   - //拍照||相册
629   - [weakSelf iconAction];
630   - } else {
631   - //身份证
632   - [weakSelf takePhoto:model.isFront];
633   - }
634   - };
635   - return cell;
  524 + self.isHandler = YES;
  525 + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
  526 + if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
  527 + {
  528 + //无权限
  529 + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
636 530  
637   - } else {
638   - NSString *confirmCellId = [NSString stringWithFormat:@"%zd",indexPath.row];
639   - ApplyForConfirmCell *cell = [tableView dequeueReusableCellWithIdentifier:confirmCellId];
640   - if (!cell) {
641   - cell = [[ApplyForConfirmCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:confirmCellId];
  531 + NSString *appName = [infoDictionary objectForKey:@"CFBundleDisplayName"];
  532 + if (appName == nil)
  533 + {
  534 + appName = @"APP";
642 535 }
643   - cell.selectionStyle = UITableViewCellSelectionStyleNone;
644   - AgreementModel *model = [[AgreementModel alloc] init];
645   - model.confirmTitle = @"下一步";
646   - cell.model = model;
647   - __weak __typeof(self)weakSelf = self;
648   - cell.clickBtnBlock = ^(UIButton *btn){
649   - [weakSelf submit:btn];
650   - };
651   - self.confirmCell = cell;
652   - return cell;
653   - }
  536 +// NSString *errorStr = @"无相机权限,请在设置中启用";
  537 + NSString *message = [NSString stringWithFormat:@"请在iPhone的“设置-隐私”选项中,允许%@访问你的相机。", appName];
  538 +
  539 + UIAlertController *actionAlert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert];
  540 +// UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"去设置" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  541 +// // 引导去设置
  542 +// NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
  543 +// if ([[UIApplication sharedApplication]canOpenURL:url]) {
  544 +// [[UIApplication sharedApplication]openURL:url];
  545 +// }
  546 +// }];
  547 + UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"好的" style:UIAlertActionStyleCancel handler:NULL];
  548 + [actionAlert addAction:action2];
  549 +// [actionAlert addAction:action1];
  550 + [self presentViewController:actionAlert animated:YES completion:nil];
654 551  
  552 +// [QMUITips showError:errorStr inView:self.view hideAfterDelay:1.5f];
  553 + return;
  554 + }
  555 +
  556 + if (isFront) {
  557 + _isFont = YES;
  558 + UIViewController * vc =
  559 + [AipCaptureCardVC ViewControllerWithCardType:CardTypeIdCardFont
  560 + andImageHandler:^(UIImage *image) {
  561 +
  562 + self.fontImage = image;
  563 + [[AipOcrService shardService] detectIdCardFrontFromImage:image
  564 + withOptions:nil
  565 + successHandler:_successHandler
  566 + failHandler:_failHandler];
  567 + }];
  568 +
  569 + [self presentViewController:vc animated:YES completion:nil];
  570 +
  571 + } else if (!isFront) {
  572 +
  573 + _isFont = NO;
  574 + UIViewController * vc =
  575 + [AipCaptureCardVC ViewControllerWithCardType:CardTypeIdCardBack
  576 + andImageHandler:^(UIImage *image) {
  577 +
  578 + self.backImage = image;
  579 + [[AipOcrService shardService] detectIdCardBackFromImage:image
  580 + withOptions:nil
  581 + successHandler:_successHandler
  582 + failHandler:_failHandler];
  583 + }];
  584 + [self presentViewController:vc animated:YES completion:nil];
  585 + }
655 586 }
656 587  
657   -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
658   - if (indexPath.row < self.dataArray.count) {
659   - if (indexPath.row == 2) {
660   - return 299;
  588 +// 自拍cell点击事件
  589 +- (void)clickedIconImageAction {
  590 + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
  591 + if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied) && iOS7Later) {
  592 + // 无权限 做一个友好的提示
  593 + [self goPrivacySetting];
  594 + } else if (authStatus == AVAuthorizationStatusNotDetermined) {
  595 + // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏
  596 + if (iOS7Later) {
  597 + [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
  598 + if (granted) {
  599 + dispatch_sync(dispatch_get_main_queue(), ^{
  600 + [self showBottomSelectView];
  601 + });
  602 + }
  603 + }];
661 604 } else {
662   - return 256;
  605 + [self showBottomSelectView];
663 606 }
664 607 } else {
665   - if (kNavigationBarHeight+256*2+145<KScreenHeight) {
666   - return KScreenHeight-kNavigationBarHeight-256*2;
667   - } else {
668   - return 145;
669   - }
  608 + [self showBottomSelectView];
670 609 }
671 610 }
672 611  
673   -#pragma mark - 自拍
674   --(void)photoBtnClick {
  612 +#pragma mark - 显示下方选择拍照/相册视图
  613 +-(void)showBottomSelectView {
675 614  
676 615 __weak __typeof(self)weakSelf = self;
677 616 [self.view createAlertViewTitleArray:@[@"拍照",@"从手机相册选择"] subTitleArr:@[@"",@""] textColor:RGBA(76, 170, 252, 1) subTitleColor:[UIColor whiteColor] firstFont:UIFontMake(18.0f) font:UIFontMake(18.0f) subFont:UIFontMake(18.0f) cancelTitle:@"取消" cancelFont:UIFontMake(18.0f) cancelTitleColor:UIColorMake(102, 102, 102) actionBlock:^(UIButton *button, NSInteger didRow) {
678 617 switch (didRow) {
679 618 case 0:{
680   - [weakSelf takeToXFPhoto];
  619 + [weakSelf pushXTPhoto];
681 620 }
682 621 break;
683 622 case 1:{
... ... @@ -690,8 +629,8 @@
690 629 }];
691 630 }
692 631  
693   -#pragma mark - 跳转到相机
694   --(void)takeToXFPhoto {
  632 +#pragma mark - 跳转到系统相机
  633 +-(void)pushXTPhoto {
695 634 if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
696 635 self.pickerVC.sourceType = UIImagePickerControllerSourceTypeCamera;
697 636 //设置拍照后的图片可被编辑
... ... @@ -742,6 +681,7 @@
742 681 NSIndexPath *index = [NSIndexPath indexPathForRow:2 inSection:0];
743 682 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
744 683 cell.imgV.image = image;
  684 + cell.hideChangeLab = NO;
745 685 weakSelf.isOwnSucc = YES;
746 686 weakSelf.iconImage = image;
747 687 if (weakSelf.isFontSucc && weakSelf.isBackSucc) {
... ... @@ -772,29 +712,6 @@
772 712 [picker dismissViewControllerAnimated:YES completion:^{}];
773 713 }
774 714  
775   -// 自拍cell点击事件
776   -- (void)iconAction {
777   - AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
778   - if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied) && iOS7Later) {
779   - // 无权限 做一个友好的提示
780   - [self goPrivacySetting];
781   - } else if (authStatus == AVAuthorizationStatusNotDetermined) {
782   - // fix issue 466, 防止用户首次拍照拒绝授权时相机页黑屏
783   - if (iOS7Later) {
784   - [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
785   - if (granted) {
786   - dispatch_sync(dispatch_get_main_queue(), ^{
787   - [self photoBtnClick];
788   - });
789   - }
790   - }];
791   - } else {
792   - [self photoBtnClick];
793   - }
794   - } else {
795   - [self photoBtnClick];
796   - }
797   -}
798 715 // 隐私设置提醒
799 716 - (void)goPrivacySetting {
800 717 dispatch_async(dispatch_get_main_queue(), ^{
... ... @@ -811,7 +728,7 @@
811 728 });
812 729 }
813 730  
814   -#pragma maek -从相册选择
  731 +#pragma mark - 从相册选择
815 732 - (void)pushTZImagePickerController {
816 733 __weak typeof(self)weakSelf = self;
817 734 TZImagePickerController *picker = [[TZImagePickerController alloc]initWithMaxImagesCount:1 delegate:self];
... ... @@ -825,6 +742,7 @@
825 742 NSIndexPath *index = [NSIndexPath indexPathForRow:2 inSection:0];
826 743 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
827 744 cell.imgV.image = [photos firstObject];
  745 + cell.hideChangeLab = NO;
828 746 weakSelf.isOwnSucc = YES;
829 747 weakSelf.iconImage = [photos firstObject];
830 748 if (weakSelf.isFontSucc && weakSelf.isBackSucc) {
... ... @@ -836,38 +754,130 @@
836 754 [self presentViewController:picker animated:YES completion:nil];
837 755 }
838 756  
839   -#pragma mark UIAlertViewDelegate
840   -- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
841   - [self dismissViewControllerAnimated:YES completion:nil];
  757 +#pragma mark - IDCardAuthAlertViewDelegate
  758 +- (void)IDCardAlertView:(CNLiveIDCardAuthAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  759 +
  760 + [alertView removeFromSuperview];
  761 + alertView = nil;
  762 +}
  763 +
  764 +#pragma mark - 加载页面数据 !!!!!!!!!!!!!!!!!
  765 +- (void)loadData {
  766 +
  767 + NSArray *array = @[
  768 + @{
  769 + @"shootTitle":@"第一步",
  770 + @"shootImage":@"observer_idcard_front",
  771 + @"isFront":@"1",
  772 + @"isOwn":@"0"
  773 + },
  774 + @{
  775 + @"shootTitle":@"第二步",
  776 + @"shootImage":@"observer_idcard_back",
  777 + @"isFront":@"0",
  778 + @"isOwn":@"0"
  779 + },
  780 + @{
  781 + @"shootTitle":@"第三步",
  782 + @"shootImage":@"observer_idcard_own",
  783 + @"isFront":@"0",
  784 + @"isOwn":@"1"
  785 + },
  786 + ];
  787 + NSMutableArray *arrayM = [NSMutableArray array];
  788 + for (NSDictionary *dic in array) {
  789 + AgreementModel *model = [AgreementModel mj_objectWithKeyValues:dic];
  790 + [arrayM addObject:model];
  791 + }
  792 + self.dataArray = arrayM.copy;
  793 + [self.tableView reloadData];
  794 +
842 795 }
843 796  
  797 +#pragma mark - UITableViewDataSource
  798 +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  799 + return 1;
  800 +}
844 801  
845   -#pragma mark - RunTime
846   -- (void)mockBundlerIdForTest {
847   -#pragma clang diagnostic push
848   -#pragma clang diagnostic ignored "-Wundeclared-selector"
849   - [self mockClass:[NSBundle class] originalFunction:@selector(bundleIdentifier) swizzledFunction:@selector(sapicamera_bundleIdentifier)];
850   -#pragma clang diagnostic pop
  802 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  803 + return self.dataArray.count+1;
851 804 }
852 805  
853   -- (void)mockClass:(Class)class originalFunction:(SEL)originalSelector swizzledFunction:(SEL)swizzledSelector {
854   -
855   - Method originalMethod = class_getInstanceMethod(class, originalSelector);
856   - Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
857   -
858   - BOOL didAddMethod = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
  806 +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
859 807  
860   - if (didAddMethod) {
861   - class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
  808 + if (indexPath.row < self.dataArray.count) {
  809 + AgreementModel *model = self.dataArray[indexPath.row];
  810 + NSString *shootCellId = [NSString stringWithFormat:@"%zd",indexPath.row];
  811 + ApplyForShootCell *cell = [tableView dequeueReusableCellWithIdentifier:shootCellId];
  812 + if (!cell) {
  813 + cell = [[ApplyForShootCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:shootCellId];
  814 + cell.model = model;
  815 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  816 + }
  817 + __weak __typeof(self)weakSelf = self;
  818 + cell.clickShootBtnBlock = ^() {
  819 + if (model.isOwn) {
  820 + //自拍cell点击事件
  821 + [weakSelf clickedIconImageAction];
  822 + } else {
  823 + //身份证
  824 + [weakSelf goToBaiDuOrcController:model.isFront];
  825 + }
  826 + };
  827 + return cell;
  828 +
862 829 } else {
863   - method_exchangeImplementations(originalMethod, swizzledMethod);
  830 + NSString *confirmCellId = [NSString stringWithFormat:@"%zd",indexPath.row];
  831 + ApplyForConfirmCell *cell = [tableView dequeueReusableCellWithIdentifier:confirmCellId];
  832 + if (!cell) {
  833 + cell = [[ApplyForConfirmCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:confirmCellId];
  834 + }
  835 + cell.selectionStyle = UITableViewCellSelectionStyleNone;
  836 + AgreementModel *model = [[AgreementModel alloc] init];
  837 + model.confirmTitle = @"下一步";
  838 + cell.model = model;
  839 + __weak __typeof(self)weakSelf = self;
  840 + cell.clickBtnBlock = ^(UIButton *btn){
  841 + [weakSelf submit:btn];
  842 + };
  843 + self.confirmCell = cell;
  844 + return cell;
  845 + }
  846 +
  847 +}
  848 +
  849 +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  850 + if (indexPath.row < self.dataArray.count) {
  851 + if (indexPath.row == 2) {
  852 + return 299;
  853 + } else {
  854 + return 256;
  855 + }
  856 + } else {
  857 + if (kNavigationBarHeight+256*2+145<KScreenHeight) {
  858 + return KScreenHeight-kNavigationBarHeight-256*2;
  859 + } else {
  860 + return 145;
  861 + }
864 862 }
  863 +}
  864 +
  865 +#pragma mark - 返回 !!!!!!!!!!!!!!!!!!!
  866 +- (void)backAction
  867 +{
  868 + [self.navigationController popViewControllerAnimated:YES];
  869 +}
  870 +
  871 +- (BOOL)shouldPopViewControllerByBackButtonOrPopGesture:(BOOL)byPopGesture {
865 872  
  873 + [self backAction];
  874 + return NO;
866 875 }
  876 +
867 877 #pragma mark - SubViews
868 878 -(UITableView *)tableView {
869 879 if (!_tableView) {
870   - _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight) style:UITableViewStylePlain];
  880 + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight-kNavigationBarHeight) style:UITableViewStylePlain];
871 881 _tableView.backgroundColor = RGB(242, 242, 242);
872 882 _tableView.delegate = self;
873 883 _tableView.dataSource = self;
... ... @@ -878,49 +888,8 @@
878 888 return _tableView;
879 889 }
880 890  
881   -- (void)didReceiveMemoryWarning {
882   - [super didReceiveMemoryWarning];
883   - // Dispose of any resources that can be recreated.
884   -}
885   -
886 891 - (void)dealloc {
887 892 NSLog(@"dealloc ==> ApplyForShootController");
888 893 }
889 894  
890   -// 字典转json字符串方法
891   -
892   -- (NSString *)convertToJsonData:(NSDictionary *)dict
893   -{
894   - NSError *error;
895   - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
896   -
897   - NSString *jsonString;
898   - if (!jsonData) {
899   - NSLog(@"%@",error);
900   - }else{
901   - jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
902   - }
903   -
904   - NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
905   - NSRange range = {0,jsonString.length};
906   - //去掉字符串中的空格
907   - [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
908   -
909   - NSRange range2 = {0,mutStr.length};
910   - //去掉字符串中的换行符
911   - [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
912   - return mutStr;
913   -
914   -}
915   -
916   -/*
917   -#pragma mark - Navigation
918   -
919   -// In a storyboard-based application, you will often want to do a little preparation before navigation
920   -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
921   - // Get the new view controller using [segue destinationViewController].
922   - // Pass the selected object to the new view controller.
923   -}
924   -*/
925   -
926 895 @end
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/ApplyForShootCell.h
... ... @@ -15,5 +15,6 @@
15 15  
16 16 @property (nonatomic, strong) AgreementModel *model;
17 17 @property (nonatomic, strong) UIImageView *imgV;
  18 +@property (nonatomic, assign) BOOL hideChangeLab;
18 19  
19 20 @end
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/ApplyForShootCell.m
... ... @@ -18,6 +18,7 @@
18 18 @property (nonatomic, strong) UILabel *subTitleLab;
19 19 @property (nonatomic, strong) UIButton *shootBtn;
20 20 @property (nonatomic, strong) UIView *lineV;
  21 +@property (nonatomic, strong) UILabel *changeLab;
21 22  
22 23 @end
23 24  
... ... @@ -32,6 +33,15 @@
32 33 return self;
33 34 }
34 35  
  36 +- (void)setHideChangeLab:(BOOL)hideChangeLab {
  37 + _hideChangeLab = hideChangeLab;
  38 + if (hideChangeLab) {
  39 + _changeLab.hidden = YES;
  40 + } else {
  41 + _changeLab.hidden = NO;
  42 + }
  43 +}
  44 +
35 45 - (void)setModel:(AgreementModel *)model {
36 46  
37 47 _titleLab.text = model.shootTitle;
... ... @@ -92,6 +102,7 @@
92 102 [self.contentView addSubview:self.subTitleLab];
93 103 [self.contentView addSubview:self.imgV];
94 104 // [self.imgV addSubview:self.shootBtn];
  105 + [self.imgV addSubview:self.changeLab];
95 106  
96 107 [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) {
97 108 make.left.top.right.equalTo(self.contentView);
... ... @@ -120,6 +131,10 @@
120 131 // make.center.equalTo(self.imgV);
121 132 // make.width.height.mas_equalTo(60);
122 133 // }];
  134 + [self.changeLab mas_makeConstraints:^(MASConstraintMaker *make) {
  135 + make.left.bottom.right.equalTo(self.imgV);
  136 + make.height.mas_equalTo(30.5);
  137 + }];
123 138 }
124 139  
125 140 - (void)layoutSubviews {
... ... @@ -163,10 +178,8 @@
163 178 _imgV = [[UIImageView alloc] init];
164 179 _imgV.contentMode = UIViewContentModeScaleToFill;
165 180 _imgV.userInteractionEnabled = YES;
166   -// _imgV.layer.borderWidth = 1.0f;
167   -// _imgV.layer.borderColor = RGB(232, 232, 232).CGColor;
168   -// _imgV.layer.cornerRadius = 6.0f;
169   -// _imgV.layer.masksToBounds = YES;
  181 + _imgV.layer.cornerRadius = 6.0f;
  182 + _imgV.layer.masksToBounds = YES;
170 183 UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(shootPhoto:)];
171 184 [_imgV addGestureRecognizer:tap];
172 185 }
... ... @@ -190,6 +203,24 @@
190 203 return _lineV;
191 204 }
192 205  
  206 +- (UILabel *)changeLab {
  207 + if (!_changeLab) {
  208 + _changeLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth-88, 30.5)];
  209 + _changeLab.backgroundColor = RGBA(51, 51, 51, 0.5);
  210 + _changeLab.text = @"更改";
  211 + _changeLab.textColor = kWhiteColor;
  212 + _changeLab.font = [UIFont fontWithName:@"PingFangSC-Regular" size:14];
  213 + _changeLab.textAlignment = NSTextAlignmentCenter;
  214 + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_changeLab.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight cornerRadii:CGSizeMake(6, 6)];
  215 + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  216 + maskLayer.frame = _changeLab.bounds;
  217 + maskLayer.path = maskPath.CGPath;
  218 + _changeLab.layer.mask = maskLayer;
  219 + _changeLab.hidden = YES;
  220 + }
  221 + return _changeLab;
  222 +}
  223 +
193 224 - (void)awakeFromNib {
194 225 [super awakeFromNib];
195 226 // Initialization code
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/CNLiveIDCardAuthAlertView.h 0 → 100644
  1 +//
  2 +// CNLiveIDCardAuthAlertView.h
  3 +// CNLiveBPersonalVerificationModule
  4 +//
  5 +// Created by cnliveJunBo on 2020/4/24.
  6 +//
  7 +
  8 +#import <UIKit/UIKit.h>
  9 +@class CNLiveIDCardAuthAlertView;
  10 +NS_ASSUME_NONNULL_BEGIN
  11 +
  12 +@protocol IDCardAuthAlertViewDelegate <NSObject>
  13 +@optional
  14 +- (void)IDCardAlertView:(CNLiveIDCardAuthAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
  15 +
  16 +@end
  17 +
  18 +@interface CNLiveIDCardAuthAlertView : UIView
  19 +
  20 +@property (nonatomic, assign) BOOL messageLabTextAlignmentLeft;
  21 +
  22 +- (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate;
  23 +
  24 +- (void)show;
  25 +
  26 +@end
  27 +
  28 +NS_ASSUME_NONNULL_END
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/CNLiveIDCardAuthAlertView.m 0 → 100644
  1 +//
  2 +// CNLiveIDCardAuthAlertView.m
  3 +// CNLiveBPersonalVerificationModule
  4 +//
  5 +// Created by cnliveJunBo on 2020/4/24.
  6 +//
  7 +
  8 +#import "CNLiveIDCardAuthAlertView.h"
  9 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  10 +#import <Masonry/Masonry.h>
  11 +
  12 +@interface CNLiveIDCardAuthAlertView ()
  13 +
  14 +@property (nonatomic, strong) UIView *contentBgView;
  15 +@property (nonatomic, strong) UILabel *titleLab;
  16 +@property (nonatomic, strong) UIView *messageBgView;
  17 +@property (nonatomic, strong) UILabel *messageLab;
  18 +@property (nonatomic, strong) UIView *horizontalLine;//水平
  19 +@property (nonatomic, strong) UIView *verticalLine;//垂直
  20 +@property (nonatomic, strong) UIButton *confirmBtn;
  21 +@property (nonatomic, strong) UIButton *cancelBtn;
  22 +
  23 +@property (nonatomic, copy) NSString *title;
  24 +@property (nonatomic, copy) NSString *message;
  25 +
  26 +@property (nonatomic, weak) id <IDCardAuthAlertViewDelegate>delegate;
  27 +
  28 +@end
  29 +
  30 +@implementation CNLiveIDCardAuthAlertView
  31 +
  32 +- (instancetype)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate
  33 +{
  34 + self = [super init];
  35 + if (self) {
  36 + self.title = title;
  37 + self.message = message;
  38 + self.delegate = delegate;
  39 + [self setupUI];
  40 + }
  41 + return self;
  42 +}
  43 +
  44 +- (void)show {
  45 +
  46 + [[UIApplication sharedApplication].delegate.window addSubview:self];
  47 +}
  48 +
  49 +- (void)setMessageLabTextAlignmentLeft:(BOOL)messageLabTextAlignmentLeft {
  50 + _messageLabTextAlignmentLeft = messageLabTextAlignmentLeft;
  51 +
  52 + _messageLab.textAlignment = NSTextAlignmentLeft;
  53 +}
  54 +
  55 +- (void)setupUI {
  56 +
  57 + self.backgroundColor = RGBA(51, 51, 51, 0.5);
  58 + self.frame = [UIScreen mainScreen].bounds;
  59 + [self addSubview:self.contentBgView];
  60 + [self.contentBgView addSubview:self.titleLab];
  61 + [self.contentBgView addSubview:self.messageBgView];
  62 + [self.messageBgView addSubview:self.messageLab];
  63 + [self.contentBgView addSubview:self.horizontalLine];
  64 + [self.contentBgView addSubview:self.verticalLine];
  65 + [self.contentBgView addSubview:self.confirmBtn];
  66 + [self.contentBgView addSubview:self.cancelBtn];
  67 +
  68 + [self.contentBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  69 + make.top.equalTo(self).offset(200+kStatusHeight);
  70 + make.left.equalTo(self).offset(52.5);
  71 + make.right.equalTo(self).offset(-52.5);
  72 + }];
  73 + [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  74 + make.top.equalTo(self.contentBgView).offset(16);
  75 + make.centerX.equalTo(self.contentBgView);
  76 + }];
  77 + [self.messageBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  78 + make.top.equalTo(self.titleLab.mas_bottom).offset(11);
  79 + make.left.equalTo(self.contentBgView).offset(20.5);
  80 + make.right.equalTo(self.contentBgView).offset(-20.5);
  81 + make.height.mas_greaterThanOrEqualTo(30);
  82 + }];
  83 + [self.messageLab mas_makeConstraints:^(MASConstraintMaker *make) {
  84 + make.top.left.equalTo(self.messageBgView).offset(12);
  85 + make.bottom.right.equalTo(self.messageBgView).offset(-12);
  86 + }];
  87 + [self.horizontalLine mas_makeConstraints:^(MASConstraintMaker *make) {
  88 + make.top.equalTo(self.messageBgView.mas_bottom).offset(11);
  89 + make.left.right.equalTo(self.contentBgView);
  90 + make.height.mas_equalTo(0.5);
  91 + }];
  92 + [self.verticalLine mas_makeConstraints:^(MASConstraintMaker *make) {
  93 + make.top.equalTo(self.horizontalLine.mas_bottom);
  94 + make.centerX.equalTo(self.horizontalLine);
  95 + make.width.mas_equalTo(0.5);
  96 + make.height.mas_equalTo(44);
  97 + }];
  98 + [self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  99 + make.top.equalTo(self.horizontalLine.mas_bottom);
  100 + make.left.equalTo(self.contentBgView);
  101 + make.right.equalTo(self.verticalLine.mas_left);
  102 + make.height.mas_equalTo(44);
  103 + make.bottom.equalTo(self.contentBgView);
  104 + }];
  105 + [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  106 + make.top.equalTo(self.horizontalLine.mas_bottom);
  107 + make.left.equalTo(self.verticalLine.mas_right);
  108 + make.right.equalTo(self.contentBgView);
  109 + make.height.mas_equalTo(44);
  110 + }];
  111 +
  112 +}
  113 +
  114 +#pragma mark - Action
  115 +- (void)confirmBtnAction:(UIButton *)sender {
  116 +
  117 + [self clickedButtonAtIndex:1];
  118 +}
  119 +
  120 +- (void)cancelBtnAction:(UIButton *)sender {
  121 +
  122 + [self clickedButtonAtIndex:0];
  123 +}
  124 +
  125 +- (void)clickedButtonAtIndex:(NSInteger)index {
  126 +
  127 + if (self.delegate && [self.delegate respondsToSelector:@selector(IDCardAlertView:clickedButtonAtIndex:)]) {
  128 + [self.delegate IDCardAlertView:self clickedButtonAtIndex:index];
  129 + }
  130 +}
  131 +
  132 +#pragma mark - Getter
  133 +- (UIView *)contentBgView {
  134 + if (!_contentBgView) {
  135 + _contentBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
  136 + _contentBgView.backgroundColor = kWhiteColor;
  137 + _contentBgView.layer.cornerRadius = 5;
  138 + _contentBgView.layer.masksToBounds = YES;
  139 + }
  140 + return _contentBgView;
  141 +}
  142 +
  143 +- (UILabel *)titleLab {
  144 + if (!_titleLab) {
  145 + _titleLab = [[UILabel alloc] init];
  146 + _titleLab.text = self.title;
  147 + _titleLab.textColor = KBlack51Color;
  148 + _titleLab.font = [UIFont fontWithName:@"PingFangSC-Medium" size:15];
  149 + }
  150 + return _titleLab;
  151 +}
  152 +
  153 +- (UIView *)messageBgView {
  154 + if (!_messageBgView) {
  155 + _messageBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 90)];
  156 + _messageBgView.backgroundColor = RGBA(244, 244, 244, 1);
  157 + _messageBgView.layer.cornerRadius = 5;
  158 + _messageBgView.layer.masksToBounds = YES;
  159 + }
  160 + return _messageBgView;
  161 +}
  162 +
  163 +- (UILabel *)messageLab {
  164 + if (!_messageLab) {
  165 + _messageLab = [[UILabel alloc] init];
  166 + NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc] initWithString:self.message];
  167 + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  168 + paragraphStyle.lineSpacing = 6.0; // 设置行间距
  169 + [attributedStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attributedStr.length)];
  170 + _messageLab.attributedText = attributedStr;
  171 + _messageLab.textColor = RGBA(102, 102, 102, 1);
  172 + _messageLab.font = [UIFont fontWithName:@"PingFangSC-Medium" size:12];
  173 + _messageLab.numberOfLines = 0;
  174 + _messageLab.textAlignment = NSTextAlignmentCenter;
  175 + }
  176 + return _messageLab;
  177 +}
  178 +
  179 +- (UIButton *)confirmBtn {
  180 + if (!_confirmBtn) {
  181 + _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  182 + [_confirmBtn setTitle:@"确定" forState:UIControlStateNormal];
  183 + [_confirmBtn setTitleColor:RGBA(72, 167, 249, 1) forState:UIControlStateNormal];
  184 + _confirmBtn.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:17];
  185 + [_confirmBtn addTarget:self action:@selector(confirmBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  186 + }
  187 + return _confirmBtn;
  188 +}
  189 +
  190 +- (UIButton *)cancelBtn {
  191 + if (!_cancelBtn) {
  192 + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  193 + [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
  194 + [_cancelBtn setTitleColor:KGray153Color forState:UIControlStateNormal];
  195 + _cancelBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:17];
  196 + [_cancelBtn addTarget:self action:@selector(cancelBtnAction:) forControlEvents:UIControlEventTouchUpInside];
  197 + }
  198 + return _cancelBtn;
  199 +}
  200 +
  201 +- (UIView *)horizontalLine {
  202 + if (!_horizontalLine) {
  203 + _horizontalLine = [[UIView alloc] init];
  204 + _horizontalLine.backgroundColor = RGBA(199, 197, 199, 1);
  205 + _horizontalLine.layer.borderColor = RGBA(199, 197, 199, 1).CGColor;
  206 + }
  207 + return _horizontalLine;
  208 +}
  209 +
  210 +- (UIView *)verticalLine {
  211 + if (!_verticalLine) {
  212 + _verticalLine = [[UIView alloc] init];
  213 + _verticalLine.backgroundColor = RGBA(199, 197, 199, 1);
  214 + _verticalLine.layer.borderColor = RGBA(199, 197, 199, 1).CGColor;
  215 + }
  216 + return _verticalLine;
  217 +}
  218 +
  219 +@end
... ...