12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- //
- // ChatJoinGroupVC.m
- // smartRhino
- //
- // Created by niuzhen on 2019/12/7.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "ChatJoinGroupVC.h"
- #import "EMChatViewController.h"
- #import "TabBarController.h"
- #import "ChatMsgListVC.h"
- @interface ChatJoinGroupVC ()
- @property (weak, nonatomic) IBOutlet UIImageView *IconView;
- @property (weak, nonatomic) IBOutlet UILabel *numberL;
- @property (weak, nonatomic) IBOutlet UILabel *GroupNameL;
- @property (weak, nonatomic) IBOutlet UIButton *joinBtn;
- @end
- @implementation ChatJoinGroupVC
- + (ChatJoinGroupVC *)initChatJoinGroupVC{
- ChatJoinGroupVC *controller = [StoryboardManager.shared.chatMsg instantiateViewControllerWithIdentifier:@"ChatJoinGroupVC"];
- return controller;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.fd_prefersNavigationBarHidden = YES;
- [self loadCusViewData];
- }
- - (void)loadCusViewData
- {
- if ([[self.dict objectForKey:@"IsUser"] boolValue]) {
- [self.joinBtn setTitle:@"进入群聊" forState:UIControlStateNormal];
- }
- NSDictionary * groupDict = [self.dict objectForKey:@"GroupChat"];
- NSArray * numCount = [self.dict objectForKey:@"Item"];
- [self.IconView sd_setImageWithURL:[NSURL URLWithString:[groupDict objectForKey:@"AvatarUrl"]] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
- self.numberL.text = [NSString stringWithFormat:@"(共%ld人)",(long)[numCount count]];
- self.GroupNameL.text = [groupDict objectForKey:@"Name"];
- }
- - (IBAction)ClickJoinAction:(id)sender {
- NSDictionary * groupDict = [self.dict objectForKey:@"GroupChat"];
- NSLog(@"%@",[groupDict objectForKey:@"GroupChatImId"]);
- if([[self.dict objectForKey:@"IsUser"] boolValue]){
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:PUSHEMCHATVIEWCOTROLLER object:nil userInfo:groupDict];
- [self.navigationController popToRootViewControllerAnimated:NO];
- });
- }else{
- NSDictionary * paraDict = @{@"GroupChatImId":[groupDict objectForKey:@"GroupChatImId"],
- @"UserIds":@[@([AppUserModel sharedAppUserModel].Id)],
- @"UserId":@([AppUserModel sharedAppUserModel].Id),
- @"SourceType":@(1)//申请加入
- };
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(Group_chat_add_users) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:PUSHEMCHATVIEWCOTROLLER object:nil userInfo:groupDict];
- [weakSelf.navigationController popToRootViewControllerAnimated:NO];
- });
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- }
- - (IBAction)ClickbackAction:(id)sender {
- [self dismissViewControllerAnimated:YES completion:^{
-
- }];
- }
- @end
|