Przeglądaj źródła

1.首页最近文件

huangxiaodong 11 miesięcy temu
rodzic
commit
5b9c287030

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

@@ -170,6 +170,10 @@
 		6B07AC2C2BF8D38F005C2B0E /* NASFileAudioModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07AC2A2BF8D38F005C2B0E /* NASFileAudioModel.m */; };
 		6B07AC2D2BF8D38F005C2B0E /* NASFileAudioModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07AC2A2BF8D38F005C2B0E /* NASFileAudioModel.m */; };
 		6B07AC2E2BF8D38F005C2B0E /* NASFileAudioModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07AC292BF8D38F005C2B0E /* NASFileAudioModel.h */; };
+		6B07E0A62C3CD4AF004A3238 /* lastFileTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */; };
+		6B07E0A72C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0A42C3CD4AF004A3238 /* lastFileTableViewCell.h */; };
+		6B07E0A82C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B07E0A42C3CD4AF004A3238 /* lastFileTableViewCell.h */; };
+		6B07E0A92C3CD4AF004A3238 /* lastFileTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */; };
 		6B0D004B2BFE104B00F02719 /* queryOneShareModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */; };
 		6B0D004C2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
 		6B0D004D2BFE104B00F02719 /* queryOneShareModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0D00492BFE104B00F02719 /* queryOneShareModel.h */; };
@@ -1436,6 +1440,8 @@
 		6B07AC242BF85859005C2B0E /* ShareRecordModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareRecordModel.m; sourceTree = "<group>"; };
 		6B07AC292BF8D38F005C2B0E /* NASFileAudioModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NASFileAudioModel.h; sourceTree = "<group>"; };
 		6B07AC2A2BF8D38F005C2B0E /* NASFileAudioModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NASFileAudioModel.m; sourceTree = "<group>"; };
+		6B07E0A42C3CD4AF004A3238 /* lastFileTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lastFileTableViewCell.h; sourceTree = "<group>"; };
+		6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = lastFileTableViewCell.m; sourceTree = "<group>"; };
 		6B0D00492BFE104B00F02719 /* queryOneShareModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = queryOneShareModel.h; sourceTree = "<group>"; };
 		6B0D004A2BFE104B00F02719 /* queryOneShareModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = queryOneShareModel.m; sourceTree = "<group>"; };
 		6B1CC2C42B677F3D00AD4217 /* extraMediaEventModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = extraMediaEventModel.h; sourceTree = "<group>"; };
@@ -2893,6 +2899,8 @@
 				6B5D86722C22C63F008D25EA /* NASCommonUsedView.m */,
 				6B5D86772C22D6E9008D25EA /* NASLastFileView.h */,
 				6B5D86782C22D6E9008D25EA /* NASLastFileView.m */,
+				6B07E0A42C3CD4AF004A3238 /* lastFileTableViewCell.h */,
+				6B07E0A52C3CD4AF004A3238 /* lastFileTableViewCell.m */,
 			);
 			path = view;
 			sourceTree = "<group>";
@@ -3653,6 +3661,7 @@
 				6B467BB92BC7F7D70039A6A6 /* fileUploadToFileCenterModel.h in Headers */,
 				6B2C1EA82C070ADE00FDCF82 /* ZFReachabilityManager.h in Headers */,
 				6B2C1E422C070ADE00FDCF82 /* ZFSliderView.h in Headers */,
+				6B07E0A72C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */,
 				6BFF268C2AF8E1C600FCB4F7 /* forgetPwdViewController.h in Headers */,
 				6BF52C992AD5546500A617DB /* Reachability.h in Headers */,
 				6B5D40152B47F27A000965CF /* couldPhoneCommonModel.h in Headers */,
@@ -3891,6 +3900,7 @@
 				6B467BBB2BC7F7D70039A6A6 /* fileUploadToFileCenterModel.h in Headers */,
 				6B2C1EA92C070ADE00FDCF82 /* ZFReachabilityManager.h in Headers */,
 				6B2C1E432C070ADE00FDCF82 /* ZFSliderView.h in Headers */,
+				6B07E0A82C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */,
 				6BD506ED2B9576A4006E7CB0 /* forgetPwdViewController.h in Headers */,
 				6BD506EE2B9576A4006E7CB0 /* Reachability.h in Headers */,
 				6BD506F02B9576A4006E7CB0 /* couldPhoneCommonModel.h in Headers */,
@@ -4472,6 +4482,7 @@
 				6BD507602B9576A4006E7CB0 /* AJPhotoListCell.m in Sources */,
 				6B6ABEEF2BFF5B2F00480BAC /* receiveSaveRecordTableView.m in Sources */,
 				6B2C1E9B2C070ADE00FDCF82 /* ZFPlayerNotification.m in Sources */,
+				6B07E0A92C3CD4AF004A3238 /* lastFileTableViewCell.m in Sources */,
 				6BD507612B9576A4006E7CB0 /* FMDatabasePool.m in Sources */,
 				6BD507622B9576A4006E7CB0 /* iToast.m in Sources */,
 				6B2C1E272C070ADE00FDCF82 /* UIView+ZFFrame.m in Sources */,
@@ -4792,6 +4803,7 @@
 				6B0581A32AFCF50300D37290 /* AJPhotoListCell.m in Sources */,
 				6B6ABEED2BFF5B2F00480BAC /* receiveSaveRecordTableView.m in Sources */,
 				6B2C1E9A2C070ADE00FDCF82 /* ZFPlayerNotification.m in Sources */,
+				6B07E0A62C3CD4AF004A3238 /* lastFileTableViewCell.m in Sources */,
 				A08A950327E9A4E400C544BB /* FMDatabasePool.m in Sources */,
 				A003F6D327D8425C00715CBF /* iToast.m in Sources */,
 				6B2C1E262C070ADE00FDCF82 /* UIView+ZFFrame.m in Sources */,

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/audioPlayerViewController.m

@@ -391,7 +391,7 @@
         lastFileMod.time = dataModel.time;
         lastFileMod.size = dataModel.size;
         lastFileMod.duration = dataModel.duration;
-        lastFileMod.type = @"jpg";
+        lastFileMod.type = @"audio";
         lastFileMod.lastPreTime = [iTools getNowTimeStamp];
         
         [[lastFileManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];

+ 1 - 1
创维盒子/双子星云手机/Class/Set/previewFile/videoPlayByAVPlayerViewController.m

@@ -296,7 +296,7 @@
     lastFileMod.time = dataModel.time;
     lastFileMod.size = dataModel.size;
     lastFileMod.duration = dataModel.duration;
-    lastFileMod.type = @"jpg";
+    lastFileMod.type = @"video";
     lastFileMod.lastPreTime = [iTools getNowTimeStamp];
     
     [[lastFileManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];

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

@@ -20,6 +20,8 @@
 #import "previewToUploadFileView.h"
 #import "NASMySpaceViewController.h"
 #import "NasPreviewVideoViewController.h"
+#import "lastFileManager.h"
+#import "lastFileTableViewCell.h"
 
 @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
 @property (nonatomic,strong)UITableView*tableView;
@@ -29,6 +31,7 @@
 @property (nonatomic, strong) NASCommonUsedView* NASCommonUsedV;
 
 @property (nonatomic,strong)NASLastFileView*NASLastFileV;
+@property (nonatomic,strong) NSMutableArray *lastFileDataArr;
 @end
 
 @implementation NASViewController
@@ -132,7 +135,7 @@
         make.bottom.mas_equalTo(-TABBARHEIGHT);
     }];
     
-    _tableHeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 165+ 15 +120 + 15)];
+    _tableHeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 165+ 15 +120 +54 + 15)];
     //_tableHeadView.backgroundColor = [UIColor hwColor:@"#F6F8FA"];
     _tableHeadView.backgroundColor = [UIColor clearColor];
     self.tableView.tableHeaderView = _tableHeadView;
@@ -160,6 +163,23 @@
         make.height.mas_equalTo(120);
     }];
     
+    //最近文件
+    [_tableHeadView addSubview:self.NASLastFileV];
+    [self.NASLastFileV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
+        make.left.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.height.mas_equalTo(54);
+    }];
+    
+    //tableFooterView
+    NSString *text =  NSLocalizedString(@"NAS_bottom_tip",nil);
+    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 50)];
+    label.text = [[NSString alloc] initWithFormat:@"-  %@  -",text];
+    label.textColor = [UIColor hwColor:@"#959799"];
+    label.font = [UIFont systemFontOfSize:12];
+    label.textAlignment = NSTextAlignmentCenter;
+    self.tableView.tableFooterView = label;
     
     KWeakSelf
     _NASMySpaceV.didClickButtonFun = ^(NSInteger tag) {
@@ -218,55 +238,53 @@
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return 0;
-}
-
-- (shareSecretTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-    
-    __block NSInteger row = indexPath.row;
-    static NSString *identifier = @"shareSecretTableViewCell";
-    
-    shareSecretTableViewCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
-    cell.selectionStyle = UITableViewCellSelectionStyleNone;
-    if (!cell){
-        cell = [[shareSecretTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
-        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
-        [cell setBackgroundColor:[UIColor clearColor]];
-        [cell setAccessoryType:(UITableViewCellAccessoryNone)];
+    if(!_lastFileDataArr){
+        return 0;
     }
-    
-    
-//    if(row < _didSelectListArr.count){
-//        NASFilePicDataArrModel*dataModel = _didSelectListArr[row];
-//        cell.dataModel = dataModel;
-//    }
-    return cell;
-}
-
-- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
-    return self.NASLastFileV;
+    return _lastFileDataArr.count;
 }
 
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
-    //return 54;//隐藏
+- (lastFileTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
+    
+        __block NSInteger row = indexPath.row;
+        static NSString *identifier = @"lastFileTableViewCell";
+    
+        lastFileTableViewCell * cell =  [tableView dequeueReusableCellWithIdentifier:identifier];
+        cell.selectionStyle = UITableViewCellSelectionStyleNone;
+        if (!cell){
+            cell = [[lastFileTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
+            [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
+            [cell setBackgroundColor:[UIColor clearColor]];
+            [cell setAccessoryType:(UITableViewCellAccessoryNone)];
+            [cell hideCheckButtonBy:YES];
+        }
     
-    return 54 + 200;//无数据
-}
-
-- (UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
-{
-    NSString *text =  NSLocalizedString(@"NAS_bottom_tip",nil);
-    UILabel *label = [[UILabel alloc] init];
-    label.text = [[NSString alloc] initWithFormat:@"-  %@  -",text];
-    label.textColor = [UIColor hwColor:@"#959799"];
-    label.font = [UIFont systemFontOfSize:12];
-    label.textAlignment = NSTextAlignmentCenter;
+        if(row < _lastFileDataArr.count){
+            lastFileModel* dataModel = _lastFileDataArr[row];
+            cell.curLastFileModel = dataModel;
+    
+    //        KWeakSelf
+    //        cell.didClickSwitch = ^(BOOL SwitchOn) {
+    //            //[weakSelf userCheckFilePreviewByRow:row];
+    //        };
+            
+            if(row == _lastFileDataArr.count -1){
+                /*下圆角*/
+                UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-32 , 84)
+                                                               byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
+                                                                     cornerRadii:CGSizeMake(12, 12)];
+                CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+                maskLayer.frame = cell.cellBgView.bounds;
+                maskLayer.path = maskPath.CGPath;
+                cell.cellBgView.layer.mask = maskLayer;
+            }
+        }
     
-    return label;
+    return cell;
 }
 
-- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
-    return 60.0;
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+    return 84;
 }
 
 #pragma mark 点击头部
@@ -426,7 +444,7 @@
 
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
-    
+    [self getLastFileDataFun];
 }
 
 - (void)viewWillDisappear:(BOOL)animated{
@@ -450,4 +468,59 @@
     // 隐藏 tab bar
     self.tabBarController.tabBar.hidden = YES;
 }
+
+#pragma mark 获取最近文件数据
+- (void)getLastFileDataFun
+{
+    _lastFileDataArr = [lastFileManager shareManager].lastFileListArr;
+    //HLog(@"%@",_lastFileDataArr);
+    
+    if(_lastFileDataArr.count > 0){
+        _tableHeadView.frame = CGRectMake(0, 0, SCREEN_W, 165+ 15 +120 +54 + 15);
+        
+        [self.NASLastFileV mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.height.mas_equalTo(54);
+        }];
+        
+        self.NASLastFileV.notDataImageV.hidden = YES;
+        self.NASLastFileV.notDataLabel.hidden = YES;
+        
+//        /*上圆角*/
+//        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W- 32 , 54)
+//                                                       byRoundingCorners:UIRectCornerAllCorners
+//                                                             cornerRadii:CGSizeMake(12, 12)];
+//        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+//        //maskLayer.frame = self.NASLastFileV.bounds;
+//        maskLayer.frame = CGRectMake(0, 0, SCREEN_W -32, 54);
+//        maskLayer.path = maskPath.CGPath;
+//        self.NASLastFileV.layer.mask = maskLayer;
+    }
+    else{
+        _tableHeadView.frame = CGRectMake(0, 0, SCREEN_W, 165+ 15 +120 +254 + 15);
+        
+        [self.NASLastFileV mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(_NASCommonUsedV.mas_bottom).offset(15);
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.height.mas_equalTo(254);
+        }];
+        
+        self.NASLastFileV.notDataImageV.hidden = NO;
+        self.NASLastFileV.notDataLabel.hidden = NO;
+        
+        //全圆角
+        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-32 , 254)
+                                                       byRoundingCorners:UIRectCornerAllCorners
+                                                             cornerRadii:CGSizeMake(12, 12)];
+        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+        maskLayer.frame = self.NASLastFileV.bounds;
+        maskLayer.path = maskPath.CGPath;
+        self.NASLastFileV.whiteBgView.layer.mask = maskLayer;
+    }
+    
+    [self.tableView reloadData];
+}
 @end

+ 4 - 4
创维盒子/双子星云手机/NAS/recenFile/lastFileManager.m

@@ -59,7 +59,7 @@
 }
 
 #pragma mark- last file  plist
-- (NSMutableDictionary *)getLastFileList {
+- (NSMutableDictionary *)lastFileList {
     
     if (!_lastFileList) { // 内存没有
         _lastFileList = [[NSDictionary dictionaryWithContentsOfFile:[self getLastFilePlistPath]] mutableCopy]; // 本地加载
@@ -71,7 +71,7 @@
 }
 
 
-- (NSMutableArray*)getLastFileListArr{
+- (NSMutableArray*)lastFileListArr{
     if (!_lastFileListArr) { // 内存没有
         NSMutableArray *dataArr = [NSMutableArray new];
         if (self.lastFileList) {
@@ -126,7 +126,7 @@
     @synchronized (self) {
         NSString *key = fullPath;
         //1.本地持久化
-        NSMutableDictionary *dictM =  [self getLastFileList];
+        NSMutableDictionary *dictM =  self.lastFileList;
         //时间戳要刷新
         //lastFileMod.lastPreTime = [iTools getNowTimeStamp];
         
@@ -165,7 +165,7 @@
     BOOL flag = NO;
     @synchronized (self) {
         //1.本地持久化删除
-        NSMutableDictionary *dictM =  [self getLastFileList];
+        NSMutableDictionary *dictM =  self.lastFileList;
         [dictM removeObjectForKey:fullPath];
         flag = [dictM writeToFile:[self getLastFilePlistPath] atomically:YES];
         

+ 5 - 0
创维盒子/双子星云手机/NAS/view/NASLastFileView.h

@@ -10,6 +10,11 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface NASLastFileView : UIView
+@property(nonatomic,strong)UIView *whiteBgView;
+
+@property(nonatomic,strong)UIImageView* notDataImageV;
+@property(nonatomic,strong)UILabel *notDataLabel;
+
 @property (nonatomic,copy) void (^didClickButtonFun)(NSInteger tag);
 @end
 

+ 32 - 23
创维盒子/双子星云手机/NAS/view/NASLastFileView.m

@@ -25,13 +25,22 @@
 
 -(void)drawAnyView
 {
-    UIView *whiteBgView = [[UIView alloc] init];
-    whiteBgView.backgroundColor = [UIColor whiteColor];
-    [self addSubview:whiteBgView];
-    whiteBgView.layer.cornerRadius = 12;
-    whiteBgView.layer.masksToBounds = YES;
-    
-    [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+    _whiteBgView = [[UIView alloc] init];
+    _whiteBgView.backgroundColor = [UIColor whiteColor];
+    [self addSubview:_whiteBgView];
+//    whiteBgView.layer.cornerRadius = 12;
+//    whiteBgView.layer.masksToBounds = YES;
+    
+    /*上圆角*/
+    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W- 32 , 54)
+                                                   byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight
+                                                         cornerRadii:CGSizeMake(12, 12)];
+    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
+    maskLayer.frame = CGRectMake(0, 0, SCREEN_W -32, 54);
+    maskLayer.path = maskPath.CGPath;
+    _whiteBgView.layer.mask = maskLayer;
+    
+    [_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(0);
         make.left.mas_equalTo(16);
         make.right.mas_equalTo(-16);
@@ -42,7 +51,7 @@
     _titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
     _titleLabel.textColor = [UIColor hwColor:@"#0A132B"];
     _titleLabel.text = NSLocalizedString(@"NAS_last_file",nil);
-    [whiteBgView addSubview:_titleLabel];
+    [_whiteBgView addSubview:_titleLabel];
     
     [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(16);
@@ -57,7 +66,7 @@
     [rightButton setBackgroundImage:[UIImage imageNamed:@"common_right_back_arrow"] forState:UIControlStateNormal];
     rightButton.tag = 1;
     [rightButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
-    [whiteBgView addSubview:rightButton];
+    [_whiteBgView addSubview:rightButton];
     
     [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(16);
@@ -68,7 +77,7 @@
     
     UIView *lineView = [[UIView alloc] init];
     lineView.backgroundColor = [UIColor hwColor:@"#CFD1D4"];
-    [whiteBgView addSubview:lineView];
+    [_whiteBgView addSubview:lineView];
 
     [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(rightButton.mas_top).offset(5);
@@ -84,7 +93,7 @@
     [_eyeButton setBackgroundImage:[UIImage imageNamed:@"common_eye_close_black"] forState:UIControlStateSelected];
     _eyeButton.tag = 2;
     [_eyeButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
-    [whiteBgView addSubview:_eyeButton];
+    [_whiteBgView addSubview:_eyeButton];
     
     [_eyeButton mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(16);
@@ -95,26 +104,26 @@
     
     
     //空白页
-    UIImageView* notDataImageV = [[UIImageView alloc] init];
-    notDataImageV.image = [UIImage imageNamed:@"nas_not_data"];
-    [whiteBgView addSubview:notDataImageV];
+    _notDataImageV = [[UIImageView alloc] init];
+    _notDataImageV.image = [UIImage imageNamed:@"nas_not_data"];
+    [_whiteBgView addSubview:_notDataImageV];
     
-    [notDataImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+    [_notDataImageV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(_titleLabel.mas_bottom).offset(20);
         make.centerX.mas_equalTo(0);
         make.width.mas_equalTo(160);
         make.height.mas_equalTo(160);
     }];
     
-    UILabel *notDataLabel = [[UILabel alloc] init];
-    notDataLabel.font = [UIFont systemFontOfSize:14.0];
-    notDataLabel.textColor = [UIColor hwColor:@"#999999"];
-    notDataLabel.text = NSLocalizedString(@"NAS_last_file_not_data_tip",nil);
-    notDataLabel.textAlignment = NSTextAlignmentCenter;
-    [whiteBgView addSubview:notDataLabel];
+    _notDataLabel = [[UILabel alloc] init];
+    _notDataLabel.font = [UIFont systemFontOfSize:14.0];
+    _notDataLabel.textColor = [UIColor hwColor:@"#999999"];
+    _notDataLabel.text = NSLocalizedString(@"NAS_last_file_not_data_tip",nil);
+    _notDataLabel.textAlignment = NSTextAlignmentCenter;
+    [_whiteBgView addSubview:_notDataLabel];
     
-    [notDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(notDataImageV.mas_bottom).offset(-10);
+    [_notDataLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(_notDataImageV.mas_bottom).offset(-10);
         make.left.mas_equalTo(16);
         make.right.mas_equalTo(-16);
         make.height.mas_equalTo(20);

+ 28 - 0
创维盒子/双子星云手机/NAS/view/lastFileTableViewCell.h

@@ -0,0 +1,28 @@
+//
+//  lastFileTableViewCell.h
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/9.
+//
+
+#import <UIKit/UIKit.h>
+#import "lastFileManager.h"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface lastFileTableViewCell : UITableViewCell
+
+@property(nonatomic,strong)UIView *cellBgView;
+@property(nonatomic,strong)UILabel *timeLabel;
+@property(nonatomic,strong)UIImageView *mImageView;
+@property(nonatomic,strong)UILabel *titleLabel;
+@property(nonatomic,strong)UILabel *contentLabel;
+@property(nonatomic, strong) UIButton *checkButton;
+
+@property (nonatomic,copy) void (^didClickSwitch)(BOOL SwitchOn);
+
+@property(nonatomic,strong) lastFileModel*curLastFileModel;
+
+- (void)hideCheckButtonBy:(BOOL)isHide;
+@end
+
+NS_ASSUME_NONNULL_END

+ 267 - 0
创维盒子/双子星云手机/NAS/view/lastFileTableViewCell.m

@@ -0,0 +1,267 @@
+//
+//  lastFileTableViewCell.m
+//  双子星云手机
+//
+//  Created by xd h on 2024/7/9.
+//
+
+#import "lastFileTableViewCell.h"
+#import <SDWebImage/SDWebImage.h>
+
+@implementation lastFileTableViewCell
+
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    
+    if (self)
+    {
+        [self drawView];
+    }
+    
+    return self;
+}
+
+- (void)drawView
+{
+    _cellBgView = [[UIView alloc] init];
+    [self.contentView addSubview:_cellBgView];
+    _cellBgView.backgroundColor = [UIColor whiteColor];
+    [_cellBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(16.f);
+        make.top.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+        make.width.mas_equalTo(SCREEN_W - 2*16.f);
+    }];
+    
+    /**时间*/
+    _timeLabel = [[UILabel alloc] init];
+    [_cellBgView addSubview:_timeLabel];
+    _timeLabel.font = [UIFont systemFontOfSize:12.f];
+    //[titleLabel2 setTextAlignment:(NSTextAlignmentRight)];
+    [_timeLabel setTextColor:[UIColor hwColor:@"#828D9A"]];
+    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(0.f);
+        make.left.mas_equalTo(15);
+        //make.centerY.equalTo(cellBgView.mas_centerY);
+        make.top.mas_equalTo(0);
+        make.height.mas_equalTo(20);
+    }];
+    
+    /*图片*/
+    _mImageView = [[UIImageView alloc] init];
+    [_mImageView setBackgroundColor:[UIColor clearColor]];
+    _mImageView.image = [UIImage imageNamed:@"uploadFile_image"];
+    [_cellBgView  addSubview:_mImageView];
+    [_mImageView setContentMode:(UIViewContentModeScaleAspectFit)];
+    [_mImageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.width.mas_equalTo(42);
+        make.height.mas_equalTo(42);
+        make.centerY.equalTo(self.mas_centerY);
+    }];
+    
+    
+    _checkButton = [[UIButton alloc] init];
+    [_checkButton setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
+    [_checkButton setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
+    [_cellBgView addSubview:_checkButton];
+    
+    [_checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-15.f);
+        make.centerY.equalTo(self.mas_centerY);
+        make.width.mas_equalTo(36.f);
+        make.height.mas_equalTo(36.f);
+    }];
+    
+    [_checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventTouchUpInside)];
+    
+    
+    /**标题*/
+    _titleLabel = [[UILabel alloc] init];
+    [_cellBgView addSubview:_titleLabel];
+    _titleLabel.font = [UIFont boldSystemFontOfSize:14.f];
+    _titleLabel.numberOfLines = 2;
+    _titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
+    [_titleLabel setTextColor:HW0A132BColor];
+    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.equalTo(_mImageView.mas_right).offset(5.f);
+        make.right.equalTo(_checkButton.mas_left).offset(-5.f);
+        //make.centerY.equalTo(cellBgView.mas_centerY);
+        make.top.equalTo(_mImageView.mas_top);
+    }];
+    
+    /**副标题*/
+    _contentLabel = [[UILabel alloc] init];
+    [_cellBgView addSubview:_contentLabel];
+    _contentLabel.font = [UIFont systemFontOfSize:12.f];
+    _contentLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
+    //[titleLabel2 setTextAlignment:(NSTextAlignmentRight)];
+    [_contentLabel setTextColor:HW666666Color];
+    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(_titleLabel.mas_right);
+        make.left.mas_equalTo(_titleLabel.mas_left);
+        //make.centerY.equalTo(cellBgView.mas_centerY);
+        make.top.equalTo(_titleLabel.mas_bottom).offset(5.0);
+    }];
+    
+}
+
+
+- (void)maskSwitchPressed:(UIButton *)maskSwitch{
+
+    maskSwitch.selected = !maskSwitch.selected;
+    if(_didClickSwitch){
+        _didClickSwitch(maskSwitch.selected);
+    }
+}
+
+- (void)setCurLastFileModel:(lastFileModel *)curLastFileModel
+{
+    _curLastFileModel = curLastFileModel;
+    
+    _checkButton.selected = _curLastFileModel.isSelectType;
+    
+    NSString *filePath = _curLastFileModel.path;
+    NSString *urlStr = ksharedAppDelegate.NASFileByBoxService;
+    NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getThumbnail?path=%@",urlStr,filePath];
+    
+    UIImage *placeholderImage = nil;
+    if([_curLastFileModel.type isEqualToString:@"video"])
+    {
+        placeholderImage = [UIImage imageNamed:@"uploadFile_Video"];
+    }
+    else if([_curLastFileModel.type isEqualToString:@"jpg"])
+    {
+        placeholderImage = [UIImage imageNamed:@"uploadFile_image"];
+        
+        //iOS格式的图片 代理拿不到缩略图
+        if([filePath rangeOfString:@".HEIC"].location != NSNotFound
+           ||[filePath rangeOfString:@".heic"].location != NSNotFound){
+            fileUrl = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",urlStr,filePath];
+        }
+    }
+    else if([_curLastFileModel.type isEqualToString:@"audio"])
+    {
+        _mImageView.image = [UIImage imageNamed:@"uploadFile_audio"];
+    }
+    else if([_curLastFileModel.type isEqualToString:@"dir"])
+    {
+        _checkButton.hidden = YES;
+        _mImageView.image = [UIImage imageNamed:@"uploadFile_dir"];
+    }
+    //else if([curNASFileAndFolderDataModel.type isEqualToString:@"doc"])
+//    {
+//       //uploadFile_TXT  uploadFile_pdf uploadFile_xlsx uploadFile_doc
+//        NSArray *nameArr= [curNASFileAndFolderDataModel.name componentsSeparatedByString:@"."];
+//        if (nameArr.count >= 2) {
+//            NSString *lastName = nameArr.lastObject;
+//            
+//            lastName = [lastName lowercaseString];
+//            
+//            if ([lastName rangeOfString:@"txt"].location != NSNotFound) {
+//                mImageView.image = [UIImage imageNamed:@"uploadFile_TXT"];
+//            }
+//            else if ([lastName rangeOfString:@"pdf"].location != NSNotFound) {
+//                     mImageView.image = [UIImage imageNamed:@"uploadFile_pdf"];
+//            }
+//            else if ([lastName rangeOfString:@"xlsx"].location != NSNotFound) {
+//                     mImageView.image = [UIImage imageNamed:@"uploadFile_xlsx"];
+//            }
+//            else if ([lastName rangeOfString:@"doc"].location != NSNotFound) {
+//                     mImageView.image = [UIImage imageNamed:@"uploadFile_doc"];
+//            }
+//            else{
+//                mImageView.image = [UIImage imageNamed:@"uploadFile_other"];
+//            }
+//        }
+//        
+//    }
+    else{
+        _mImageView.image = [UIImage imageNamed:@"uploadFile_other"];
+    }
+
+    if([_curLastFileModel.type isEqualToString:@"video"]
+       ||([_curLastFileModel.type isEqualToString:@"jpg"])){
+        fileUrl = [fileUrl  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+        
+        [_mImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:placeholderImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
+//            if(image){
+//                //HLog(@"11图片1:%@",imageURL.absoluteString);
+//            }
+//            else{
+//                //HLog(@"11图片0:%@",imageURL.absoluteString);
+//
+//            }
+            
+        }];
+    }
+    
+    
+    //时间戳转换为日期
+//    NSString *timeStr = [[NSString alloc] initWithFormat:@"%ld",curNASFileAndFolderDataModel.time];
+//    NSString *dateStr = [iTools getDateStringWithTimeStr:timeStr];
+    
+    _titleLabel.text = _curLastFileModel.name;
+    NSString *dateStr = _curLastFileModel.time;
+    _timeLabel.text = dateStr;
+    
+    NSString * totalSizeStr = nil;
+    NSInteger totalSize_k = _curLastFileModel.size / 1024;
+    if(totalSize_k == 0){
+        totalSize_k = 1;
+    }
+    
+    if(totalSize_k < 1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%ldKB",totalSize_k];
+    }
+    else if( totalSize_k >= 1024 && totalSize_k < 1024*1024){
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.1fMB",totalSize_k/1024.0];
+        
+    }
+    else{
+        totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0];
+    }
+    
+    NSString *path = _curLastFileModel.path;
+    if([path containsString:@"mnt/media_rw"]){
+        path = [path stringByReplacingOccurrencesOfString:@"mnt/media_rw" withString:NSLocalizedString(@"disk_Extra_default_tip",nil)];
+    }
+    else if([path containsString:@"storage/emulated/0"]){
+        path = [path stringByReplacingOccurrencesOfString:@"storage/emulated/0" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
+    }
+    else if([path containsString:@"sdcard"]){
+        path = [path stringByReplacingOccurrencesOfString:@"sdcard" withString:NSLocalizedString(@"disk_phone_default_tip",nil)];
+    }
+    
+    NSString *totalStr = [[NSString alloc] initWithFormat:@"%@  %@",totalSizeStr,path];
+    _contentLabel.text = totalStr;
+}
+
+- (void)hideCheckButtonBy:(BOOL)isHide{
+    _checkButton.hidden = isHide;
+    if(isHide){
+        [_titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.left.equalTo(_mImageView.mas_right).offset(5.f);
+            make.right.mas_equalTo(-5.f);
+            //make.centerY.equalTo(cellBgView.mas_centerY);
+            make.top.equalTo(_mImageView.mas_top);
+        }];
+        
+        /**副标题*/
+        [_contentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+            make.right.mas_equalTo(_titleLabel.mas_right);
+            make.left.mas_equalTo(_titleLabel.mas_left);
+            //make.centerY.equalTo(cellBgView.mas_centerY);
+            make.top.equalTo(_titleLabel.mas_bottom).offset(5.0);
+        }];
+    }
+}
+
+@end