// // imageDetailsScrollViewController.m // 双子星云手机 // // Created by xd h on 2024/5/16. // #import "imageDetailsScrollViewController.h" #import #import "editTypeBottomView.h" #import "editShareView.h" #import "NASFilePicModel.h" #import "uploadFileRecordViewController.h" @interface imageDetailsScrollViewController () { NSMutableArray *imageURLStringsGroup; } @property (nonatomic,strong) SDCycleScrollView *curScrollView; @property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView; @end @implementation imageDetailsScrollViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self.toolBar setHidden:YES]; [self.navigationBar setHidden:YES]; [self.navBarBGView setHidden:NO]; self.navBarBGView.backgroundColor = [UIColor whiteColor]; [self.view setBackgroundColor:[UIColor whiteColor]]; [self drawAnyView]; } - (void)drawAnyView { _curEditTypeBottomView = [[editTypeBottomView alloc] init]; [self.view addSubview:_curEditTypeBottomView]; _curEditTypeBottomView.hidden = YES; [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.height.mas_equalTo(60 + AdaptTabHeight); }]; KWeakSelf #pragma mark 编辑状态的 下载 分享 删除 响应事件 _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) { if(tag==1){ //[[iToast makeText:@"点击下载"] show]; [weakSelf gotoDownLoadFileFun]; } else if(tag==2){ [weakSelf gotoShareViewFun]; } else if(tag==3){ //[[iToast makeText:@"点击删除"] show]; [weakSelf showDeleteAlearViewFun]; } }; } #pragma mark 用户点击分享 - (void)gotoShareViewFun { editShareView *editShareV = [[editShareView alloc] init]; NASFilePicDataArrModel *dataModel = _totalDataArr[_index]; editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[dataModel]]; editShareV.shareFileType = @"2"; [self.view addSubview:editShareV]; [editShareV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; } - (void)setTotalDataArr:(NSMutableArray *)totalDataArr { _totalDataArr = totalDataArr; imageURLStringsGroup = [NSMutableArray new]; for (NASFilePicDataArrModel*dataModel in _totalDataArr) { NSString * URLString = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",ksharedAppDelegate.NASFileService,dataModel.path]; [imageURLStringsGroup addObject:URLString]; } _curScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageURLStringsGroup:imageURLStringsGroup]; _curScrollView.autoScroll = NO; _curScrollView.infiniteLoop = NO; //_curScrollView.placeholderImage = [UIImage imageNamed:@"uploadFile_image"]; [self.view addSubview:_curScrollView]; _curScrollView.backgroundColor = [UIColor lightGrayColor]; _curScrollView.hidden = YES; [_curScrollView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.top.equalTo(self.navBarBGView.mas_bottom).offset(0); //make.bottom.mas_equalTo(-(60+ AdaptTabHeight)); make.bottom.mas_equalTo(0); }]; KWeakSelf dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self->_curScrollView makeScrollViewScrollToIndex:self->_index]; [weakSelf setTitleLabelTextFunBy:self->_index]; self->_curScrollView.hidden = NO; }); _curScrollView.itemDidScrollOperationBlock = ^(NSInteger currentIndex) { weakSelf.index = currentIndex; [weakSelf setTitleLabelTextFunBy:currentIndex]; }; } - (void)setTitleLabelTextFunBy:(NSInteger)index { if(index >=0 && index < _totalDataArr.count){ NASFilePicDataArrModel *dataModel = _totalDataArr[index]; self.titleLabel.text = dataModel.name; } } #pragma mark 删除图片 - (void)showDeleteAlearViewFun { NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil); NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil); KWeakSelf ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr msg:tipStr imageStr:nil cancelTitle:NSLocalizedString(@"other_cancel",nil) okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES didClickOk:^{ [weakSelf delFileListFun]; } didClickCancel:^{ }]; curAlretVC.modalPresentationStyle = UIModalPresentationCustom; [self presentViewController:curAlretVC animated:YES completion:^{ curAlretVC.view.superview.backgroundColor = [UIColor clearColor]; }]; } #pragma mark 删除文件数据 - (void)delFileListFun { NSMutableDictionary*paraDict = [NSMutableDictionary new]; if(_index >=0 && _index < _totalDataArr.count){ NASFilePicDataArrModel *dataModel = _totalDataArr[_index]; NSArray *pathArr = @[dataModel.path]; //NSArray *pathArr = @[dataModel.path,dataModel.path]; [paraDict setValue:pathArr forKey:@"path"]; } [self showNewIndicatorWithCanBack:YES canTouch:NO]; //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC] KWeakSelf //@"delFile" [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) { [weakSelf removeNewIndicator]; SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil]; if(model && model.status == 0){ [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show]; if(weakSelf.didNeedToRegetDataFun){ weakSelf.didNeedToRegetDataFun(); } [weakSelf.navigationController popViewControllerAnimated:YES]; } else{ } } failure:^(NSError * _Nonnull error) { [weakSelf removeNewIndicator]; }]; } - (void)gotoDownLoadFileFun { if(_index >=0 && _index < _totalDataArr.count){ NASFilePicDataArrModel *dataModel = _totalDataArr[_index]; couldPhoneFileModel* fileModel = [couldPhoneFileModel new]; fileModel.fileType = @".jpg"; fileModel.path = dataModel.path; fileModel.name = dataModel.name; fileModel.length = dataModel.size; NSMutableArray *arr = [NSMutableArray new]; [arr addObject:fileModel]; uploadFileRecordViewController *vc = [uploadFileRecordViewController new]; [self.navigationController pushViewController:vc animated:YES]; vc.isDownloadingType = YES; [vc gotoDownloadFile:arr]; } } - (void)setCanShareType:(BOOL)canShareType { _canShareType = canShareType; [_curEditTypeBottomView setCanShaewFunBy:canShareType]; } @end