ChatJoinGroupVC.m 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // ChatJoinGroupVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/7.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "ChatJoinGroupVC.h"
  9. #import "EMChatViewController.h"
  10. #import "TabBarController.h"
  11. #import "ChatMsgListVC.h"
  12. @interface ChatJoinGroupVC ()
  13. @property (weak, nonatomic) IBOutlet UIImageView *IconView;
  14. @property (weak, nonatomic) IBOutlet UILabel *numberL;
  15. @property (weak, nonatomic) IBOutlet UILabel *GroupNameL;
  16. @property (weak, nonatomic) IBOutlet UIButton *joinBtn;
  17. @end
  18. @implementation ChatJoinGroupVC
  19. + (ChatJoinGroupVC *)initChatJoinGroupVC{
  20. ChatJoinGroupVC *controller = [StoryboardManager.shared.chatMsg instantiateViewControllerWithIdentifier:@"ChatJoinGroupVC"];
  21. return controller;
  22. }
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. self.fd_prefersNavigationBarHidden = YES;
  26. [self loadCusViewData];
  27. }
  28. - (void)loadCusViewData
  29. {
  30. if ([[self.dict objectForKey:@"IsUser"] boolValue]) {
  31. [self.joinBtn setTitle:@"进入群聊" forState:UIControlStateNormal];
  32. }
  33. NSDictionary * groupDict = [self.dict objectForKey:@"GroupChat"];
  34. NSArray * numCount = [self.dict objectForKey:@"Item"];
  35. [self.IconView sd_setImageWithURL:[NSURL URLWithString:[groupDict objectForKey:@"AvatarUrl"]] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
  36. self.numberL.text = [NSString stringWithFormat:@"(共%ld人)",(long)[numCount count]];
  37. self.GroupNameL.text = [groupDict objectForKey:@"Name"];
  38. }
  39. - (IBAction)ClickJoinAction:(id)sender {
  40. NSDictionary * groupDict = [self.dict objectForKey:@"GroupChat"];
  41. NSLog(@"%@",[groupDict objectForKey:@"GroupChatImId"]);
  42. if([[self.dict objectForKey:@"IsUser"] boolValue]){
  43. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  44. [[NSNotificationCenter defaultCenter] postNotificationName:PUSHEMCHATVIEWCOTROLLER object:nil userInfo:groupDict];
  45. [self.navigationController popToRootViewControllerAnimated:NO];
  46. });
  47. }else{
  48. NSDictionary * paraDict = @{@"GroupChatImId":[groupDict objectForKey:@"GroupChatImId"],
  49. @"UserIds":@[@([AppUserModel sharedAppUserModel].Id)],
  50. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  51. @"SourceType":@(1)//申请加入
  52. };
  53. WS(weakSelf);
  54. [[HttpManager sharedHttpManager] POSTUrl:Host(Group_chat_add_users) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  55. dispatch_async(dispatch_get_main_queue(), ^{
  56. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  57. [[NSNotificationCenter defaultCenter] postNotificationName:PUSHEMCHATVIEWCOTROLLER object:nil userInfo:groupDict];
  58. [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  59. });
  60. });
  61. } failure:^(NSError * _Nonnull error) {
  62. SHOWERROR([ZYCTool handerResultData:error]);
  63. }];
  64. }
  65. }
  66. - (IBAction)ClickbackAction:(id)sender {
  67. [self dismissViewControllerAnimated:YES completion:^{
  68. }];
  69. }
  70. @end