Explorar o código

1.音频的显示和操作(除下载和预览)

huangxiaodong hai 1 ano
pai
achega
6ec70283ba

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

@@ -4202,7 +4202,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Manual;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = "";
 				"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 6SV76WTUUR;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -4283,7 +4283,7 @@
 				CODE_SIGN_IDENTITY = "Apple Development";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Manual;
-				CURRENT_PROJECT_VERSION = 2;
+				CURRENT_PROJECT_VERSION = 3;
 				DEVELOPMENT_TEAM = "";
 				"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 6SV76WTUUR;
 				FRAMEWORK_SEARCH_PATHS = (

+ 118 - 43
创维盒子/双子星云手机/Class/Set/previewFile/previewAudioOrDocumentViewController.m

@@ -108,13 +108,13 @@
 #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];
         }
     };
     
@@ -349,9 +349,9 @@
         
         KWeakSelf
         cell.didClickSwitch = ^(BOOL SwitchOn) {
-//            if([weakSelf userCheckFileModel:fileModel withShowTip:YES]){
-//                [weakSelf userCheckFilePreviewByRow:row];
-//            }
+            //if([weakSelf userCheckFileModel:dataModel withShowTip:YES]){
+                [weakSelf userCheckFilePreviewByRow:row];
+            //}
         };
     }
     return cell;
@@ -478,53 +478,36 @@
 
 - (void)userCheckFilePreviewByRow:(NSInteger)row
 {
-//    if(row < _curCouldPhoneFileListMod.data.list.count){
-//        couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
-//        
-//        if(fileModel.isSelectType){
-//            [_didSelectListArr removeObject:fileModel];
-//        }
-//        else{
-//            [_didSelectListArr addObject:fileModel];
-//        }
-//        
-//         fileModel.isSelectType = !fileModel.isSelectType;
-//        //[self.tableView reloadData];
-//        //[self.dataCollectionView reloadData];
-//        [self setEditTypeTitleFun];
-//    }
+    if(row < _curNASFileAudioMod.data.list.count){
+        NASFileAudioDataModel* dataModel = _curNASFileAudioMod.data.list[row];
+        
+        if(dataModel.isSelectType){
+            [_didSelectListArr removeObject:dataModel];
+        }
+        else{
+            [_didSelectListArr addObject:dataModel];
+        }
+        
+        dataModel.isSelectType = !dataModel.isSelectType;
+    
+        [self setEditTypeTitleFun];
+    }
 }
 
 - (void)didClickSelectAllButton:(UIButton*)button
 {
     //button.selected = !button.selected;
-    BOOL isNeedShowTip = NO;
     
     [_didSelectListArr removeAllObjects];
     
-//    for (couldPhoneFileModel* fileModel in _curCouldPhoneFileListMod.data.list) {
-//        
-//        if(!button.selected){
-//            fileModel.isSelectType = button.selected;
-//        }
-//        else{
-//            [_didSelectListArr addObject:fileModel];
-//            if([self userCheckFileModel:fileModel withShowTip:NO]){
-//                fileModel.isSelectType = button.selected;
-//            }
-//            else{
-//                isNeedShowTip = YES;
-//            }
-//        }
-//        
-//    }
-    
-    if(isNeedShowTip){
-        if(_isAudioType){
-            [[iToast makeText:NSLocalizedString(@"download_image_disable_state",nil)] show];
+    for (NASFileAudioDataModel* dataModel in _curNASFileAudioMod.data.list) {
+        
+        if(!button.selected){
+            dataModel.isSelectType = button.selected;
         }
         else{
-            [[iToast makeText:NSLocalizedString(@"download_video_disable_state",nil)] show];
+            [_didSelectListArr addObject:dataModel];
+            dataModel.isSelectType = button.selected;
         }
     }
     
@@ -826,7 +809,6 @@
 #pragma mark 调整文件上传
 - (void)gotoUploadFileFunWith:(NSInteger)tag
 {
-    
     uploadImageOrVideoViewController *vc = [uploadImageOrVideoViewController new];
     if(tag ==10){
         vc.isPhotoType = YES;
@@ -837,4 +819,97 @@
     [self.navigationController pushViewController:vc animated:YES];
 }
 
+#pragma mark 文件下载
+- (void)gotoDownLoadFileFun
+{
+    if(_didSelectListArr.count == 0){
+        [[iToast makeText:@""] show];
+        return;
+    }
+    
+    NSMutableArray *arr = [NSMutableArray new];
+    for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
+        
+        couldPhoneFileModel* fileModel =  [couldPhoneFileModel new];
+        fileModel.fileType = @"audio";
+        fileModel.path = dataModel.path;
+        fileModel.name = dataModel.name;
+        fileModel.length = dataModel.size;
+        fileModel.time = dataModel.duration;
+        
+        [arr addObject:fileModel];
+    }
+    
+    uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
+    [self.navigationController pushViewController:vc animated:YES];
+    vc.isDownloadingType = YES;
+    [vc gotoDownloadFile:arr];
+}
+
+#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];
+    
+    NSMutableArray *pathArr = [NSMutableArray new];
+    for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
+        [pathArr addObject: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];
+            [weakSelf didDeleteSucFun];
+        }
+        else{
+            
+        }
+    } failure:^(NSError * _Nonnull error) {
+        [weakSelf removeNewIndicator];
+    }];
+}
+
+#pragma  mark 删除成功
+- (void)didDeleteSucFun
+{
+    [_didSelectListArr removeAllObjects];
+    [self setEditTypeTitleFun];
+    
+    [self getFileListFun];
+}
 @end

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

@@ -936,10 +936,16 @@
     for (NASFilePicDataArrModel *dataModel in _didSelectListArr) {
         
         couldPhoneFileModel* fileModel =  [couldPhoneFileModel new];
-        fileModel.fileType = @".jpg";
+        if(_isPhotoType){
+            fileModel.fileType = @".jpg";
+        }
+        else{
+            fileModel.fileType = @"video";
+        }
         fileModel.path = dataModel.path;
         fileModel.name = dataModel.name;
         fileModel.length = dataModel.size;
+        fileModel.time = dataModel.duration;
         
         [arr addObject:fileModel];
     }