|
@@ -221,26 +221,22 @@ RY_baseVMprotocol>
|
|
|
-(void)reqNet_upload:(UIImage *)img{
|
|
|
NSData *imageData = UIImageJPEGRepresentation(img, 0.6);
|
|
|
NSString *dataStr = [imageData base64EncodedStringWithOptions:0];
|
|
|
+ //前面必须加上data:image/png;base64,
|
|
|
+ NSString *base64String = [NSString stringWithFormat:@"data:image/png;base64,%@",dataStr];
|
|
|
NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
- [params setObject:dataStr forKey:@"image_video[]"];
|
|
|
+ [params setObject:base64String forKey:@"image_video[]"];
|
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
- NSString *reqUrl = RequestAllUrl(Reivews_rewriteProductAddImg);
|
|
|
- [PPNetworkHelper uploadImagesWithURL:reqUrl parameters:@{} name:@"image_video[]" images:@[img] fileNames:nil imageScale:0.6 imageType:nil progress:^(NSProgress *progress) {
|
|
|
-
|
|
|
- } success:^(id responseObject) {
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
- if(RequestSuccess){
|
|
|
- [self.view makeToast:@"Sucess" duration:2 position:CSToastPositionCenter];
|
|
|
- NSDictionary *dataDic = responseObject[@"data"];
|
|
|
- [self.xxx_imgUrlAry addObject:dataDic[@"image_video"]];
|
|
|
- }else{
|
|
|
- [self.view makeToast:RequestMsg duration:2 position:CSToastPositionCenter];
|
|
|
- }
|
|
|
-
|
|
|
- } failure:^(NSError *error) {
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
- [self.view makeToast:ReqNetWorkFaild duration:2 position:CSToastPositionCenter];
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ [ASNetTools.shared formData_postWithPath:Reivews_rewriteProductAddImg param:params success:^(id _Nonnull json) {
|
|
|
+ [MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
|
|
|
+ [weakSelf.xxx_imgUrlAry addObject:json[@"image_video"]];
|
|
|
+ } faild:^(NSString * _Nonnull code, NSString * _Nonnull msg) {
|
|
|
+ [MBProgressHUD hideHUDForView:weakSelf.view animated:YES];
|
|
|
+ [weakSelf.view makeToast:msg];
|
|
|
}];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
-(void)handle_postCommentEvent:(UIButton *)btn{
|