GroupVerifyVC.m 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // GroupVerifyVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/7/16.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "GroupVerifyVC.h"
  9. #import "MailListMoveVC.h"
  10. @interface GroupVerifyVC ()<UITextViewDelegate>
  11. @property (weak, nonatomic) IBOutlet UIButton *sendBtn;
  12. @property (weak, nonatomic) IBOutlet UITextView *textView;
  13. @property (weak, nonatomic) IBOutlet UILabel *countL;
  14. @property (copy, nonatomic) NSString *Name;
  15. @property (assign, nonatomic) NSInteger GroupId;
  16. @end
  17. @implementation GroupVerifyVC
  18. +(GroupVerifyVC *)initGroupVerifyVC{
  19. GroupVerifyVC *controller = [StoryboardManager.shared.Source instantiateViewControllerWithIdentifier:@"GroupVerifyVC"];
  20. return controller;
  21. }
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. self.fd_prefersNavigationBarHidden = YES;
  25. self.view.backgroundColor = UIColorHex(0xF8F8F8);
  26. WS(weakSelf);
  27. [self.sendBtn setAction:^{
  28. NSDictionary * paraDict = @{@"GroupId":@(weakSelf.Id),
  29. @"UserIds":@[@([AppUserModel sharedAppUserModel].Id)],
  30. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  31. @"SourceType":@(1),///申请
  32. @"Remark":weakSelf.textView.text
  33. };
  34. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Group_Insert_User) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  35. if (weakSelf.SendBlock) {
  36. weakSelf.SendBlock();
  37. }
  38. [weakSelf.navigationController popViewControllerAnimated:YES];
  39. } failure:^(NSError * _Nonnull error) {
  40. SHOWERROR([ZYCTool handerResultData:error]);
  41. }];
  42. }];
  43. self.textView.delegate = self;
  44. }
  45. - (void)textViewDidChange:(UITextView *)textView
  46. {
  47. UITextRange *markRange = textView.markedTextRange;
  48. NSInteger pos = [textView offsetFromPosition:markRange.start
  49. toPosition:markRange.end];
  50. NSInteger nLength = textView.text.length - pos;
  51. if (nLength > 100 && pos == 0)
  52. {
  53. self.countL.text = [NSString stringWithFormat:@"100/100"];
  54. self.textView.text = [textView.text substringToIndex:100];
  55. }else{
  56. self.countL.text = [NSString stringWithFormat:@"%ld/100",textView.text.length];
  57. }
  58. }
  59. @end