TDQrJoinVC.m 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // TDQrJoinVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/14.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDQrJoinVC.h"
  9. @interface TDQrJoinVC ()
  10. @property (weak, nonatomic) IBOutlet UIImageView *IconView;
  11. @property (weak, nonatomic) IBOutlet UILabel *numberL;
  12. @property (weak, nonatomic) IBOutlet UILabel *GroupNameL;
  13. @property (weak, nonatomic) IBOutlet UIButton *joinBtn;
  14. @end
  15. @implementation TDQrJoinVC
  16. + (TDQrJoinVC *)initTDQrJoinVC{
  17. TDQrJoinVC *controller = [StoryboardManager.shared.TDGroupInfo instantiateViewControllerWithIdentifier:@"TDQrJoinVC"];
  18. return controller;
  19. }
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.fd_prefersNavigationBarHidden = YES;
  23. [self loadCusViewData];
  24. }
  25. - (void)loadCusViewData
  26. {
  27. [self.IconView sd_setImageWithURL:[NSURL URLWithString:[self.dict objectForKey:@"AvatarUrl"]] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
  28. self.numberL.text = [NSString stringWithFormat:@"(共%ld人)",(long)[[self.dict objectForKey:@"GroupUserNumber"] integerValue]];
  29. self.GroupNameL.text = [self.dict objectForKey:@"Name"];
  30. }
  31. - (IBAction)ClickJoinAction:(id)sender {
  32. NSDictionary * groupDict = @{@"Id":@([[self.dict objectForKey:@"Id"] integerValue])};
  33. NSLog(@"%@",[groupDict objectForKey:@([[self.dict objectForKey:@"Id"] integerValue])]);
  34. WS(weakSelf);
  35. NSDictionary * paraDict = @{@"GroupId":@([[self.dict objectForKey:@"Id"] integerValue]),
  36. @"UserIds":@[@([AppUserModel sharedAppUserModel].Id)],
  37. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  38. @"SourceType":@(1)///申请
  39. };
  40. // if ([self.dict[@"IsUser"] boolValue]) {
  41. // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  42. // [[NSNotificationCenter defaultCenter] postNotificationName:PUSHTDGROUPCOTROLLER object:nil userInfo:weakSelf.dict];
  43. // [self.navigationController popToRootViewControllerAnimated:NO];
  44. // });
  45. // }else{
  46. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Insert_User) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  47. NSString *data = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
  48. if ([data isEqualToString:@"true"]) {
  49. dispatch_async(dispatch_get_main_queue(), ^{
  50. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  51. [[NSNotificationCenter defaultCenter] postNotificationName:PUSHTDGROUPCOTROLLER object:nil userInfo:weakSelf.dict];
  52. // [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  53. });
  54. });
  55. }else{
  56. dispatch_async(dispatch_get_main_queue(), ^{
  57. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"你的申请已提交,请耐心等候!" preferredStyle:(UIAlertControllerStyleAlert)];
  58. UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  59. dispatch_async(dispatch_get_main_queue(), ^{
  60. [weakSelf.navigationController popToRootViewControllerAnimated:NO];
  61. });
  62. }];
  63. [alert addAction:sureAction];
  64. [weakSelf presentViewController:alert animated:YES completion:^{
  65. }];
  66. });
  67. }
  68. } failure:^(NSError * _Nonnull error) {
  69. SHOWERROR([ZYCTool handerResultData:error]);
  70. }];
  71. // }
  72. }
  73. - (IBAction)ClickbackAction:(id)sender {
  74. [self.navigationController popViewControllerAnimated:YES];
  75. }
  76. - (IBAction)ClickMenuAction:(id)sender {
  77. [super menuAction:sender];
  78. }
  79. @end