浏览代码

1.图片的详情大图显示

huangxiaodong 1 年之前
父节点
当前提交
1cc8711f2f

+ 12 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -309,6 +309,10 @@
 		6B7EA79F2BF5E0ED002D5CC2 /* NASMsgModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B7EA79D2BF5E0ED002D5CC2 /* NASMsgModel.m */; };
 		6B7EA7A02BF5E0ED002D5CC2 /* NASMsgModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B7EA79C2BF5E0ED002D5CC2 /* NASMsgModel.h */; };
 		6B7EA7A12BF5E0ED002D5CC2 /* NASMsgModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B7EA79D2BF5E0ED002D5CC2 /* NASMsgModel.m */; };
+		6B7EA7A42BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B7EA7A22BF607FB002D5CC2 /* imageDetailsScrollViewController.h */; };
+		6B7EA7A52BF607FB002D5CC2 /* imageDetailsScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B7EA7A32BF607FB002D5CC2 /* imageDetailsScrollViewController.m */; };
+		6B7EA7A62BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B7EA7A22BF607FB002D5CC2 /* imageDetailsScrollViewController.h */; };
+		6B7EA7A72BF607FB002D5CC2 /* imageDetailsScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B7EA7A32BF607FB002D5CC2 /* imageDetailsScrollViewController.m */; };
 		6B8661D62BBA53B600B19846 /* noticeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B8661D52BBA53B600B19846 /* noticeModel.m */; };
 		6B8661D72BBA53B600B19846 /* noticeModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B8661D42BBA53B600B19846 /* noticeModel.h */; };
 		6B8661D82BBA53B600B19846 /* noticeModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B8661D42BBA53B600B19846 /* noticeModel.h */; };
@@ -1203,6 +1207,8 @@
 		6B7EA7972BF5B4A6002D5CC2 /* NASFilePicModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NASFilePicModel.m; sourceTree = "<group>"; };
 		6B7EA79C2BF5E0ED002D5CC2 /* NASMsgModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NASMsgModel.h; sourceTree = "<group>"; };
 		6B7EA79D2BF5E0ED002D5CC2 /* NASMsgModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NASMsgModel.m; sourceTree = "<group>"; };
+		6B7EA7A22BF607FB002D5CC2 /* imageDetailsScrollViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = imageDetailsScrollViewController.h; sourceTree = "<group>"; };
+		6B7EA7A32BF607FB002D5CC2 /* imageDetailsScrollViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = imageDetailsScrollViewController.m; sourceTree = "<group>"; };
 		6B8661D42BBA53B600B19846 /* noticeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = noticeModel.h; sourceTree = "<group>"; };
 		6B8661D52BBA53B600B19846 /* noticeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = noticeModel.m; sourceTree = "<group>"; };
 		6B8661DA2BBA578600B19846 /* HaveNoticeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HaveNoticeView.h; sourceTree = "<group>"; };
@@ -2000,6 +2006,8 @@
 				6B3AD6832BF48DBA0096D6B7 /* shareRecordDetailsHWViewController.m */,
 				6B3AD6882BF4AE630096D6B7 /* backupsOptionViewController.h */,
 				6B3AD6892BF4AE630096D6B7 /* backupsOptionViewController.m */,
+				6B7EA7A22BF607FB002D5CC2 /* imageDetailsScrollViewController.h */,
+				6B7EA7A32BF607FB002D5CC2 /* imageDetailsScrollViewController.m */,
 			);
 			path = previewFile;
 			sourceTree = "<group>";
@@ -2632,6 +2640,7 @@
 				6B2170912B15BAE700656670 /* privacyModeViewController.h in Headers */,
 				6B1FBD3A2B467A8000926382 /* backupsFilerecordTableView.h in Headers */,
 				6BF0F3D02AD391D8000AA133 /* connectDeviceManager.h in Headers */,
+				6B7EA7A42BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */,
 				6BFF26952AF9D8CC00FCB4F7 /* AuthCodeInputView.h in Headers */,
 				6B1CC2C62B677F3E00AD4217 /* extraMediaEventModel.h in Headers */,
 				6B5B607A2B3E71B6009A2AE2 /* filePathCreatTableViewCell.h in Headers */,
@@ -2776,6 +2785,7 @@
 				6BD506BF2B9576A4006E7CB0 /* privacyModeViewController.h in Headers */,
 				6BD506C02B9576A4006E7CB0 /* backupsFilerecordTableView.h in Headers */,
 				6BD506C12B9576A4006E7CB0 /* connectDeviceManager.h in Headers */,
+				6B7EA7A62BF607FB002D5CC2 /* imageDetailsScrollViewController.h in Headers */,
 				6BD506C22B9576A4006E7CB0 /* AuthCodeInputView.h in Headers */,
 				6BD506C32B9576A4006E7CB0 /* extraMediaEventModel.h in Headers */,
 				6BD506C42B9576A4006E7CB0 /* filePathCreatTableViewCell.h in Headers */,
@@ -3405,6 +3415,7 @@
 				6BD507A32B9576A4006E7CB0 /* HWFolderModel.m in Sources */,
 				6BD507A42B9576A4006E7CB0 /* fileTransferPathCheckViewController.m in Sources */,
 				6B9354A92BF3848D00AA8D31 /* shareRecordViewController.m in Sources */,
+				6B7EA7A72BF607FB002D5CC2 /* imageDetailsScrollViewController.m in Sources */,
 				6BD507A52B9576A4006E7CB0 /* RCCommandHelp.m in Sources */,
 				6BD507A62B9576A4006E7CB0 /* HWBookmarkModel.m in Sources */,
 				6BD507A72B9576A4006E7CB0 /* NSCache+BGCache.m in Sources */,
@@ -3634,6 +3645,7 @@
 				A00221E427EB256D00E45F78 /* HWFolderModel.m in Sources */,
 				6B5B606F2B3D7E3B009A2AE2 /* fileTransferPathCheckViewController.m in Sources */,
 				6B9354A62BF3848D00AA8D31 /* shareRecordViewController.m in Sources */,
+				6B7EA7A52BF607FB002D5CC2 /* imageDetailsScrollViewController.m in Sources */,
 				183AE6B02A8C9EAB00B11CB0 /* RCCommandHelp.m in Sources */,
 				A00221E727EB25B000E45F78 /* HWBookmarkModel.m in Sources */,
 				A08A94FC27E9A4E400C544BB /* NSCache+BGCache.m in Sources */,

+ 17 - 0
创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.h

@@ -0,0 +1,17 @@
+//
+//  imageDetailsScrollViewController.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/5/16.
+//
+
+#import "BaseViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface imageDetailsScrollViewController : BaseViewController
+@property(nonatomic,assign) NSInteger index;
+@property(nonatomic,strong) NSMutableArray*totalDataArr;
+@end
+
+NS_ASSUME_NONNULL_END

+ 123 - 0
创维盒子/双子星云手机/Class/Set/previewFile/imageDetailsScrollViewController.m

@@ -0,0 +1,123 @@
+//
+//  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"
+
+@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 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];
+        }
+        else if(tag==2){
+            [weakSelf gotoShareViewFun];
+        }
+        else if(tag==3){
+            [[iToast makeText:@"点击删除"] show];
+        }
+    };
+}
+
+#pragma mark 用户点击分享
+- (void)gotoShareViewFun
+{
+    editShareView *editShareV = [[editShareView alloc] init];
+    [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 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));
+    }];
+
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self->_curScrollView makeScrollViewScrollToIndex:self->_index];
+    });
+    
+    KWeakSelf
+    _curScrollView.itemDidScrollOperationBlock = ^(NSInteger currentIndex) {
+        [weakSelf setTitleLabelTextFunBy:currentIndex];
+    };
+    
+}
+
+- (void)setTitleLabelTextFunBy:(NSInteger)index
+{
+    if(index >0 &&  index < _totalDataArr.count){
+        NASFilePicDataArrModel *dataModel = _totalDataArr[index];
+        self.titleLabel.text = dataModel.name;
+    }
+}
+@end

+ 106 - 56
创维盒子/双子星云手机/Class/Set/previewFile/previewImageOrVideoViewController.m

@@ -21,6 +21,7 @@
 #import "editShareView.h"
 #import "previewToUploadFileView.h"
 #import "NASFilePicModel.h"
+#import "imageDetailsScrollViewController.h"
 
 @interface previewImageOrVideoViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 {
@@ -370,15 +371,15 @@
             cell.curFileModel = dataModel;
             
             KWeakSelf
-//            cell.didClckSelectBut = ^(BOOL selectType){
-//                if([weakSelf userCheckFileModel:fileModel withShowTip:YES]){
-//                    [weakSelf userCheckFilePreviewByRow:row];
-//                }
-//            };
-//            
-//            cell.didClickEditType = ^(BOOL editType) {
-//                [self setViewEditTypeFun];
-//            };
+            cell.didClckSelectBut = ^(BOOL selectType){
+                if([weakSelf userCheckFileModel:dataModel withShowTip:YES]){
+                    [weakSelf userCheckFilePreviewByRow:row];
+                }
+            };
+            
+            cell.didClickEditType = ^(BOOL editType) {
+                [weakSelf setViewEditTypeFun];
+            };
         }
     }
     
@@ -388,8 +389,13 @@
 
 - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
     if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
+        NSInteger section = indexPath.section;
         titleLabelReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"titleLabelReusableView" forIndexPath:indexPath];
-        headerView.titlelabel.text = @"2025年13月32号";
+        
+        if(_curNASFilePicModel && _curNASFilePicModel.data.count > section){
+            NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data[section];
+            headerView.titlelabel.text = timeArrModel.time;
+        }
         return headerView;
     }
     
@@ -401,6 +407,23 @@
     return CGSizeMake([UIScreen mainScreen].bounds.size.width, 40);
 }
 
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
+{
+     NSInteger row = indexPath.row;
+     NSInteger section = indexPath.section;
+    
+    if(_curNASFilePicModel && _curNASFilePicModel.data.count > section){
+        NASFilePicTimeArrModel *timeArrModel = _curNASFilePicModel.data[section];
+        if (timeArrModel.list.count > row) {
+            //NASFilePicDataArrModel * dataModel = timeArrModel.list[row];
+            
+            if(_isPhotoType){
+                [self didClickPicDetailsWithSection:section withRow:row];
+            }
+        }
+    }
+}
+
 #pragma mark 空数据
 - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
     
@@ -431,51 +454,51 @@
 //需求说明:解决除JPG  PNG  GIF TIFF  BMP总计5种格式外,其他格式下载失败的问题
 //视觉交互:选择文件中含有其他格式,toast提示“IOS系统仅支持JPG 、PNG、GIF、TIFF、BMP的图片格式,其他格式无法下载”。点击下载按钮,过滤其他格式文件,仅下载JPG 、PNG、GIF、TIFF、BMP的图片格式文件;
 
-- (BOOL)userCheckFileModel:(couldPhoneFileModel*)fileModel withShowTip:(BOOL)canShow{
-    NSString*name = [fileModel.name lowercaseString];
-    NSArray *nameArr = [name componentsSeparatedByString:@"."];
-    if(nameArr.count >0 && !_isPhotoType){
-        BOOL canDownLoadType = NO;
-        
-        NSString *lastName = nameArr.lastObject;
-        if([lastName isEqualToString:@"mp4"]
-           ||[lastName isEqualToString:@"mov"]
-           ||[lastName isEqualToString:@"3gp"]
-           ||[lastName isEqualToString:@"m4v"]){
-            canDownLoadType = YES;
-        }
-        
-        if(!canDownLoadType){
-            if(canShow){
-                [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
-            }
-            
-            return NO;
-        }
-    }
-    
-    if(nameArr.count >0 && _isPhotoType){
-        BOOL canDownLoadType = NO;
-        //JPG 、PNG、GIF、TIFF、BMP
-        NSString *lastName = nameArr.lastObject;
-        if([lastName isEqualToString:@"jpg"]
-           ||[lastName isEqualToString:@"png"]
-           ||[lastName isEqualToString:@"gif"]
-           ||[lastName isEqualToString:@"tiff"]
-           ||[lastName isEqualToString:@"bmp"]
-           ||[lastName isEqualToString:@"heic"]
-           ||[lastName isEqualToString:@"jpeg"]
-           ||[lastName isEqualToString:@"heif"]){
-            canDownLoadType = YES;
-        }
-        
-        if(!canDownLoadType){
-            if(canShow){
-                [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
-            }
-            return NO;
-        }
-    }
+- (BOOL)userCheckFileModel:(NASFilePicDataArrModel*)fileModel withShowTip:(BOOL)canShow{
+//    NSString*name = [fileModel.name lowercaseString];
+//    NSArray *nameArr = [name componentsSeparatedByString:@"."];
+//    if(nameArr.count >0 && !_isPhotoType){
+//        BOOL canDownLoadType = NO;
+//        
+//        NSString *lastName = nameArr.lastObject;
+//        if([lastName isEqualToString:@"mp4"]
+//           ||[lastName isEqualToString:@"mov"]
+//           ||[lastName isEqualToString:@"3gp"]
+//           ||[lastName isEqualToString:@"m4v"]){
+//            canDownLoadType = YES;
+//        }
+//        
+//        if(!canDownLoadType){
+//            if(canShow){
+//                [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
+//            }
+//            
+//            return NO;
+//        }
+//    }
+//    
+//    if(nameArr.count >0 && _isPhotoType){
+//        BOOL canDownLoadType = NO;
+//        //JPG 、PNG、GIF、TIFF、BMP
+//        NSString *lastName = nameArr.lastObject;
+//        if([lastName isEqualToString:@"jpg"]
+//           ||[lastName isEqualToString:@"png"]
+//           ||[lastName isEqualToString:@"gif"]
+//           ||[lastName isEqualToString:@"tiff"]
+//           ||[lastName isEqualToString:@"bmp"]
+//           ||[lastName isEqualToString:@"heic"]
+//           ||[lastName isEqualToString:@"jpeg"]
+//           ||[lastName isEqualToString:@"heif"]){
+//            canDownLoadType = YES;
+//        }
+//        
+//        if(!canDownLoadType){
+//            if(canShow){
+//                [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
+//            }
+//            return NO;
+//        }
+//    }
     
     return YES;
 }
@@ -721,7 +744,10 @@
     [self showDownloadTipFun];
     [self checkFileTransferTask];
     
-    [self getFileListFun];
+    if(!_curNASFilePicModel){
+        [self getFileListFun];
+    }
+    
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -833,4 +859,28 @@
     }];
 }
 
+#pragma mark 点击图片详情
+- (void)didClickPicDetailsWithSection:(NSInteger)section withRow:(NSInteger)row{
+    
+    if(_curNASFilePicModel){
+        NSMutableArray *totalArr = [NSMutableArray new];
+        NSInteger index = 0;
+        
+        for (int i=0; i<_curNASFilePicModel.data.count; i++) {
+            NASFilePicTimeArrModel *timeModel = _curNASFilePicModel.data[i];
+            
+            if(i == section){
+                index = totalArr.count + row;
+            }
+            
+            [totalArr addObjectsFromArray:timeModel.list];
+        }
+        
+        imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
+        vc.index = index;
+        vc.totalDataArr = totalArr;
+        [self.navigationController pushViewController:vc animated:YES];
+        
+    }
+}
 @end

+ 8 - 2
创维盒子/双子星云手机/Class/Set/previewFile/view/imageCollectionViewCell.m

@@ -74,10 +74,16 @@
     else{
         NSString *filePath = _curFileModel.path;
         NSString *urlStr = ksharedAppDelegate.NASFileService;
-        NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@/getThumbnail?path=%@",urlStr,filePath];
+        NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getThumbnail?path=%@",urlStr,filePath];
         
         [_imageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
-            HLog(@"111");
+//            if(image){
+//                HLog(@"11图片1:%@",imageURL.absoluteString);
+//            }
+//            else{
+//                HLog(@"11图片0:%@",imageURL.absoluteString);
+//            }
+            
         }];
     }