TDGroupRoleVC.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // TDGroupRoleVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/8.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "TDGroupRoleVC.h"
  9. #import "TDGroupInfoDetailCell.h"
  10. @interface TDGroupRoleVC ()<UITableViewDelegate,UITableViewDataSource>
  11. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  12. @end
  13. @implementation TDGroupRoleVC
  14. +(TDGroupRoleVC *)initTDGroupRoleVC{
  15. TDGroupRoleVC *controller = [StoryboardManager.shared.TDGroup instantiateViewControllerWithIdentifier:@"TDGroupRoleVC"];
  16. return controller;
  17. }
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. self.fd_prefersNavigationBarHidden = YES;
  21. self.view.backgroundColor = UIColorHex(0xF1F1F1);
  22. self.tableView.delegate = self;
  23. self.tableView.dataSource = self;
  24. }
  25. #pragma mark - UITableViewDelegate
  26. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  27. {
  28. return 1;
  29. }
  30. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  31. {
  32. return 3;
  33. }
  34. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  35. {
  36. return 65.f;
  37. }
  38. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  39. {
  40. WS(weakSelf);
  41. switch (indexPath.row) {
  42. case 0:
  43. {
  44. TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
  45. cell.cell2TitleL.text = @"加入小组需要管理员同意";
  46. [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
  47. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Update) parameters:@{@"IsAdmin":cell.cell2Switch.isOn ? @"1" : @"2",@"Id":@(weakSelf.model.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  48. if (weakSelf.refreshBlock) {
  49. weakSelf.refreshBlock();
  50. }
  51. } failure:^(NSError * _Nonnull error) {
  52. SHOWERROR([ZYCTool handerResultData:error]);
  53. }];
  54. }];
  55. [cell.cell2Switch setOn:self.model.IsAdmin];
  56. return cell;
  57. }
  58. break;
  59. case 1:
  60. {
  61. TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
  62. cell.cell2TitleL.text = @"只允许管理员发话题(禁言)";
  63. [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
  64. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Update) parameters:@{@"IsWords":cell.cell2Switch.isOn ? @"1" : @"2",@"Id":@(weakSelf.model.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  65. if (weakSelf.refreshBlock) {
  66. weakSelf.refreshBlock();
  67. }
  68. } failure:^(NSError * _Nonnull error) {
  69. SHOWERROR([ZYCTool handerResultData:error]);
  70. }];
  71. }];
  72. [cell.cell2Switch setOn:self.model.IsWords];
  73. return cell;
  74. }
  75. break;
  76. default:
  77. {
  78. TDGroupInfoDetailCell *cell = [TDGroupInfoDetailCell configCell2:tableView indexPath:indexPath];
  79. cell.cell2TitleL.text = @"小组广场可见";
  80. [cell.cell2Switch setBlockForControlEvents:UIControlEventValueChanged block:^(id _Nonnull sender) {
  81. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Update) parameters:@{@"IsShow":cell.cell2Switch.isOn ? @"1" : @"2",@"Id":@(weakSelf.model.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  82. if (weakSelf.refreshBlock) {
  83. weakSelf.refreshBlock();
  84. }
  85. } failure:^(NSError * _Nonnull error) {
  86. SHOWERROR([ZYCTool handerResultData:error]);
  87. }];
  88. }];
  89. [cell.cell2Switch setOn:self.model.IsShow];
  90. return cell;
  91. }
  92. break;
  93. }
  94. }
  95. @end