|
|
@@ -24,6 +24,7 @@
|
|
|
#import "queryShareModel.h"
|
|
|
#import "videoPlayViewController.h"
|
|
|
#import "videoPlayByAVPlayerViewController.h"
|
|
|
+#import "MJRefresh.h"
|
|
|
|
|
|
@interface previewImageOrVideoViewController ()<UICollectionViewDelegate,UICollectionViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
{
|
|
|
@@ -292,6 +293,17 @@
|
|
|
//空数据引入第三方开源处理
|
|
|
_dataCollectionView.emptyDataSetSource = self;
|
|
|
_dataCollectionView.emptyDataSetDelegate = self;
|
|
|
+
|
|
|
+ // 下拉追加
|
|
|
+ MJRefreshAutoNormalFooter *footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
|
|
|
+ [self getMoreNetWorkData];
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ NSString *text = NSLocalizedString(@"NAS_bottom_tip",nil);
|
|
|
+ [footer setTitle:text forState:MJRefreshStateNoMoreData];
|
|
|
+ _dataCollectionView.mj_footer = footer;
|
|
|
+ //_dataCollectionView.mj_footer.hidden = YES;
|
|
|
}
|
|
|
|
|
|
return _dataCollectionView;
|
|
|
@@ -359,7 +371,7 @@
|
|
|
}
|
|
|
|
|
|
self.defaultDiskPath = pathStr;
|
|
|
- [self getFileListFun];
|
|
|
+ [self getFileListFun:NO];
|
|
|
[self setTitleAfterGetdiskFun];
|
|
|
[self hideDiskListVieFun];
|
|
|
}
|
|
|
@@ -841,7 +853,7 @@
|
|
|
[self checkFileTransferTask];
|
|
|
|
|
|
if(!_curNASFilePicModel){
|
|
|
- [self getFileListFun];
|
|
|
+ [self getFileListFun:NO];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -932,7 +944,7 @@
|
|
|
}
|
|
|
|
|
|
#pragma mark 获取文件数据
|
|
|
-- (void)getFileListFun
|
|
|
+- (void)getFileListFun:(BOOL)isMoreDataType
|
|
|
{
|
|
|
NSMutableDictionary*paraDict = [NSMutableDictionary new];
|
|
|
if(_isPhotoType){
|
|
|
@@ -942,6 +954,16 @@
|
|
|
[paraDict setValue:@"video" forKey:@"type"];
|
|
|
}
|
|
|
|
|
|
+ if(!isMoreDataType){
|
|
|
+ self.pageIndex = 0;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ self.pageIndex ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
|
|
|
+ [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
|
|
|
+
|
|
|
NSArray *diskNameArr = [_defaultDiskPath componentsSeparatedByString:@"/"];
|
|
|
if(diskNameArr && diskNameArr.count >= 2){
|
|
|
|
|
|
@@ -959,13 +981,15 @@
|
|
|
|
|
|
KWeakSelf
|
|
|
[[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"getFileListByDay" Parameters:paraDict success:^(id _Nonnull responseObject) {
|
|
|
+
|
|
|
+ [weakSelf.dataCollectionView.mj_footer endRefreshing];
|
|
|
[weakSelf removeNewIndicatorHaveStr];
|
|
|
- weakSelf.curNASFilePicModel = [[NASFilePicModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
- [weakSelf filterDataFun];
|
|
|
+ NASFilePicModel*NASFilePicMod = [[NASFilePicModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
+ [weakSelf filterDataFun:NASFilePicMod];
|
|
|
[weakSelf.dataCollectionView reloadData];
|
|
|
} failure:^(NSError * _Nonnull error) {
|
|
|
[weakSelf removeNewIndicatorHaveStr];
|
|
|
-
|
|
|
+ [weakSelf.dataCollectionView.mj_footer endRefreshing];
|
|
|
if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
|
|
|
{
|
|
|
[[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
|
|
|
@@ -977,12 +1001,19 @@
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+#pragma mark 上拉或者点击更多数据
|
|
|
+- (void)getMoreNetWorkData
|
|
|
+{
|
|
|
+ [self getFileListFun:YES];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#pragma mark 20230528需求:图片/视频模块,限制50KB以下文件展示;
|
|
|
-- (void)filterDataFun
|
|
|
+- (void)filterDataFun:(NASFilePicModel*)NASFilePicMod
|
|
|
{
|
|
|
- if(!_curNASFilePicModel) return;
|
|
|
+ if(!NASFilePicMod) return;
|
|
|
|
|
|
- for (NASFilePicTimeArrModel *timeArrModel in _curNASFilePicModel.data.fileList) {
|
|
|
+ for (NASFilePicTimeArrModel *timeArrModel in NASFilePicMod.data.fileList) {
|
|
|
NSMutableArray *afterFilterArr = [NSMutableArray new];
|
|
|
for (NASFilePicDataArrModel * dataModel in timeArrModel.list) {
|
|
|
if (dataModel.size > 20*1024) {
|
|
|
@@ -992,8 +1023,68 @@
|
|
|
timeArrModel.list = (NSArray<NASFilePicDataArrModel>*)afterFilterArr;
|
|
|
}
|
|
|
|
|
|
+ [self handelNetDataAfterFilterDataBy:NASFilePicMod];
|
|
|
}
|
|
|
|
|
|
+#pragma mark 分页数据组装
|
|
|
+- (void)handelNetDataAfterFilterDataBy:(NASFilePicModel*)NASFilePicMod
|
|
|
+{
|
|
|
+ NSMutableArray *handelDataArr = [NSMutableArray new];
|
|
|
+ if(_curNASFilePicModel && _curNASFilePicModel.data && _curNASFilePicModel.data.fileList){
|
|
|
+ [handelDataArr addObjectsFromArray:_curNASFilePicModel.data.fileList];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _curNASFilePicModel = [NASFilePicModel new];
|
|
|
+ _curNASFilePicModel.data = [NASFilePicSecondModel new];
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据处理
|
|
|
+ for (NASFilePicTimeArrModel *timeArrModel in NASFilePicMod.data.fileList) {
|
|
|
+
|
|
|
+ NSString *dataTimeStr = timeArrModel.time;
|
|
|
+
|
|
|
+ if(timeArrModel.list > 0){//只处理有数据的 (数据可能被过滤掉)
|
|
|
+
|
|
|
+ //全选的时候新加的也选上
|
|
|
+
|
|
|
+ BOOL didAddTimeType = NO;//此日期是否存在在数据里面了
|
|
|
+ for (NASFilePicTimeArrModel *preTimeArrModel in handelDataArr) {
|
|
|
+ NSString *preDataTimeStr = preTimeArrModel.time;
|
|
|
+ if([dataTimeStr isEqualToString:preDataTimeStr]){
|
|
|
+ didAddTimeType = YES;
|
|
|
+
|
|
|
+ NSMutableArray *afterHandelArr = [NSMutableArray new];
|
|
|
+ //1.原来数据
|
|
|
+ [afterHandelArr addObjectsFromArray:preTimeArrModel.list];
|
|
|
+ //2.追加新的数据
|
|
|
+ [afterHandelArr addObjectsFromArray:timeArrModel.list];
|
|
|
+
|
|
|
+ preTimeArrModel.list = (NSArray<NASFilePicDataArrModel>*)afterHandelArr;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加新日期数据
|
|
|
+ if(!didAddTimeType){
|
|
|
+ [handelDataArr addObject:timeArrModel];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ _curNASFilePicModel.data.fileList = (NSArray<NASFilePicTimeArrModel> *)handelDataArr;
|
|
|
+
|
|
|
+ if(handelDataArr.count == 0 ){
|
|
|
+ _dataCollectionView.mj_footer.hidden = YES;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _dataCollectionView.mj_footer.hidden = NO;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#pragma mark 点击图片详情
|
|
|
- (void)didClickPicDetailsWithSection:(NSInteger)section withRow:(NSInteger)row{
|
|
|
|
|
|
@@ -1040,22 +1131,11 @@
|
|
|
|
|
|
KWeakSelf
|
|
|
vc.didNeedToRegetDataFun = ^{
|
|
|
- [weakSelf getFileListFun];
|
|
|
+ // [weakSelf getFileListFun];
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// imageDetailsScrollViewController *vc = [imageDetailsScrollViewController new];
|
|
|
-// vc.index = index;
|
|
|
-// vc.totalDataArr = totalArr;
|
|
|
-// [self.navigationController pushViewController:vc animated:YES];
|
|
|
-// vc.canShareType = canShareType;
|
|
|
-//
|
|
|
-// KWeakSelf
|
|
|
-// vc.didNeedToRegetDataFun = ^{
|
|
|
-// [weakSelf getFileListFun];
|
|
|
-// };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1216,7 +1296,7 @@
|
|
|
- (void)delayedGetFileListFun{
|
|
|
KWeakSelf
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- [self getFileListFun];
|
|
|
+ //[self getFileListFun];
|
|
|
});
|
|
|
|
|
|
}
|