Commit 93404f71569f9d21943b4e4ce0912320bd73e19a

Authored by iOS-Xiaowen
1 parent 39cedfad

no message

CNLiveBUserAgreement/Classes/CNLiveUserAgreementController.m
... ... @@ -186,7 +186,8 @@
186 186 cameraController.takePhotosCompletionBlock = ^(UIImage *image, NSError *error) {
187 187 __strong typeof(weakSelf) strongSelf = weakSelf;
188 188 if(!strongSelf) return ;
189   - [strongSelf.images addObject:image];
  189 + [strongSelf handleImage:image];
  190 +// [strongSelf.images addObject:image];
190 191 dispatch_async(dispatch_get_main_queue(), ^{
191 192 [weakCameraController dismissViewControllerAnimated:YES completion:nil];
192 193 });
... ... @@ -210,7 +211,8 @@
210 211 [picker setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
211 212 __strong typeof(weakSelf) strongSelf = weakSelf;
212 213 if(!strongSelf) return ;
213   - [strongSelf.images addObject:[photos firstObject]];
  214 + [strongSelf handleImage:[photos firstObject]];
  215 +// [strongSelf.images addObject:[photos firstObject]];
214 216 }];
215 217 [strongSelf presentViewController:picker animated:YES completion:nil];
216 218 }];
... ... @@ -241,6 +243,28 @@
241 243  
242 244 }
243 245  
  246 +- (void)handleImage:(UIImage *)image {
  247 + // 固定方向
  248 + image = [image fixOrientation];//这个方法是UIImage+Extras.h中方法
  249 + // 加入数组
  250 + [self.images addObject:image];
  251 + NSData *imageData = [UIImage zipNSDataWithImage:image];
  252 + if (imageData.length > 20*1024.0*1024.0) {//压缩后大于20M
  253 + [QMUITips showError:@"图片过大" inView:self.view hideAfterDelay:1.5];
  254 + return;
  255 + }
  256 + NSString *imageString = [imageData base64EncodedStringWithOptions:0];
  257 + imageString = [self removeSpaceAndNewline:imageString];
  258 + id dataDic = @{
  259 + @"image" : imageString
  260 + };
  261 + // 帮助与反馈->产品建议:App提交图片数据给h5展示
  262 + [self.bridge callHandler:@"wjjCommitImageToJS" data:dataDic responseCallback:^(id responseData) {
  263 + NSLog(@"ObjC received response: %@", responseData);
  264 + }];
  265 +
  266 +}
  267 +
244 268 // 获取图片的token
245 269 - (void)getToken {
246 270 NSDictionary *param = @{@"appId":AppId,
... ...
CNLiveBUserAgreement/Classes/CNLiveUserAgreementManager.m
... ... @@ -142,7 +142,7 @@ static CNLiveUserAgreementManager *_instance = nil;
142 142 {
143 143 if ([[NSString stringWithFormat:@"%@", dic[@"type"]] isEqualToString:@"complaint"]) {
144 144 if (success) {
145   - success(dic[@"detailUrl"], dic[@"title"], closeHidden);
  145 + success(dic[@"detailUrl"], dic[@"title"], !closeHidden);
146 146 return ;
147 147 }
148 148 }
... ...