浏览代码

1.最近文件点击响应

huangxiaodong 11 月之前
父节点
当前提交
f36ebf3354

+ 90 - 0
创维盒子/双子星云手机/NAS/NASViewController.m

@@ -23,8 +23,15 @@
 #import "lastFileManager.h"
 #import "lastFileTableViewCell.h"
 #import "nasLastFileViewController.h"
+#import "audioPlayerViewController.h"
+#import "videoPlayByAVPlayerViewController.h"
+#import "imageDetailsScrollViewController.h"
+#import "queryShareModel.h"
 
 @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
+{
+    BOOL canShareType;
+}
 @property (nonatomic,strong)UITableView*tableView;
 
 @property (nonatomic, strong) UIView*tableHeadView;
@@ -292,6 +299,67 @@
     return 84;
 }
 
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    NSInteger row = indexPath.row;
+    
+    if(row < _lastFileDataArr.count){
+        lastFileModel* dataModel = _lastFileDataArr[row];
+        
+        if([dataModel.type isEqualToString:@"video"]){
+            videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
+            vc.VideoDataMode = (NASFileAndFolderDataModel*)dataModel;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+        else if([dataModel.type isEqualToString:@"audio"]){
+            
+            NSMutableArray *audioDataArr = [NSMutableArray new];
+            NSInteger index = 0;
+            
+            for (int i=0; i<_lastFileDataArr.count; i++) {
+                lastFileModel* audioDataModel = _lastFileDataArr[i];
+                if([dataModel.type isEqualToString:@"audio"]){
+                    
+                    if(i == row){
+                        index = audioDataArr.count;
+                    }
+                    
+                    [audioDataArr addObject:audioDataModel];
+                }
+            }
+            
+            audioPlayerViewController *vc = [audioPlayerViewController new];
+            vc.index = index;
+            vc.audioOutSidedataArray = audioDataArr;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+        else if([dataModel.type isEqualToString:@"jpg"]){
+            
+            NSMutableArray *jpgDataArr = [NSMutableArray new];
+            NSInteger index = 0;
+            
+            for (int i=0; i<_lastFileDataArr.count; i++) {
+                lastFileModel* jpgDataModel = _lastFileDataArr[i];
+                if([dataModel.type isEqualToString:@"jpg"]){
+                    
+                    if(i == row){
+                        index = jpgDataArr.count;
+                    }
+                    
+                    [jpgDataArr addObject:jpgDataModel];
+                }
+            }
+            
+            imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
+            vc.index = index;
+            vc.totalDataArr = jpgDataArr;
+            [self.navigationController pushViewController:vc animated:YES];
+            vc.canShareType = canShareType;
+            
+        }
+    }
+}
+
 #pragma mark 点击头部
 - (void)didClickHeadButtonFun:(UIButton*)but
 {
@@ -456,6 +524,8 @@
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
     [self getLastFileDataFun];
+    
+    [self queryShareSwitchFunFun];
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -563,4 +633,24 @@
     
     [self.tableView reloadData];
 }
+
+#pragma mark 获取分享开关
+-(void)queryShareSwitchFunFun
+{
+    NSMutableDictionary *paraDict = [NSMutableDictionary new];
+    
+    [paraDict setValue:@7 forKey:@"type"];
+    
+    KWeakSelf
+    [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id  _Nonnull responseObject){
+        queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
+        if(queryShareMod){
+            self->canShareType = queryShareMod.data.configValue;
+            //[weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
+        }
+        
+    } failure:^(NSError * _Nonnull error) {
+    }];
+}
+
 @end

+ 61 - 9
创维盒子/双子星云手机/NAS/nasLastFileViewController.m

@@ -14,10 +14,14 @@
 #import "queryShareModel.h"
 #import "audioPlayerViewController.h"
 #import "videoPlayByAVPlayerViewController.h"
+#import "imageDetailsScrollViewController.h"
 #import "editShareView.h"
 #import "ComontAlretDeleteTypeViewController.h"
 
 @interface nasLastFileViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
+{
+    BOOL canShareType;
+}
 @property(nonatomic,strong) UITableView*tableView;
 @property (nonatomic,strong) NSMutableArray *lastFileDataArr;
 
@@ -192,15 +196,62 @@
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     NSInteger row = indexPath.row;
-//    if(row < _curNASFileAudioMod.data.list.count){
-//        
-//        NASFilePicDataArrModel *dataModel = _curNASFileAudioMod.data.list[row];
-//        //videoPlayViewController *vc = [videoPlayViewController new];
-//        videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
-//        vc.VideoDataMode = dataModel;
-//        [self.navigationController pushViewController:vc animated:YES];
-//        
-//    }
+    
+    if(row < _lastFileDataArr.count){
+        lastFileModel* dataModel = _lastFileDataArr[row];
+        
+        if([dataModel.type isEqualToString:@"video"]){
+            videoPlayByAVPlayerViewController *vc = [videoPlayByAVPlayerViewController new];
+            vc.VideoDataMode = (NASFileAndFolderDataModel*)dataModel;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+        else if([dataModel.type isEqualToString:@"audio"]){
+            
+            NSMutableArray *audioDataArr = [NSMutableArray new];
+            NSInteger index = 0;
+            
+            for (int i=0; i<_lastFileDataArr.count; i++) {
+                lastFileModel* audioDataModel = _lastFileDataArr[i];
+                if([dataModel.type isEqualToString:@"audio"]){
+                    
+                    if(i == row){
+                        index = audioDataArr.count;
+                    }
+                    
+                    [audioDataArr addObject:audioDataModel];
+                }
+            }
+            
+            audioPlayerViewController *vc = [audioPlayerViewController new];
+            vc.index = index;
+            vc.audioOutSidedataArray = audioDataArr;
+            [self.navigationController pushViewController:vc animated:YES];
+        }
+        else if([dataModel.type isEqualToString:@"jpg"]){
+            
+            NSMutableArray *jpgDataArr = [NSMutableArray new];
+            NSInteger index = 0;
+            
+            for (int i=0; i<_lastFileDataArr.count; i++) {
+                lastFileModel* jpgDataModel = _lastFileDataArr[i];
+                if([dataModel.type isEqualToString:@"jpg"]){
+                    
+                    if(i == row){
+                        index = jpgDataArr.count;
+                    }
+                    
+                    [jpgDataArr addObject:jpgDataModel];
+                }
+            }
+            
+            imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
+            vc.index = index;
+            vc.totalDataArr = jpgDataArr;
+            [self.navigationController pushViewController:vc animated:YES];
+            vc.canShareType = canShareType;
+            
+        }
+    }
 }
 
 #pragma mark 空数据
@@ -463,6 +514,7 @@
     [[netWorkManager shareInstance] CommonGetWithCallBackCode:queryShareSwitchFun Parameters:paraDict success:^(id  _Nonnull responseObject){
         queryShareModel *queryShareMod = [[queryShareModel alloc] initWithDictionary:responseObject error:nil];
         if(queryShareMod){
+            self->canShareType = queryShareMod.data.configValue;
             [weakSelf.curEditTypeBottomView setCanShaewFunBy:queryShareMod.data.configValue];
         }