123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- //
- // imageDetailsScrollViewController.m
- // 双子星云手机
- //
- // Created by xd h on 2024/5/16.
- //
- #import "imageDetailsScrollViewController.h"
- #import <SDCycleScrollView/SDCycleScrollView.h>
- #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
|