You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
4.3 KiB
135 lines
4.3 KiB
![]()
2 years ago
|
//
|
||
|
// AddVideoMomberVC.m
|
||
|
// watch
|
||
|
//
|
||
|
// Created by Apple on 2019/1/25.
|
||
|
// Copyright © 2019年 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "AddVideoMomberVC.h"
|
||
|
#import "AddVideoMomberCell.h"
|
||
|
|
||
|
@interface AddVideoMomberVC ()
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation AddVideoMomberVC
|
||
|
|
||
|
- (void)viewDidLoad {
|
||
|
[super viewDidLoad];
|
||
|
if(self.isUnCheck){
|
||
|
self.title = @"删除成员";
|
||
|
}else{
|
||
|
self.title = @"添加联系人";
|
||
|
}
|
||
|
|
||
|
// self.view.backgroundColor = self.myTableView.backgroundColor;
|
||
|
|
||
|
[self.myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.right.equalTo(self.view);
|
||
|
make.top.equalTo(self.view).offset(iPhoneX_NavHeight);
|
||
|
make.bottom.equalTo(self.view.mas_bottom);
|
||
|
}];
|
||
|
|
||
|
[self.myTableView registerNib:[UINib nibWithNibName:@"AddVideoMomberCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"AddVideoMomberCell"];
|
||
|
//去线
|
||
|
// self.myTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||
|
// self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(saveAction:)];
|
||
|
|
||
|
[self zx_setRightBtnWithText:@"确定" clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
|
||
|
[self saveAction:nil];
|
||
|
}];
|
||
|
|
||
|
NSMutableArray *arr = self.myDataSource[0];
|
||
|
NSMutableArray *temp = [NSMutableArray array];
|
||
|
for (VideoUserModel *model in arr) {
|
||
|
// VideoUserModel *model = [VideoUserModel new];
|
||
|
// [model mj_setKeyValues:dic];
|
||
|
// model.imageid = [dic[@"image"] intValue];
|
||
|
[temp addObject:model];
|
||
|
}
|
||
|
self.myDataSource[0] = temp;
|
||
|
|
||
|
if(temp.count == 0){
|
||
|
[self showNoDataSourceView];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- (void)saveAction:(UIBarButtonItem *)sender{
|
||
|
NSMutableArray *temp = [NSMutableArray array];
|
||
|
for (VideoUserModel *model in self.myDataSource[0] ) {
|
||
|
if(model.ifSelect){ //选中的人加
|
||
|
[temp addObject:model.openid];
|
||
|
}
|
||
|
}
|
||
|
if(temp.count == 0){
|
||
|
NSString *str = @"删除";
|
||
|
if(!self.isUnCheck){
|
||
|
str = @"增加";
|
||
|
}
|
||
|
[SVProgressHUD showSuccessWithStatus:[NSString stringWithFormat:@"请选择要%@视频通话成员",str]];
|
||
|
[SVProgressHUD dismissWithDelay:1 completion:nil];
|
||
|
return;
|
||
|
}
|
||
|
WEAKSELF
|
||
|
|
||
|
if(self.isUnCheck){
|
||
|
[cUser.cDevice delectVideoUserListWithList:[temp copy] Success:^(id responseObject) {
|
||
|
[SVProgressHUD showSuccessWithStatus:@"删除视频通话成员成功"];
|
||
|
[SVProgressHUD dismissWithDelay:1 completion:^{
|
||
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||
|
}];
|
||
|
} failure:^{
|
||
|
|
||
|
}];
|
||
|
}else{
|
||
|
|
||
|
[cUser.cDevice addVideoUserListWithList:[temp copy] Success:^(id responseObject) {
|
||
|
[SVProgressHUD showSuccessWithStatus:@"增加视频通话成员成功"];
|
||
|
[SVProgressHUD dismissWithDelay:1 completion:^{
|
||
|
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||
|
}];
|
||
|
} failure:^{
|
||
|
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
|
||
|
VideoUserModel *model = self.myDataSource[indexPath.section][indexPath.row];
|
||
|
AddVideoMomberCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AddVideoMomberCell" forIndexPath:indexPath];
|
||
|
|
||
|
[cell setModel:model];
|
||
|
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
return 65;
|
||
|
}
|
||
|
|
||
|
//MARK: 设置cell 的 交互 样式
|
||
|
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView
|
||
|
editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
/**
|
||
|
UITableViewCellEditingStyleNone,
|
||
|
UITableViewCellEditingStyleDelete,
|
||
|
UITableViewCellEditingStyleInsert
|
||
|
*/
|
||
|
//设置右滑 删除的 样式
|
||
|
// return UITableViewCellEditingStyleDelete;
|
||
|
return UITableViewCellEditingStyleNone;
|
||
|
}
|
||
|
|
||
|
|
||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||
|
VideoUserModel *model = self.myDataSource[indexPath.section][indexPath.row];
|
||
|
model.ifSelect = !model.ifSelect;
|
||
|
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
|
||
|
}
|
||
|
|
||
|
@end
|