YOUPAIZYUpdateRemarkWindow.m 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // YOUPAIZYUpdateRemarkWindow.m
  3. // VQU
  4. //
  5. // Created by Elaine on 2020/12/11.
  6. // Copyright © 2020 leo. All rights reserved.
  7. //
  8. #import "YOUPAIZYUpdateRemarkWindow.h"
  9. #import "UIViewController+TFPresent.h"
  10. #import "YOUPAILZTextView.h"
  11. #import "IQKeyboardManager.h"
  12. @interface YOUPAIZYUpdateRemarkWindow ()
  13. @property(nonatomic,strong)UILabel *youpaipnameLabel;
  14. @property (nonatomic,strong)YOUPAILZTextView* youpaiptextView;
  15. @end
  16. @implementation YOUPAIZYUpdateRemarkWindow
  17. - (void)viewWillAppear:(BOOL)animated {
  18. [super viewWillAppear:animated];
  19. [[IQKeyboardManager sharedManager] setEnable:YES];
  20. }
  21. - (void)viewWillDisappear:(BOOL)animated {
  22. [super viewWillDisappear:animated];
  23. [[IQKeyboardManager sharedManager] setEnable:NO];
  24. }
  25. - (void)youpaifgetData{
  26. [LCHttpHelper requestWithURLString:ChatSetting parameters:@{@"user_id":self.youpaipsession.sessionId} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  27. NSDictionary* dict = (NSDictionary*)responseObject;
  28. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  29. if (code==0) {//成功
  30. YOUPAILCBaseInfo *baseInfo = [YOUPAILCBaseInfo mj_objectWithKeyValues:[[dict objectForKey:@"data"]objectForKey:@"info"]];
  31. }
  32. } failure:^(NSError *error) {
  33. }];
  34. }
  35. - (void)viewDidLoad {
  36. [super viewDidLoad];
  37. // [self.view setFrame:CGRectMake(0, 0, self.vWidth, self.vHeight)];
  38. // CAShapeLayer *maskLayer = [CAShapeLayer layer];
  39. // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:16];
  40. // maskLayer.path = path.CGPath;
  41. // self.view.layer.mask = maskLayer;
  42. // [self.view setBackgroundColor:[UIColor whiteColor]];
  43. [IQKeyboardManager sharedManager].enableAutoToolbar = NO; // 控制是否显示键盘上的工具条
  44. [IQKeyboardManager sharedManager].keyboardDistanceFromTextField = NavBarHeight; //
  45. [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
  46. _youpaipnameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.vWidth,62)];
  47. _youpaipnameLabel.text = @"修改备注名";
  48. _youpaipnameLabel.textColor = LZ273145Color;
  49. _youpaipnameLabel.textAlignment = NSTextAlignmentCenter;
  50. _youpaipnameLabel.font = LCBoldFont(19);
  51. [self.baseView addSubview:_youpaipnameLabel];
  52. self.baseView.backgroundColor = [UIColor whiteColor];
  53. // UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0,61.5,self.vWidth,0.5)];
  54. // line.backgroundColor = HexColorFromRGB(0xEEEEEE);
  55. // [self.baseView addSubview:line];
  56. // UIView* view = [[UIView alloc]initWithFrame:CGRectMake(19,62, self.vWidth-38,self.vHeight - 62 - 75-10)];
  57. // view.backgroundColor = HexColorFromRGB(0x4F4B5B);
  58. // view.layer.cornerRadius = 5.0;
  59. // view.layer.masksToBounds = YES;
  60. // [self.baseView addSubview:view];
  61. YOUPAILZTextView *textView = [[YOUPAILZTextView alloc] initWithMaxCount:10.0f];
  62. textView.frame = CGRectMake(19,62, self.vWidth-38,self.vHeight - 62 - 75-10);
  63. textView.youpaiptextViewPadding = UIEdgeInsetsMake(10.0f, 10.0f, 10.0f, 10.0f);
  64. textView.youpaiptextLengthDefaultColor = LZA3AABEColor;
  65. textView.youpaiptextLengthHigtColor = LZ7C69FEColor;
  66. textView.youpaiptextLengthFont = LCFont(14.0f);
  67. textView.youpaiptextLengthRight = 10.0f;
  68. textView.youpaiptextLengthBottom = 10.0f;
  69. textView.youpaiptextView.placeholderFont = LCFont(14.0f);
  70. textView.youpaiptextView.placeholderTextColor = LZD3D1D7Color;
  71. textView.youpaiptextView.placeholderText = @"请输入备注名…";
  72. textView.youpaiptextView.font = LCFont(14.0f);
  73. textView.backgroundColor = LZFAFAFCColor;
  74. textView.layer.cornerRadius = 5.0f;
  75. textView.clipsToBounds = YES;
  76. textView.tintColor = LZ7C69FEColor;
  77. [self.baseView addSubview:textView];
  78. textView.youpaiptextView.textColor = LZ273145Color;
  79. self.youpaiptextView = textView;
  80. UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  81. cancelBtn.frame = CGRectMake(14,CGRectGetMaxY(textView.frame)+20,(self.vWidth-42)/2.0,48);
  82. [cancelBtn addTarget:self action:@selector(youpaifcancelBtnAction) forControlEvents:UIControlEventTouchUpInside];
  83. [cancelBtn setTitle:@"取消" forState:0];
  84. [cancelBtn setTitleColor:LZ273145Color forState:0];
  85. [cancelBtn setBackgroundColor:LZF5F4F7Color];
  86. cancelBtn.layer.cornerRadius = 24;
  87. cancelBtn.layer.masksToBounds = YES;
  88. cancelBtn.titleLabel.font = LCFont(14);
  89. [self.baseView addSubview:cancelBtn];
  90. UIButton *confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  91. confirmBtn.frame = CGRectMake(14+(self.vWidth-42)/2.0+14,CGRectGetMaxY(textView.frame)+20,(self.vWidth-42)/2.0,48);
  92. [confirmBtn addTarget:self action:@selector(youpaifconfirmBtnAction) forControlEvents:UIControlEventTouchUpInside];
  93. [confirmBtn setTitle:@"确定" forState:0];
  94. [confirmBtn setTitleColor:HexColorFromRGB(0xffffff) forState:0];
  95. [confirmBtn setBackgroundColor:[UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((self.vWidth-42)/2.0, 48) FromColors:@[LZBFB6FFColor,LZ7C69FEColor] ByGradientType:1]]];
  96. confirmBtn.layer.cornerRadius = 24;
  97. confirmBtn.layer.masksToBounds = YES;
  98. confirmBtn.titleLabel.font = LCFont(14);
  99. [self.baseView addSubview:confirmBtn];
  100. // [self youpaifgetData];
  101. }
  102. -(void)youpaifresignKeyboard{
  103. [self.youpaiptextView resignFirstResponder];
  104. }
  105. -(void)youpaifcancelBtnAction
  106. {
  107. [self TFDismissViewController];
  108. }
  109. -(void)youpaifconfirmBtnAction
  110. {
  111. if (self.youpaiptextView.youpaiptextView.text.length>10) {
  112. [ZCHUDHelper showTitle:@"备注长度最多为10个字符"];
  113. }else{
  114. [LCHttpHelper requestWithURLString:UpdateRemark parameters:@{@"user_id":self.youpaipsession.sessionId,@"remark":self.youpaiptextView.youpaiptextView.text}
  115. needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
  116. NSDictionary* dict = (NSDictionary*)responseObject;
  117. NSInteger code = [[dict objectForKey:@"code"] integerValue];
  118. if (code==0) {//成功
  119. [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
  120. [self TFDismissViewController];
  121. }
  122. } failure:^(NSError *error) {
  123. }];
  124. }
  125. }
  126. @end