|
@@ -0,0 +1,442 @@
|
|
|
+//
|
|
|
+// GoodsReviewsWriteC.m
|
|
|
+// Asteria
|
|
|
+//
|
|
|
+// Created by 王猛 on 2024/1/10.
|
|
|
+//
|
|
|
+
|
|
|
+#import "GoodsReviewsWriteC.h"
|
|
|
+#import "AS_GoodsDetailsC.h"
|
|
|
+#import "HCSStarRatingView.h"
|
|
|
+#import "GoodWritUpImgV.h"
|
|
|
+#import <QMUIKit/QMUIImagePickerPreviewViewController.h>
|
|
|
+#import "ASGoodsDetailsVM.h"
|
|
|
+#import "QDSingleImagePickerPreviewViewController.h"
|
|
|
+
|
|
|
+
|
|
|
+#define kWriteUpimgWdith (KScreenWidth-40)/3
|
|
|
+static QMUIAlbumContentType const kAlbumContentType = QMUIAlbumContentTypeOnlyPhoto;
|
|
|
+
|
|
|
+
|
|
|
+@interface GoodsReviewsWriteC ()
|
|
|
+<QMUITextViewDelegate,
|
|
|
+QMUIAlbumViewControllerDelegate,
|
|
|
+QMUIImagePickerViewControllerDelegate,
|
|
|
+QDSingleImagePickerPreviewViewControllerDelegate,
|
|
|
+RY_baseVMprotocol>
|
|
|
+@property (nonatomic, strong) TT_CustonTF *buyernameTF;
|
|
|
+@property (nonatomic, strong) TT_CustonTF *orderlengthTF;
|
|
|
+@property (nonatomic, strong) NSMutableArray *starValueAry;
|
|
|
+@property (nonatomic, strong) UIButton *bootomBtn;
|
|
|
+@property (nonatomic, strong) QMUITextView *writeTextV;
|
|
|
+@property (nonatomic, strong) NSMutableArray *xxx_upLoadImgAry;
|
|
|
+@property (nonatomic, assign) NSInteger xxx_tapImgIndex;
|
|
|
+
|
|
|
+@property (nonatomic, strong) NSMutableArray *xxx_imgUrlAry;
|
|
|
+@property (nonatomic, strong) NSMutableArray *xxx_selectImgAry;
|
|
|
+@property (nonatomic, strong) ASGoodsDetailsVM *VM;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation GoodsReviewsWriteC
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+ self.title = self.nav_title;
|
|
|
+
|
|
|
+}
|
|
|
+- (void)ucm_bindvmmodel{
|
|
|
+ self.VM = [[ASGoodsDetailsVM alloc]initDelegate:self];
|
|
|
+}
|
|
|
+- (void)initSubviews {
|
|
|
+ [super initSubviews];
|
|
|
+ [self.view addSubview:self.topBgV];
|
|
|
+ [self.view addSubview:self.buyernameTF];
|
|
|
+ [self.view addSubview:self.orderlengthTF];
|
|
|
+ IPhoneXHeigh
|
|
|
+ self.topBgV.frame = CGRectMake(0, securitytop_Y, KScreenWidth, 60);
|
|
|
+ self.buyernameTF.mj_y = CGRectGetMaxY(self.topBgV.frame)+20;
|
|
|
+ self.orderlengthTF.mj_y = CGRectGetMaxY(self.buyernameTF.frame)+20;
|
|
|
+ NSArray *titileAry = @[@"QUALITY",@"SHIPPING",@"SERVICE"];
|
|
|
+ self.starValueAry = [NSMutableArray arrayWithArray:@[@"0.0",@"0.0",@"0.0"]];
|
|
|
+ UIView *lastView = nil;
|
|
|
+ for (int i = 0; i<titileAry.count; i++) {
|
|
|
+ UILabel *tipslab = [UILabel new];
|
|
|
+ tipslab.text = titileAry[i];
|
|
|
+ tipslab.font = [UIFont fontWithName:Rob_Regular size:14];
|
|
|
+ tipslab.textColor = [UIColor colorWithHexString:@"#B2B2B2"];
|
|
|
+ [self.view addSubview:tipslab];
|
|
|
+ tipslab.frame = CGRectMake(10, CGRectGetMaxY(self.orderlengthTF.frame)+20+i*40, 70, 40);
|
|
|
+
|
|
|
+ HCSStarRatingView *reviews_startV = [[HCSStarRatingView alloc]initWithFrame:CGRectMake(10+70+10, CGRectGetMaxY(self.orderlengthTF.frame)+20+i*40,160, 40)];
|
|
|
+ reviews_startV.value =0;
|
|
|
+ reviews_startV.filledStarImage = IMAGE(@"reviews_full_star");
|
|
|
+ reviews_startV.emptyStarImage = IMAGE(@"reviews_empty_star");
|
|
|
+ reviews_startV.maximumValue = 5;
|
|
|
+ reviews_startV.backgroundColor = [UIColor clearColor];
|
|
|
+ reviews_startV.tag = i;
|
|
|
+ [reviews_startV addTarget:self action:@selector(didChangeValue:) forControlEvents:UIControlEventValueChanged];
|
|
|
+ [self.view addSubview:reviews_startV];
|
|
|
+ if(i == titileAry.count-1){
|
|
|
+ lastView = reviews_startV;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ [self.view addSubview:self.writeTextV];
|
|
|
+ self.writeTextV.mj_y = CGRectGetMaxY(lastView.frame)+30;
|
|
|
+
|
|
|
+ self.xxx_upLoadImgAry = [NSMutableArray arrayWithCapacity:3];
|
|
|
+ for (int i = 0; i<3; i++) {
|
|
|
+ GoodWritUpImgV *upImgV = [[GoodWritUpImgV alloc]initWithFrame:CGRectMake(10+i*(kWriteUpimgWdith+10),CGRectGetMaxY(self.writeTextV.frame)+30, kWriteUpimgWdith, kWriteUpimgWdith)];
|
|
|
+ upImgV.tag = i;
|
|
|
+ upImgV.closeBtn.tag = i;
|
|
|
+ upImgV.isCanTap = YES;
|
|
|
+ [upImgV.closeBtn addTarget:self action:@selector(handle_closeDeleteImgBtn:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ upImgV.hidden = YES;
|
|
|
+ upImgV.image = [UIImage imageNamed:@"goods_wirte_upload"];
|
|
|
+ [self.view addSubview:upImgV];
|
|
|
+ UITapGestureRecognizer *tap= [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handle_TapUpImgLoad:)];
|
|
|
+ [upImgV addGestureRecognizer:tap];
|
|
|
+ if(i == 0 ){
|
|
|
+ upImgV.hidden = NO;
|
|
|
+ }
|
|
|
+ [self.xxx_upLoadImgAry addObject:upImgV];
|
|
|
+ }
|
|
|
+ [self.view addSubview:self.bootomBtn];
|
|
|
+}
|
|
|
+#pragma mark - **************** handle ****************
|
|
|
+-(void)didChangeValue:(HCSStarRatingView *)starV{
|
|
|
+ NSLog(@"Changed rating to %.1f", starV.value);
|
|
|
+ [self.starValueAry replaceObjectAtIndex:starV.tag withObject:[NSString stringWithFormat:@"%f",starV.value]];
|
|
|
+}
|
|
|
+/// upLoad Img 相关内容
|
|
|
+-(void)handle_closeDeleteImgBtn:(UIButton *)btn{
|
|
|
+ [FTT_Helper CreateTitle:@"Whether to delete the current photo" message:nil CantionTitle:@"Cancel" Sure:@"Sure" preferredStyle:UIAlertControllerStyleAlert SureAC:^{
|
|
|
+ [self tool_deleteImgChange:btn.tag];
|
|
|
+ } NoAC:nil ViewController:self];
|
|
|
+}
|
|
|
+-(void)tool_deleteImgChange:(NSInteger )index{
|
|
|
+ [self.xxx_imgUrlAry removeObjectAtIndex:index];
|
|
|
+ [self.xxx_selectImgAry removeObjectAtIndex:index];
|
|
|
+ for (int i = 0; i<self.xxx_upLoadImgAry.count; i++) {
|
|
|
+ GoodWritUpImgV * imgV = self.xxx_upLoadImgAry[i];
|
|
|
+ imgV.hidden = NO;
|
|
|
+ if(self.xxx_selectImgAry.count > i){
|
|
|
+ imgV.image = self.xxx_selectImgAry[i];
|
|
|
+ imgV.isCanTap = NO;
|
|
|
+ }else if (self.xxx_selectImgAry.count == i){
|
|
|
+ imgV.image = [UIImage imageNamed:@"goods_wirte_upload"];
|
|
|
+ imgV.isCanTap = YES;
|
|
|
+ }else{
|
|
|
+ imgV.hidden = YES;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+//点击添加图片
|
|
|
+-(void)handle_TapUpImgLoad:(UITapGestureRecognizer *)tap{
|
|
|
+ GoodWritUpImgV * imgV =(GoodWritUpImgV *_Nullable )tap.view;
|
|
|
+ if(imgV.isCanTap){//调用相片
|
|
|
+ self.xxx_tapImgIndex = imgV.tag;
|
|
|
+ [self tool_presentAlbumViewControllerWith:imgV.tag];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - **************** 选择照片上传 ****************
|
|
|
+-(void)tool_presentAlbumViewControllerWith:(NSInteger )index{
|
|
|
+ QMUIAlbumViewController *albumViewController = [[QMUIAlbumViewController alloc] init];
|
|
|
+ albumViewController.albumViewControllerDelegate = self;
|
|
|
+ albumViewController.contentType = QMUIAlbumContentTypeOnlyPhoto;
|
|
|
+ UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:albumViewController];
|
|
|
+ // 获取最近发送图片时使用过的相簿,如果有则直接进入该相簿
|
|
|
+ [albumViewController pickLastAlbumGroupDirectlyIfCan];
|
|
|
+ [self presentViewController:navigationController animated:YES completion:NULL];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - **************** QMUIAlbumViewControllerDelegate ****************
|
|
|
+- (QMUIImagePickerViewController *)imagePickerViewControllerForAlbumViewController:(QMUIAlbumViewController *)albumViewController {
|
|
|
+ QMUIImagePickerViewController *imagePickerViewController = [[QMUIImagePickerViewController alloc] init];
|
|
|
+ imagePickerViewController.imagePickerViewControllerDelegate = self;
|
|
|
+ imagePickerViewController.maximumSelectImageCount = 3;
|
|
|
+ imagePickerViewController.view.tag = albumViewController.view.tag;
|
|
|
+ imagePickerViewController.allowsMultipleSelection = NO;
|
|
|
+ return imagePickerViewController;
|
|
|
+}
|
|
|
+#pragma mark - **************** QMUIImagePickerViewControllerDelegate ****************
|
|
|
+- (void)imagePickerViewController:(QMUIImagePickerViewController *)imagePickerViewController didFinishPickingImageWithImagesAssetArray:(NSMutableArray<QMUIAsset *> *)imagesAssetArray {
|
|
|
+ // 储存最近选择了图片的相册,方便下次直接进入该相册
|
|
|
+ [QMUIImagePickerHelper updateLastestAlbumWithAssetsGroup:imagePickerViewController.assetsGroup ablumContentType:kAlbumContentType userIdentify:nil];
|
|
|
+}
|
|
|
+- (QMUIImagePickerPreviewViewController *)imagePickerPreviewViewControllerForImagePickerViewController:(QMUIImagePickerViewController *)imagePickerViewController {
|
|
|
+ QDSingleImagePickerPreviewViewController *imagePickerPreviewViewController = [[QDSingleImagePickerPreviewViewController alloc] init];
|
|
|
+ imagePickerPreviewViewController.delegate = self;
|
|
|
+ imagePickerPreviewViewController.assetsGroup = imagePickerViewController.assetsGroup;
|
|
|
+ imagePickerPreviewViewController.view.tag = imagePickerViewController.view.tag;
|
|
|
+ return imagePickerPreviewViewController;
|
|
|
+}
|
|
|
+#pragma mark - <QDSingleImagePickerPreviewViewControllerDelegate>
|
|
|
+
|
|
|
+- (void)imagePickerPreviewViewController:(QDSingleImagePickerPreviewViewController *)imagePickerPreviewViewController didSelectImageWithImagesAsset:(QMUIAsset *)imageAsset {
|
|
|
+ // 储存最近选择了图片的相册,方便下次直接进入该相册
|
|
|
+ [QMUIImagePickerHelper updateLastestAlbumWithAssetsGroup:imagePickerPreviewViewController.assetsGroup ablumContentType:kAlbumContentType userIdentify:nil];
|
|
|
+ // 显示 loading
|
|
|
+ [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
+ [imageAsset requestImageData:^(NSData *imageData, NSDictionary<NSString *,id> *info, BOOL isGif, BOOL isHEIC) {
|
|
|
+ UIImage *targetImage = nil;
|
|
|
+ if (isGif) {
|
|
|
+ targetImage = [UIImage qmui_animatedImageWithData:imageData];
|
|
|
+ } else {
|
|
|
+ targetImage = [UIImage imageWithData:imageData];
|
|
|
+// if (isHEIC) {
|
|
|
+// // iOS 11 中新增 HEIF/HEVC 格式的资源,直接发送新格式的照片到不支持新格式的设备,照片可能会无法识别,可以先转换为通用的 JPEG 格式再进行使用。
|
|
|
+// // 详细请浏览:https://github.com/Tencent/QMUI_iOS/issues/224
|
|
|
+// targetImage = [UIImage imageWithData:UIImageJPEGRepresentation(targetImage, 1)];
|
|
|
+// }
|
|
|
+ }
|
|
|
+ [self performSelector:@selector(tool_setAvatarWithAvatarImage:) withObject:targetImage afterDelay:1.8];
|
|
|
+ }];
|
|
|
+}
|
|
|
+///执行相关的网络请求
|
|
|
+-(void)tool_setAvatarWithAvatarImage:(UIImage *)avatarImage{
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
+ if(self.xxx_tapImgIndex<2){
|
|
|
+ GoodWritUpImgV *tempImgV = self.xxx_upLoadImgAry[self.xxx_tapImgIndex+1];
|
|
|
+ tempImgV.hidden = NO;
|
|
|
+ }
|
|
|
+ GoodWritUpImgV *upImgV = self.xxx_upLoadImgAry[self.xxx_tapImgIndex];
|
|
|
+ upImgV.image = avatarImage;
|
|
|
+ upImgV.isCanTap = NO;
|
|
|
+ [self.xxx_selectImgAry addObject:avatarImage];
|
|
|
+ [self reqNet_upload:avatarImage];
|
|
|
+}
|
|
|
+#pragma mark - **************** reqNet ****************
|
|
|
+-(void)reqNet_upload:(UIImage *)img{
|
|
|
+ NSData *imageData = UIImageJPEGRepresentation(img, 0.6);
|
|
|
+ NSString *dataStr = [imageData base64EncodedStringWithOptions:0];
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
+ [params setObject:dataStr 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];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)handle_postCommentEvent:(UIButton *)btn{
|
|
|
+ if(self.writeTextV.text.length == 0 || self.orderlengthTF.text.length == 0 || self.buyernameTF.text.length == 0){
|
|
|
+ [self.view makeToast:@"Please complete the score first" duration:2 position:CSToastPositionCenter];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSMutableString *imageStr= [[NSMutableString alloc]initWithString:@""];
|
|
|
+ for (int i=0; i<self.xxx_imgUrlAry.count; i++) {
|
|
|
+ NSString * imgUrl = self.xxx_imgUrlAry[i];
|
|
|
+ [imageStr appendString:imgUrl];
|
|
|
+ }
|
|
|
+ NSMutableDictionary *params = [NSMutableDictionary dictionary];
|
|
|
+
|
|
|
+ params[@"id"] = MM_str(self.goodsM.Id) ;
|
|
|
+ params[@"nickname"] = MM_str(self.buyernameTF.text) ;
|
|
|
+ params[@"title"] = MM_str(self.orderlengthTF.text) ;
|
|
|
+ params[@"detail"] = MM_str(self.writeTextV.text) ;
|
|
|
+ params[@"verified_purchase"] = @"0" ;
|
|
|
+ params[@"image_video"] = imageStr;
|
|
|
+ for (int i = 0; i<self.starValueAry.count; i++) {
|
|
|
+ NSString *str = self.starValueAry[i];
|
|
|
+ if([str integerValue] == 0){
|
|
|
+ [self.view makeToast:@"Please complete the score first" duration:2 position:CSToastPositionCenter];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ NSString *ratingStr = [NSString stringWithFormat:@"%ld",[str integerValue] + i*5];
|
|
|
+ [params setObject:ratingStr forKey:[NSString stringWithFormat:@"ratings[%d]",i+1]];
|
|
|
+ }
|
|
|
+ [self.VM ry_formDataRequestPostApi:Reviews_rewriteProductAddReview param:params];
|
|
|
+}
|
|
|
+- (void)ry_respnsData:(nullable id)data
|
|
|
+ parseAry:(nullable NSMutableArray *)arry
|
|
|
+ sucess:(BOOL)sucessOrFail
|
|
|
+ mark:(nonnull NSString *)mark {
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
+ if([mark isEqualToString:Reivews_rewriteProductAddImg]){
|
|
|
+ if(sucessOrFail){
|
|
|
+ [self.view makeToast:@"Sucess" duration:2 position:CSToastPositionCenter];
|
|
|
+ [self.xxx_imgUrlAry addObject:(NSDictionary *)data[@"image_video"]];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ [self.view makeToast:(NSString *)data duration:2 position:CSToastPositionCenter];
|
|
|
+ }
|
|
|
+ }else if ([mark isEqualToString:Reviews_rewriteProductAddReview]){
|
|
|
+ if(sucessOrFail){
|
|
|
+ @weakify(self)
|
|
|
+ [self.view makeToast:@"Your review has been accepted for moderation" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
|
|
|
+ @strongify(self)
|
|
|
+ NSArray *tmpVcAry = self.navigationController.viewControllers;
|
|
|
+ for(UIViewController *vc in tmpVcAry){
|
|
|
+ if([vc isKindOfClass:[AS_GoodsDetailsC class]]){
|
|
|
+ [self.navigationController popToViewController:vc animated:YES];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }];
|
|
|
+ }else{
|
|
|
+ [self.view makeToast:(NSString *)data duration:2 position:CSToastPositionCenter];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - **************** lazy ****************
|
|
|
+-(TT_CustonTF *)buyernameTF{
|
|
|
+ if(!_buyernameTF){
|
|
|
+ _buyernameTF = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(10, 0, KScreenWidth-20, 45)
|
|
|
+ PlaceHolder:@"* BUYER NAME"
|
|
|
+ andLifImage:nil
|
|
|
+ AndRightImage:nil LiftImageFrame:CGRectZero
|
|
|
+ RightImageFrame:CGRectZero
|
|
|
+ AndTag:0
|
|
|
+ AndKeyboardType:UIKeyboardTypeDefault
|
|
|
+ clearButtonMode:UITextFieldViewModeAlways
|
|
|
+ AndReturnKeyType:UIReturnKeyDone
|
|
|
+ masksToBounds:YES
|
|
|
+ conrenRadius:4
|
|
|
+ BorderColor:[UIColor colorWithHexString:@"#000000"]
|
|
|
+ BorderWidth:1];
|
|
|
+ _buyernameTF.font = [UIFont fontWithName:Rob_Regular size:14];
|
|
|
+ _buyernameTF.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
|
|
|
+ }
|
|
|
+ return _buyernameTF;
|
|
|
+}
|
|
|
+
|
|
|
+-(TT_CustonTF *)orderlengthTF{
|
|
|
+ if(!_orderlengthTF){
|
|
|
+ _orderlengthTF = [TT_ControlTool FTT_ControlToolUITextFieldFrame:CGRectMake(10, 0, KScreenWidth-20, 45)
|
|
|
+ PlaceHolder:@"* ORDER LENGTH"
|
|
|
+ andLifImage:nil
|
|
|
+ AndRightImage:nil LiftImageFrame:CGRectZero
|
|
|
+ RightImageFrame:CGRectZero
|
|
|
+ AndTag:0
|
|
|
+ AndKeyboardType:UIKeyboardTypeDefault
|
|
|
+ clearButtonMode:UITextFieldViewModeAlways
|
|
|
+ AndReturnKeyType:UIReturnKeyDone
|
|
|
+ masksToBounds:YES
|
|
|
+ conrenRadius:4
|
|
|
+ BorderColor:[UIColor colorWithHexString:@"#000000"]
|
|
|
+ BorderWidth:1];
|
|
|
+ _orderlengthTF.font = [UIFont fontWithName:Rob_Regular size:14];
|
|
|
+ _orderlengthTF.backgroundColor = [UIColor colorWithHexString:@"#FFFFFF"];
|
|
|
+ }
|
|
|
+ return _orderlengthTF;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+-(QMUITextView *)writeTextV{
|
|
|
+ if(!_writeTextV){
|
|
|
+ _writeTextV = [[QMUITextView alloc]initWithFrame:CGRectMake(10, 0, KScreenWidth-20, 110)];
|
|
|
+ _writeTextV.textContainerInset = UIEdgeInsetsMake(10, 7, 10, 7);
|
|
|
+ _writeTextV.placeholder = @" * WRITE A REVIEW";
|
|
|
+ _writeTextV.layer.cornerRadius = 4;
|
|
|
+ _writeTextV.layer.borderColor = [UIColor colorWithHexString:@"#0B0B0B"].CGColor;
|
|
|
+ _writeTextV.layer.borderWidth = 1;
|
|
|
+ _writeTextV.clipsToBounds = YES;
|
|
|
+ _writeTextV.font = [UIFont fontWithName:Rob_Regular size:14];
|
|
|
+ _writeTextV.placeholderColor = [UIColor colorWithHexString:@"#999999"];
|
|
|
+ }
|
|
|
+ return _writeTextV;
|
|
|
+}
|
|
|
+
|
|
|
+-(UIButton *)bootomBtn{
|
|
|
+ if(!_bootomBtn){
|
|
|
+ IPhoneXHeigh
|
|
|
+ _bootomBtn = [TT_ControlTool FTT_ControlToolUIButtonFrame:CGRectMake(20, KScreenHeight-45-securityBottom_H, KScreenWidth-40, 45)
|
|
|
+ taeget:self
|
|
|
+ sel:@selector(handle_postCommentEvent:)
|
|
|
+ tag:0
|
|
|
+ AntTitle:@"POST COMMENT"
|
|
|
+ titleFont:16
|
|
|
+ titleColor:[UIColor colorWithHexString:@"#FFFFFF"]
|
|
|
+ andImage:nil
|
|
|
+ AndBackColor:[UIColor colorWithHexString:@"#000000"]
|
|
|
+ adjustsFontSizesTowidth:NO
|
|
|
+ masksToBounds:YES
|
|
|
+ conrenRadius:4 BorderColor:nil BorderWidth:0 ContentHorizontalAligment:0];
|
|
|
+ }
|
|
|
+ return _bootomBtn;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (NSMutableArray *)xxx_imgUrlAry {
|
|
|
+ if (!_xxx_imgUrlAry) {
|
|
|
+ _xxx_imgUrlAry = [[NSMutableArray alloc] init];
|
|
|
+ }
|
|
|
+ return _xxx_imgUrlAry;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (NSMutableArray *)xxx_selectImgAry {
|
|
|
+ if (!_xxx_selectImgAry) {
|
|
|
+ _xxx_selectImgAry = [[NSMutableArray alloc] init];
|
|
|
+ }
|
|
|
+ return _xxx_selectImgAry;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ 上传图片
|
|
|
+ [formData appendPartWithFileData:uploadImageData name:@"content_pic" fileName:fileName mimeType:ECGBJKeyJPEG];
|
|
|
+
|
|
|
+
|
|
|
+ @param URLString URL
|
|
|
+ @param content 弹框的内容
|
|
|
+ @param parameters 参数体
|
|
|
+ @param uploadDatas 上传图片NSData
|
|
|
+ @param completeSuccess 成功回调
|
|
|
+ @param completeFailure 失败回调
|
|
|
+
|
|
|
+ [manager POST:URLString parameters:parameters constructingBodyWithBlock:^(id< AFMultipartFormData > _Nonnull formData) {
|
|
|
+
|
|
|
+ NSDateFormatter *formatter=[[NSDateFormatter alloc]init];
|
|
|
+ formatter.dateFormat=@"yyyyMMddHHmmss";
|
|
|
+ NSString *str=[formatter stringFromDate:[NSDate date]];
|
|
|
+ NSString *fileName=[NSString stringWithFormat:@"%@.jpg",str];
|
|
|
+
|
|
|
+ [formData appendPartWithFileData:uploadImageData name:@"content_pic" fileName:fileName mimeType:ECGBJKeyJPEG];
|
|
|
+
|
|
|
+ } progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
+
|
|
|
+ } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
+
|
|
|
+ // 转换responseObject对象
|
|
|
+ NSDictionary *dict = nil;
|
|
|
+ if ([responseObject isKindOfClass:[NSDictionary class]]) {
|
|
|
+ dict = (NSDictionary *)responseObject;
|
|
|
+ } else {
|
|
|
+ dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingAllowFragments error:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 成功后弹框处理,回调出去
|
|
|
+ [weakSelf notDismissedWith:dict responseObject:responseObject complete:^(NSDictionary *respinseDic, id responseObject) {
|
|
|
+ completeSuccess(respinseDic,responseObject);
|
|
|
+ } failedComplete:^{
|
|
|
+ completeFailure();
|
|
|
+ }];
|
|
|
+ } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
|
|
+// 网络问题,弹框处理
|
|
|
+ [weakSelf notNetconnetNotDismissComplete:^{
|
|
|
+ completeFailure();
|
|
|
+ }];
|
|
|
+ }]
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+@end
|