123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598 |
- //
- // TDGroupInfoDetailVC.m
- // smartRhino
- //
- // Created by niuzhen on 2019/12/13.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "TDGroupInfoDetailVC.h"
- #import "TDGroupInfoDetailCell.h"
- #import "createSearchBarView.h"
- #import "TDGroupInfoListModel.h"
- #import "TDGroupQrcodeVC.h"
- #import "TDGroupInfoChangeVc.h"
- #import "ChatGroupAddVC.h"
- #import "MailListDetailVC.h"
- @interface TDGroupInfoDetailVC ()<UITableViewDelegate,UITableViewDataSource>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (weak, nonatomic) IBOutlet UILabel *titleL;
- @property (strong, nonatomic)NSMutableArray * dataArray;
- @property (strong, nonatomic)TDGroupInfoListModel * listModel;
- @end
- @implementation TDGroupInfoDetailVC
- +(TDGroupInfoDetailVC *)initTDGroupInfoDetailVC{
- TDGroupInfoDetailVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupInfoDetailVC"];
- return controller;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- [self getData];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showMessage) name:GROUPADDMESSAGE object:nil];
- }
- - (void)getData
- {
- [self.dataArray removeAllObjects];
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Detail) parameters:@{@"GroupId":@(self.GroupId)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- weakSelf.listModel = [TDGroupInfoListModel modelWithDictionary:responseObject];
- [weakSelf.dataArray addObjectsFromArray: weakSelf.listModel.GroupUserListResult];
- if (weakSelf.upDateTitleBolck) {
- weakSelf.upDateTitleBolck(weakSelf.listModel.Name);
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (NSMutableArray *)dataArray
- {
- if (!_dataArray) {
- _dataArray = [NSMutableArray array];
- }
- return _dataArray;
- }
- #pragma mark - UITableViewDelegate
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 2;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if (section == 0) {
- switch (self.listModel.GroupUserRoleId) {
- case 1:
- return 6;
- break;
- case 2:
- return 4;
- break;
- default:
- return 3;
- break;
- }
- }else{
- return self.dataArray.count;
- }
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- WS(weakSelf);
- if (indexPath.section == 0) {
- switch (self.listModel.GroupUserRoleId) {
- case 1:
- {
- switch (indexPath.row) {
- case 0:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgV sd_setImageWithURL:[NSURL URLWithString:self.listModel.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- cell.cell0TitleL.text = self.listModel.Name;
- return cell;
- }
- break;
- case 1:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell1TitleL.text = @"小组二维码";
- return cell;
- }
- break;
- case 2:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell2TitleL.text = @"加入小组需要管理员同意";
- [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
- [weakSelf NeedAgree];
- }];
- [cell.cell2Switch setOn:self.listModel.IsAdmin];
- return cell;
- }
- break;
- case 3:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell2TitleL.text = @"只允许管理员发话题(禁言)";
- [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
- [weakSelf AdminTalk];
- }];
- [cell.cell2Switch setOn:self.listModel.IsWords];
- return cell;
- }
- break;
- case 4:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell2TitleL.text = @"消息免打扰";
- [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
- [weakSelf ChatEnabelChange];
- }];
- [cell.cell2Switch setOn:self.listModel.IsUDisturb];
- return cell;
- }
- break;
- default:
- {
- ChatGroupAddVC *vc = [[ChatGroupAddVC alloc] init];
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell3:tableView indexPath:indexPath];
- cell.cell3TitleL.text = @"添加成员";
- [cell.cell3AddBtn setAction:^{
- Department *defaltGroupSetion = [[Department alloc]init];
- defaltGroupSetion.Name = @"单位通讯录";
- defaltGroupSetion.Id = 0;
-
- Department *myGroupSetion = [[Department alloc]init];
- myGroupSetion.Name = @"自建通讯录";
- defaltGroupSetion.Id = 0;
-
- vc.departSourceDataArray = @[defaltGroupSetion,myGroupSetion].mutableCopy;
- vc.isDefalutPage = 1;
- vc.type = AddGroupUser;
- vc.Id = weakSelf.listModel.Id;
- NSMutableArray * array = [NSMutableArray array];
- for (TDGroupInfoModel * model in self.dataArray) {
- SelectModel * smodel = [[SelectModel alloc] init];
- smodel.UserId = model.UserId;
- smodel.UserName = model.Name;
- [array addObject:smodel];
- }
- vc.grouperArray = array;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }
- break;
- }
- }
- break;
- case 2:
- {
- switch (indexPath.row) {
- case 0:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgV sd_setImageWithURL:[NSURL URLWithString:self.listModel.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- cell.cell0TitleL.text = self.listModel.Name;
- return cell;
- }
- break;
- case 1:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell1TitleL.text = @"小组二维码";
- return cell;
- }
- break;
- case 2:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell2TitleL.text = @"消息免打扰";
- [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
- [weakSelf ChatEnabelChange];
- }];
- [cell.cell2Switch setOn:self.listModel.IsUDisturb];
- return cell;
- }
- break;
- default:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell3:tableView indexPath:indexPath];
- cell.cell3TitleL.text = @"添加成员";
- [cell.cell3AddBtn setAction:^{
- Department *defaltGroupSetion = [[Department alloc]init];
- defaltGroupSetion.Name = @"单位通讯录";
- defaltGroupSetion.Id = 0;
-
- Department *myGroupSetion = [[Department alloc]init];
- myGroupSetion.Name = @"自建通讯录";
- defaltGroupSetion.Id = 0;
-
- ChatGroupAddVC *vc = [[ChatGroupAddVC alloc] init];
- vc.departSourceDataArray = @[defaltGroupSetion,myGroupSetion].mutableCopy;
- vc.isDefalutPage = 1;
- vc.type = AddGroupUser;
- vc.Id = weakSelf.listModel.Id;
- NSMutableArray * array = [NSMutableArray array];
- for (TDGroupInfoModel * model in self.dataArray) {
- SelectModel * smodel = [[SelectModel alloc] init];
- smodel.UserId = model.UserId;
- smodel.UserName = model.Name;
- [array addObject:smodel];
- }
- vc.grouperArray = array;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- return cell;
- }
- break;
- }
- }
- break;
- default:
- {
- switch (indexPath.row) {
- case 0:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell0:tableView indexPath:indexPath];
- [cell.cell0ImgV sd_setImageWithURL:[NSURL URLWithString:self.listModel.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- cell.cell0TitleL.text = self.listModel.Name;
- return cell;
- }
- break;
- case 1:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell1:tableView indexPath:indexPath];
- cell.cell1TitleL.text = @"小组二维码";
- return cell;
- }
- break;
- default:
- {
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
- cell.cell2TitleL.text = @"消息免打扰";
- [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
- [weakSelf ChatEnabelChange];
- }];
- [cell.cell2Switch setOn:self.listModel.IsUDisturb];
- return cell;
- }
- break;
- }
- }
- break;
- }
- }else{
- TDGroupInfoModel * model = [self.dataArray objectAtIndex:indexPath.row];
- TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell4:tableView indexPath:indexPath];
- [cell.cell4imgV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
- cell.cell4NameL.text = model.Name;
- switch (model.GroupUserRoleId) {
- case 1:
- {
- cell.cell4LevelL.hidden = NO;
- cell.cell4LevelL.text = @"创建者";
- cell.cell4LevelL.backgroundColor = UIColorHex(#3979D3);
- }
- break;
- case 2:
- {
- cell.cell4LevelL.hidden = NO;
- cell.cell4LevelL.text = @"管理员";
- cell.cell4LevelL.backgroundColor = UIColorHex(#FF9503);
- }
- break;
- default:
- {
- cell.cell4LevelL.hidden = YES;
- }
- break;
- }
- cell.cell4subL.text = model.DepartmentName;
- cell.cell4TimeL.text = @"2019-11-14";
- return cell;
- }
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 65.f;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- if (section == 0) {
- return 50.f;
- }
- return 35.f;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- return 0.01f;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- {
- if (section == 0) {
- return [[createSearchBarView alloc] init];
- }else{
- UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 35)];
- view.backgroundColor = UIColorHex(#F0EFF4);
- UILabel * label = [UILabel new];
- NSString * str = [NSString stringWithFormat:@"成员:%ld人,话题:%ld",(long)self.listModel.GroupUserNumber,(long)self.listModel.GroupTopicNumber];
- NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:str attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang SC" size: 13],NSForegroundColorAttributeName : UIColorHex(#666666)}];
- label.attributedText = string;
- [view addSubview:label];
- [label mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_offset(@15);
- make.centerY.mas_equalTo(view);
- }];
- return view;
- }
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (indexPath.section == 0) {
- switch (indexPath.row) {
- case 0:
- {
- if (self.listModel.GroupUserRoleId == 1) {
- TDGroupInfoChangeVc * vc = [TDGroupInfoChangeVc initTDGroupInfoChangeVc];
- vc.model = self.listModel;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- break;
- case 1:
- {
- TDGroupQrcodeVC * vc= [TDGroupQrcodeVC initTDGroupQrcodeVC];
- vc.isCreate = NO;
- vc.model = self.listModel;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- break;
- }
- }else{
- TDGroupInfoModel * model = [self.dataArray objectAtIndex:indexPath.row];
- MailListDetailVC *vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = model.UserId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }
- #pragma mark - UISwitch - event
- - (void)NeedAgree
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(APP_Group_Set_Admin),(long)self.listModel.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)AdminTalk
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(APP_Group_Set_Words),(long)self.listModel.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)ChatEnabelChange
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(APP_Group_Set_Disturb),(long)self.listModel.Id];
- [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- #pragma Mark 左滑按钮 iOS8以上
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
- - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
- WS(weakSelf);
- if (indexPath.section > 0) {
- TDGroupInfoModel *model = [self.dataArray objectAtIndex:indexPath.row];
- switch (self.listModel.GroupUserRoleId) {
- case 1:{
- if (model.GroupUserRoleId != 1) {
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:(UIAlertControllerStyleAlert)];
- UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:model];
- }];
- UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [alert addAction:sureAction];
- [alert addAction:cancelAction];
- [weakSelf presentViewController:alert animated:YES completion:^{
-
- }];
- }];
- action1.backgroundColor = UIColorHex(#F64A33);
- NSString * isAdmin = model.GroupUserRoleId == 2 ? @"取消管理员" : @"设为管理员";
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:isAdmin handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- [weakSelf setRoleLevel:model];
- }];
-
- action2.backgroundColor = UIColorHex(#FF9503);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- }break;
- case 2:{
- if (model.GroupUserRoleId == 3) {
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
- UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:(UIAlertControllerStyleAlert)];
- UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
-
- }];
- UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
-
- }];
- [alert addAction:sureAction];
- [alert addAction:cancelAction];
- [weakSelf presentViewController:alert animated:YES completion:^{
-
- }];
- }];
- action1.backgroundColor = UIColorHex(#F64A33);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- }break;
- default:{
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- }
- }
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }
- #else
- - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
- WEAKSELF
- if (indexPath.section > 0) {
- TDGroupInfoModel *model = [self.dataArray objectAtIndex:indexPath.row];
- switch (self.listModel.GroupUserRoleId) {
- case 1:{
- if (model.GroupUserRoleId != 1) {
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf deleteFind:model];
- }];
- action1.backgroundColor = UIColorHex(#FF3B2F);
- NSString * isAdmin = model.GroupUserRoleId == 2 ? @"取消管理员" : @"设为管理员";
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:isAdmin handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf setRoleLevel:model];
- }];
-
- action2.backgroundColor = UIColorHex(#FF9503);
- return @[action1, action2];
- }else{
- return @[];
- }
- }break;
- case 2:{
- if (model.GroupUserRoleId == 3) {
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- action1.backgroundColor = UIColorHex(#FF3B2F);
- return @[action1];
- }else{
- return @[];
- }
- }break;
- default:{
- return @[];
- }
- }
- }else{
- return @[];
- }
- }
- #endif
- - (void)deleteFind:(TDGroupInfoModel *)model
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_DELETE_User) parameters:@{@"GroupUserIds":@[@(model.UserId)],@"GroupId":@(self.listModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"删除成功")
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)setRoleLevel:(TDGroupInfoModel *)model
- {
- NSInteger level = model.GroupUserRoleId == 2 ? 3 : 2;
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Update_User) parameters:@{@"RoleId":@(level),@"Id":@(model.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
- SHOWSUCCESS(@"设置成功")
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf getData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- /// 退出小组
- - (IBAction)qiutGroupAction:(id)sender {
- SHOWLOADING
- WEAKSELF
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(SaoYiSao3_Post),(long)self.GroupId];
- [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- for ( int i = 0 ;i< weakSelf.navigationController.viewControllers.count;i++) {
- if ([weakSelf.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDGroupViewController")]) {
- [weakSelf.navigationController popToViewController:weakSelf.navigationController.viewControllers[i] animated:YES];
- return;
- }
- }
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (IBAction)backAction:(id)sender {
- [super backAction:sender];
- }
- - (void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- WKWebsiteDataStore *dateStore = [WKWebsiteDataStore defaultDataStore];
- [dateStore fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes]
- completionHandler:^(NSArray * __nonnull records) {
- for (WKWebsiteDataRecord *record in records)
- {
- [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:record.dataTypes
- forDataRecords:@[record]
- completionHandler:^{
- NSLog(@"Cookies for %@ deleted successfully",record.displayName);
- }];
- }
- }];
- }
- - (void)showMessage
- {
- UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@"需等待对方验证同意加入本小组" message:nil preferredStyle:UIAlertControllerStyleAlert];
- [alertController addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
- }]];
- [self presentViewController:alertController animated:YES completion:nil];
- }
- @end
|