Commit 7249b72d47aecd5676dde4d8027d39fa7b310d05

Authored by 王军波
1 parent 1cf3b9d7

图片相关

CNLiveBPersonalVerificationModule.podspec
... ... @@ -81,45 +81,45 @@ s.subspec 'CNBInstitutionInfo' do |institution|
81 81  
82 82 end
83 83  
84   -#s.subspec 'CNBPersonCardInfo' do |card|
85   -# card.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/**'
86   -# card.subspec 'Controller' do |controller|
87   -# controller.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Controller/*.{h,m}'
88   -# controller.dependency 'CNLiveBPersonalVerificationModule/CNBPersonCardInfo/View'
89   -# end
90   -# card.subspec 'View' do |view|
91   -# view.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/*.{h,m}'
92   -# view.dependency 'CNLiveBPersonalVerificationModule/CNBPersonCardInfo/Model'
93   -# end
94   -# card.subspec 'Model' do |model|
95   -# model.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Model/*.{h,m}'
96   -# end
97   -# card.ios.vendored_frameworks = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/AipOcrSdk.framework','CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/AipBase.framework','CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/IdcardQuality.framework'
98   -# card.resource_bundles = {
99   -# 'CNBPersonCardInfo' => ['CNLiveBPersonalVerificationModule/Assets/CNBPersonCardInfo/CNBPersonCardInfo.bundle']
100   -# }
101   -# card.dependency 'CNLiveTripartiteManagement/Masonry'
102   -# card.dependency 'CNLiveTripartiteManagement/QMUIKit'
103   -# card.dependency 'CNLiveTripartiteManagement/MJExtension'
104   -# card.dependency 'CNLiveTripartiteManagement/SDWebImage'
105   -# card.dependency 'CNLiveTripartiteManagement/MJRefresh'
106   -# card.dependency 'CNLiveTripartiteManagement/YYKit'
107   -# card.dependency 'CNLiveTripartiteManagement/AFNetworking'
108   -# #基础库
109   -# card.dependency 'CNLiveBaseKit'
110   -# #基础类目
111   -# card.dependency 'CNLiveCommonCategory'
112   -# ##基础UI
113   -# card.dependency 'CNLiveCustomUI'
114   -# ##用户库
115   -# card.dependency 'CNLiveUserManagement'
116   -# # #网络请求
117   -# card.dependency 'CNLiveRequestBastKit'
118   -# card.dependency 'CNLiveEnvironment'
119   -# card.dependency 'CNLiveBaseClass'
120   -# card.dependency 'CNLiveBaseTools'
121   -# card.dependency 'CNLiveBusinessTools'
122   -# end
  84 +s.subspec 'CNBPersonCardInfo' do |card|
  85 + card.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/**'
  86 + card.subspec 'Controller' do |controller|
  87 + controller.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Controller/*.{h,m}'
  88 + controller.dependency 'CNLiveBPersonalVerificationModule/CNBPersonCardInfo/View'
  89 + end
  90 + card.subspec 'View' do |view|
  91 + view.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/*.{h,m}'
  92 + view.dependency 'CNLiveBPersonalVerificationModule/CNBPersonCardInfo/Model'
  93 + end
  94 + card.subspec 'Model' do |model|
  95 + model.source_files = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Model/*.{h,m}'
  96 + end
  97 + card.ios.vendored_frameworks = 'CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/AipOcrSdk.framework','CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/AipBase.framework','CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/baiduSDKs/IdcardQuality.framework'
  98 + card.resource_bundles = {
  99 + 'CNBPersonCardInfo' => ['CNLiveBPersonalVerificationModule/Assets/CNBPersonCardInfo/CNBPersonCardInfo.bundle']
  100 + }
  101 + card.dependency 'CNLiveTripartiteManagement/Masonry'
  102 + card.dependency 'CNLiveTripartiteManagement/QMUIKit'
  103 + card.dependency 'CNLiveTripartiteManagement/MJExtension'
  104 + card.dependency 'CNLiveTripartiteManagement/SDWebImage'
  105 + card.dependency 'CNLiveTripartiteManagement/MJRefresh'
  106 + card.dependency 'CNLiveTripartiteManagement/YYKit'
  107 + card.dependency 'CNLiveTripartiteManagement/AFNetworking'
  108 + #基础库
  109 + card.dependency 'CNLiveBaseKit'
  110 + #基础类目
  111 + card.dependency 'CNLiveCommonCategory'
  112 + ##基础UI
  113 + card.dependency 'CNLiveCustomUI'
  114 + ##用户库
  115 + card.dependency 'CNLiveUserManagement'
  116 + # #网络请求
  117 + card.dependency 'CNLiveRequestBastKit'
  118 + card.dependency 'CNLiveEnvironment'
  119 + card.dependency 'CNLiveBaseClass'
  120 + card.dependency 'CNLiveBaseTools'
  121 + card.dependency 'CNLiveBusinessTools'
  122 + end
123 123  
124 124  
125 125 s.frameworks = 'UIKit', 'Foundation'
... ...
CNLiveBPersonalVerificationModule/Classes/CNBInstitutionInfo/Controller/CNBPerCertificationController.m
... ... @@ -76,7 +76,7 @@
76 76 }
77 77 #pragma mark - Action
78 78 - (void)sureBtnAction {
79   -
  79 + [self.navigationController popToRootViewControllerAnimated:YES];
80 80 }
81 81 #pragma mark - lazy
82 82 - (UIImageView *)showImageV {
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/Controller/ApplyForShootController.m
... ... @@ -24,6 +24,7 @@
24 24 #import "CNUserInfoManager.h"
25 25 #import "CNLiveBusinessTools.h"
26 26 #import "CNLiveEnvironment.h"
  27 +#import "CNLiveIDCardAuthGetImage.h"
27 28 static NSString *shootCellId = @"shootCellId";
28 29 static NSString *confirmCellId = @"confirmCellId";
29 30  
... ... @@ -139,7 +140,7 @@ static NSString *confirmCellId = @"confirmCellId";
139 140 weakSelf.isFontSucc = NO;
140 141 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
141 142 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
142   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  143 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
143 144 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
144 145 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
145 146 }];
... ... @@ -153,7 +154,7 @@ static NSString *confirmCellId = @"confirmCellId";
153 154 weakSelf.isBackSucc = NO;
154 155 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
155 156 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
156   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  157 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
157 158 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
158 159 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
159 160 }];
... ... @@ -165,7 +166,7 @@ static NSString *confirmCellId = @"confirmCellId";
165 166 weakSelf.isBackSucc = NO;
166 167 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
167 168 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
168   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  169 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
169 170 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
170 171 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
171 172 }];
... ... @@ -195,14 +196,14 @@ static NSString *confirmCellId = @"confirmCellId";
195 196 weakSelf.isFontSucc = NO;
196 197 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
197 198 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
198   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  199 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
199 200 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
200 201 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
201 202 } else {
202 203 weakSelf.isBackSucc = NO;
203 204 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
204 205 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
205   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  206 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
206 207 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
207 208 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
208 209 }
... ... @@ -262,7 +263,7 @@ static NSString *confirmCellId = @"confirmCellId";
262 263 weakSelf.isFontSucc = NO;
263 264 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
264 265 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
265   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  266 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
266 267 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
267 268 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
268 269 }];
... ... @@ -276,7 +277,7 @@ static NSString *confirmCellId = @"confirmCellId";
276 277 weakSelf.isBackSucc = NO;
277 278 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
278 279 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
279   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  280 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
280 281 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
281 282 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
282 283 }];
... ... @@ -297,14 +298,14 @@ static NSString *confirmCellId = @"confirmCellId";
297 298 weakSelf.isFontSucc = NO;
298 299 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
299 300 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
300   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  301 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
301 302 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
302 303 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
303 304 } else {
304 305 weakSelf.isBackSucc = NO;
305 306 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
306 307 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
307   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  308 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
308 309 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
309 310 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
310 311 }
... ... @@ -360,14 +361,14 @@ static NSString *confirmCellId = @"confirmCellId";
360 361 weakSelf.isFontSucc = NO;
361 362 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
362 363 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
363   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  364 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
364 365 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
365 366 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
366 367 } else {
367 368 weakSelf.isBackSucc = NO;
368 369 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
369 370 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
370   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  371 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
371 372 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
372 373 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
373 374 }
... ... @@ -395,14 +396,14 @@ static NSString *confirmCellId = @"confirmCellId";
395 396 weakSelf.isFontSucc = NO;
396 397 NSIndexPath *index = [NSIndexPath indexPathForRow:0 inSection:0];
397 398 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
398   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_front"];
  399 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_front" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
399 400 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
400 401 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
401 402 } else {
402 403 weakSelf.isBackSucc = NO;
403 404 NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
404 405 ApplyForShootCell *cell = [weakSelf.tableView cellForRowAtIndexPath:index];
405   - cell.imgV.image = [UIImage imageNamed:@"observer_idcard_back"];
  406 + cell.imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"observer_idcard_back" bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
406 407 weakSelf.confirmCell.confirmButton.backgroundColor = RGB(216, 216, 216);
407 408 [weakSelf.confirmCell.confirmButton setTitleColor:RGB(180, 180, 180) forState:UIControlStateNormal];
408 409 }
... ...
CNLiveBPersonalVerificationModule/Classes/CNBPersonCardInfo/View/ApplyForShootCell.m
... ... @@ -11,6 +11,7 @@
11 11 #import <Masonry/Masonry.h>
12 12 #import "CNLiveBaseKit.h"
13 13 #import <QMUIKit/QMUIKit.h>
  14 +#import "CNLiveIDCardAuthGetImage.h"
14 15 @interface ApplyForShootCell ()
15 16  
16 17 @property (nonatomic, strong) UILabel *titleLab;
... ... @@ -34,7 +35,7 @@
34 35 - (void)setModel:(AgreementModel *)model {
35 36  
36 37 _titleLab.text = model.shootTitle;
37   - _imgV.image = [UIImage imageNamed:model.shootImage];
  38 + _imgV.image = [CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:model.shootImage bundle:@"CNBPersonCardInfo.bundle/CNBPersonCardInfo" targetClass:[self class]];
38 39 if (model.isFront) {
39 40 self.lineV.hidden = NO;
40 41 NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"请拍摄本人身份证正面 注意避免证件反光"];
... ... @@ -151,7 +152,7 @@
151 152 - (UIButton *)shootBtn {
152 153 if (!_shootBtn) {
153 154 _shootBtn = [UIButton buttonWithType:UIButtonTypeCustom];
154   - [_shootBtn setImage:[UIImage imageNamed:@"dl_xiangji"] forState:UIControlStateNormal];
  155 + [_shootBtn setImage:[CNLiveIDCardAuthGetImage cnLiveIDCardAuth_getImageName:@"dl_xiangji" bundle:@"CNBPersonCardInfo.bundle/CNLiveBPersonalVerificationModule" targetClass:[self class]] forState:UIControlStateNormal];
155 156 [_shootBtn addTarget:self action:@selector(shootPhotoAction:) forControlEvents:UIControlEventTouchUpInside];
156 157 }
157 158 return _shootBtn;
... ...
CNLiveIDCardAuthGetImage.h 0 → 100644
  1 +//
  2 +// CNLiveIDCardAuthGetImage.h
  3 +// CNLiveBPersonalVerificationModule
  4 +//
  5 +// Created by cnliveJunBo on 2020/4/22.
  6 +//
  7 +
  8 +#import <Foundation/Foundation.h>
  9 +
  10 +NS_ASSUME_NONNULL_BEGIN
  11 +
  12 +@interface CNLiveIDCardAuthGetImage : NSObject
  13 +
  14 +/// 组件内获取图片
  15 +/// @param imageName 图片名字
  16 +/// @param bundlePath 图片所在bundle
  17 +/// @param targetClass 与bundle在同一级别的class
  18 ++ (UIImage *)cnLiveIDCardAuth_getImageName:(NSString *)imageName bundle:(NSString *)bundlePath targetClass:(Class)targetClass;
  19 +
  20 +@end
  21 +
  22 +NS_ASSUME_NONNULL_END
... ...
CNLiveIDCardAuthGetImage.m 0 → 100644
  1 +//
  2 +// CNLiveIDCardAuthGetImage.m
  3 +// CNLiveBPersonalVerificationModule
  4 +//
  5 +// Created by cnliveJunBo on 2020/4/22.
  6 +//
  7 +
  8 +#import "CNLiveIDCardAuthGetImage.h"
  9 +
  10 +@implementation CNLiveIDCardAuthGetImage
  11 +/**
  12 + * 创建图片
  13 + *
  14 + * @param imageName 图片名字
  15 + * @param bundlePath 图片所在的bundle名字
  16 + * @param targetClass 类和bundle的同级目录
  17 + * @return 返回UIImage
  18 + */
  19 ++ (UIImage *)cnLiveIDCardAuth_getImageName:(NSString *)imageName bundle:(NSString *)bundlePath targetClass:(Class)targetClass{
  20 +
  21 + NSInteger scale = [[UIScreen mainScreen]scale];
  22 + NSBundle *bundle = [NSBundle bundleForClass:targetClass];
  23 + NSURL *url = [bundle URLForResource:bundlePath withExtension:@"bundle"];
  24 +
  25 + if (!url) {
  26 + return [UIImage new];
  27 + }
  28 + NSBundle *targetBundle = [NSBundle bundleWithURL:url];
  29 + if (!targetBundle) {
  30 + return [UIImage new];
  31 + }
  32 + NSString *imgName = [NSString stringWithFormat:@"%@@%zdx.png",imageName,scale];
  33 + UIImage *image = [UIImage imageNamed:imgName inBundle:targetBundle compatibleWithTraitCollection:nil];
  34 +
  35 + if (image) {
  36 + return image;
  37 + }else {
  38 + if ([UIImage imageNamed:imgName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]) {
  39 + return [UIImage imageNamed:imgName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];
  40 + }else{
  41 + return [UIImage new];
  42 + }
  43 + }
  44 +
  45 +}
  46 +@end
... ...