|
|
@@ -25,6 +25,7 @@
|
|
|
@property (nonatomic, strong) UIButton *rightSelectAllButton;
|
|
|
|
|
|
@property (nonatomic, strong) ShareRecordModel * ShareRecordMod;
|
|
|
+@property (nonatomic, strong) NSMutableArray *didSelectArr;
|
|
|
@end
|
|
|
|
|
|
@implementation shareRecordViewController
|
|
|
@@ -41,6 +42,7 @@
|
|
|
[self.view setBackgroundColor:[UIColor whiteColor]];
|
|
|
self.titleLabel.text = NSLocalizedString(@"my_set_no_share",nil);
|
|
|
|
|
|
+ _didSelectArr = [NSMutableArray new];
|
|
|
[self drawAnyView];
|
|
|
[self getShareFileListFun];
|
|
|
}
|
|
|
@@ -244,11 +246,9 @@
|
|
|
cell.dataModel = model;
|
|
|
|
|
|
KWeakSelf
|
|
|
-// cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
-// if([weakSelf userCheckFileModel:fileModel withShowTip:YES]){
|
|
|
-// [weakSelf userCheckFilePreviewByRow:row];
|
|
|
-// }
|
|
|
-// };
|
|
|
+ cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
+ [weakSelf handleSelectOrNotDataBy:row withSelect:SwitchOn];
|
|
|
+ };
|
|
|
}
|
|
|
return cell;
|
|
|
}
|
|
|
@@ -315,8 +315,14 @@
|
|
|
}
|
|
|
else if(tag == 4){
|
|
|
but.selected = !but.selected;
|
|
|
+ [self selectAllOrNotBy:but.selected];
|
|
|
+ }
|
|
|
+ else if(tag == 10){//删除分享
|
|
|
+ [self deleteShareLinkArrFun];
|
|
|
+ }
|
|
|
+ else if(tag == 11){//取消分享
|
|
|
+ [self cancelShareLinkArrFun];
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
#pragma mark 进入编辑
|
|
|
@@ -332,8 +338,6 @@
|
|
|
|
|
|
_delRuleButton.hidden = NO;
|
|
|
_delRuleButton.userInteractionEnabled = NO;
|
|
|
-// [_delRuleButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:0.5] forState:UIControlStateNormal];
|
|
|
-// _delRuleButton.backgroundColor = [UIColor hwColor:@"#E3E8F1" alpha:0.5];
|
|
|
_delRuleButton.alpha = 0.5;
|
|
|
|
|
|
_cancelShareButton.hidden = NO;
|
|
|
@@ -358,7 +362,58 @@
|
|
|
[self.tableView reloadData];
|
|
|
}
|
|
|
|
|
|
+#pragma mark 设置按钮状态
|
|
|
+- (void)setBottomStateFun
|
|
|
+{
|
|
|
+ CGFloat alpha = 0.5;
|
|
|
+ BOOL canClickBut = NO;
|
|
|
+ if(_didSelectArr.count >0){
|
|
|
+ alpha =1.0;
|
|
|
+ canClickBut = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ _delRuleButton.userInteractionEnabled = canClickBut;
|
|
|
+ _delRuleButton.alpha = alpha;
|
|
|
+
|
|
|
+ _cancelShareButton.userInteractionEnabled = canClickBut;
|
|
|
+ _cancelShareButton.alpha = alpha;
|
|
|
+}
|
|
|
|
|
|
+#pragma mark 单个选中或者取消
|
|
|
+- (void)handleSelectOrNotDataBy:(NSInteger)row withSelect:(BOOL)select
|
|
|
+{
|
|
|
+ if(row < _ShareRecordMod.data.count){
|
|
|
+ ShareRecordListModel* model = _ShareRecordMod.data[row];
|
|
|
+ model.isSelectType = !model.isSelectType;
|
|
|
+ if(select){
|
|
|
+ [_didSelectArr addObject:model];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [_didSelectArr removeObject:model];
|
|
|
+ }
|
|
|
+
|
|
|
+ [self setBottomStateFun];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 全部选中或者取消全选
|
|
|
+- (void)selectAllOrNotBy:(BOOL)isSelectAll
|
|
|
+{
|
|
|
+ [_didSelectArr removeAllObjects];
|
|
|
+
|
|
|
+ for (ShareRecordListModel* model in _ShareRecordMod.data) {
|
|
|
+ if(isSelectAll){
|
|
|
+ model.isSelectType = YES;
|
|
|
+ [_didSelectArr addObject:model];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ model.isSelectType = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [self setBottomStateFun];
|
|
|
+ [self.tableView reloadData];
|
|
|
+}
|
|
|
|
|
|
#pragma mark 分享记录列表
|
|
|
- (void)getShareFileListFun
|
|
|
@@ -389,4 +444,84 @@
|
|
|
[weakSelf removeNewIndicator];
|
|
|
}];
|
|
|
}
|
|
|
+
|
|
|
+#pragma mark 取消分享
|
|
|
+- (void)cancelShareLinkArrFun
|
|
|
+{
|
|
|
+ NSMutableDictionary *paraDict = [NSMutableDictionary new];
|
|
|
+ if(_didSelectArr){
|
|
|
+ NSMutableArray *LinkIdArr = [NSMutableArray new];
|
|
|
+ for (ShareRecordListModel* model in _didSelectArr) {
|
|
|
+ if(!model.expirationStatus){
|
|
|
+ [LinkIdArr addObject:model.addShareId];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(LinkIdArr.count == 0){
|
|
|
+ [[iToast makeText:NSLocalizedString(@"cancel_share_suc_msg",nil)] show];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ [paraDict setValue:LinkIdArr forKey:@"idList"];
|
|
|
+ }
|
|
|
+ [paraDict setValue:@1 forKey:@"expirationStatus"];
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ [self showNewIndicatorWithCanBack:NO canTouch:NO];
|
|
|
+ [[netWorkManager shareInstance] CommonPostCallBackCode:updateShareInfoFun Parameters:paraDict success:^(id _Nonnull responseObject) {
|
|
|
+ [weakSelf removeNewIndicator];
|
|
|
+ SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
+ if(model && model.code == 0){
|
|
|
+ [[iToast makeText:NSLocalizedString(@"cancel_share_suc_msg",nil)] show];
|
|
|
+ [weakSelf getShareFileListFun];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+ [weakSelf removeNewIndicator];
|
|
|
+ [[iToast makeText:NSLocalizedString(@"cancel_share_fail_msg",nil)] show];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 删除分享
|
|
|
+- (void)deleteShareLinkArrFun
|
|
|
+{
|
|
|
+ NSMutableDictionary *paraDict = [NSMutableDictionary new];
|
|
|
+ if(_didSelectArr){
|
|
|
+ NSMutableArray *LinkIdArr = [NSMutableArray new];
|
|
|
+ for (ShareRecordListModel* model in _didSelectArr) {
|
|
|
+ [LinkIdArr addObject:model.addShareId];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(LinkIdArr.count == 0){
|
|
|
+ [[iToast makeText:NSLocalizedString(@"delete_share_fail_msg",nil)] show];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ [paraDict setValue:LinkIdArr forKey:@"idList"];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ [self showNewIndicatorWithCanBack:NO canTouch:NO];
|
|
|
+ [[netWorkManager shareInstance] CommonPostCallBackCode:deleteShareListFun Parameters:paraDict success:^(id _Nonnull responseObject) {
|
|
|
+ [weakSelf removeNewIndicator];
|
|
|
+ SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
|
|
|
+ if(model && model.code == 0){
|
|
|
+ [[iToast makeText:NSLocalizedString(@"delete_share_suc_msg",nil)] show];
|
|
|
+ [weakSelf getShareFileListFun];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [[iToast makeText:NSLocalizedString(@"delete_share_fail_msg",nil)] show];
|
|
|
+ }
|
|
|
+
|
|
|
+ } failure:^(NSError * _Nonnull error) {
|
|
|
+ [weakSelf removeNewIndicator];
|
|
|
+ [[iToast makeText:NSLocalizedString(@"delete_share_fail_msg",nil)] show];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
@end
|