《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRFeedbackController.m 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. //
  2. // DRFeedbackController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/2/5.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRFeedbackController.h"
  9. #import "PlaceholderTextView.h"
  10. #import "DRLoginViewController.h"
  11. @interface DRFeedbackController ()
  12. @property (nonatomic, strong) UITextView *textView;
  13. @property(nonatomic, strong)UILabel *detailLabel;//“添加专属客服微信,了解更多赚钱秘籍”
  14. @property(nonatomic, strong)UIImageView *icon;//图标
  15. @property(nonatomic, strong)UILabel *userName;//用户名称
  16. @property(nonatomic, strong)UILabel *userWeixin;//用户微信号
  17. @property(nonatomic, strong)UIButton *weixinNumebrButton;//复制微信号
  18. @property(nonatomic, strong)UIButton *pushWeixinButton;//跳转到微信
  19. @end
  20. @implementation DRFeedbackController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self configNavigationbar];
  24. [self configTextView];
  25. // [self pushToWeixinUI];
  26. }
  27. -(void)pushToWeixinUI {
  28. [self getNetworkerWithPushWeixin];
  29. self.detailLabel = [[UILabel alloc] init];
  30. [self.view addSubview:self.detailLabel];
  31. [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.top.mas_equalTo(self.textView.mas_bottom).mas_offset(FITSIZE(131));
  33. make.width.mas_greaterThanOrEqualTo(FITSIZE(120));
  34. make.height.mas_greaterThanOrEqualTo(FITSIZE(21));
  35. make.centerX.mas_equalTo(self.view);
  36. }];
  37. self.detailLabel.text = @"添加专属客服微信,了解更多赚钱秘籍";
  38. self.detailLabel.textColor = [UIColor YHColorWithHex:0x000000];
  39. self.detailLabel.font = [UIFont systemFontOfSize:FITSIZE(15)];
  40. self.icon = [[UIImageView alloc] init];
  41. [self.view addSubview:self.icon];
  42. [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.top.mas_equalTo(self.detailLabel.mas_bottom).mas_offset(FITSIZE(41));
  44. make.left.mas_equalTo(self.detailLabel).mas_offset(FITSIZE(34));
  45. make.width.height.mas_equalTo(FITSIZE(50));
  46. }];
  47. self.userName = [[UILabel alloc] init];
  48. [self.view addSubview:self.userName];
  49. [self.userName mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.mas_equalTo(self.icon.mas_right).mas_offset(FITSIZE(11));
  51. make.top.mas_equalTo(self.icon);
  52. make.width.mas_greaterThanOrEqualTo(FITSIZE(64));
  53. make.height.mas_greaterThanOrEqualTo(FITSIZE(22));
  54. }];
  55. self.userName.textColor = [UIColor YHColorWithHex:0x000000];
  56. self.userName.font = [UIFont systemFontOfSize:FITSIZE(16)];
  57. self.userWeixin = [[UILabel alloc] init];
  58. [self.view addSubview:self.userWeixin];
  59. [self.userWeixin mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.mas_equalTo(self.userName);
  61. make.top.mas_equalTo(self.userName.mas_bottom).mas_offset(FITSIZE(8));
  62. make.width.mas_greaterThanOrEqualTo(FITSIZE(124));
  63. make.height.mas_greaterThanOrEqualTo(FITSIZE(18));
  64. }];
  65. self.userWeixin.textColor = [UIColor YHColorWithHex:0x000000];
  66. self.userWeixin.font = [UIFont systemFontOfSize:FITSIZE(13)];
  67. self.weixinNumebrButton = [[UIButton alloc] init];
  68. [self.view addSubview:self.weixinNumebrButton];
  69. [self.weixinNumebrButton mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.top.mas_equalTo(self.userWeixin.mas_bottom).mas_offset(FITSIZE(40));
  71. make.width.mas_equalTo(FITSIZE(160));
  72. make.height.mas_equalTo(FITSIZE(160*37/223));
  73. make.left.mas_equalTo(self.view).mas_offset(FITSIZE(20));
  74. }];
  75. [self.weixinNumebrButton setImage:[UIImage imageNamed:@"复制微信号"] forState:UIControlStateNormal];
  76. [self.weixinNumebrButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  77. [self.weixinNumebrButton setFont:[UIFont systemFontOfSize:FITSIZE(16)]];
  78. [self.weixinNumebrButton addTarget:self action:@selector(copyWeixinNumber) forControlEvents:UIControlEventTouchUpInside];
  79. self.pushWeixinButton = [[UIButton alloc] init];
  80. [self.view addSubview:self.pushWeixinButton];
  81. [self.pushWeixinButton mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.top.mas_equalTo(self.weixinNumebrButton);
  83. make.width.mas_equalTo(FITSIZE(160));
  84. make.height.mas_equalTo(FITSIZE(160*37/223));
  85. make.right.mas_equalTo(self.view).mas_offset(FITSIZE(-20));
  86. }];
  87. [self.pushWeixinButton setImage:[UIImage imageNamed:@"打开微信"] forState:UIControlStateNormal];
  88. [self.pushWeixinButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  89. [self.pushWeixinButton setFont:[UIFont systemFontOfSize:FITSIZE(16)]];
  90. [self.pushWeixinButton addTarget:self action:@selector(pushToWeixin) forControlEvents:UIControlEventTouchUpInside];
  91. }
  92. -(void)getNetworkerWithPushWeixin {
  93. NSMutableDictionary *dict = [NSMutableDictionary dictionary];
  94. [dict setValue:@"1" forKey:@"flag"];
  95. [DRHttp post:newServiceWechat params:dict success:^(id json) {
  96. NSDictionary *rstDict = (NSDictionary*)json;
  97. NSString *imgUrl = rstDict[@"headimgurl"];
  98. NSString *weixinNumber = rstDict[@"wechat"];
  99. [self.icon sd_setImageWithURL:[NSURL URLWithString:imgUrl]];
  100. self.userWeixin.text = weixinNumber;
  101. self.userName.text = rstDict[@"nickname"];
  102. } failure:^(NSError *error) {
  103. }];
  104. }
  105. -(void)copyWeixinNumber {
  106. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
  107. pasteboard.string = self.userWeixin.text;
  108. UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"复制成功" message:@"" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
  109. [alter show];
  110. }
  111. -(void)pushToWeixin {
  112. NSString *str = @"weixin://wx86eb866db4b5e8dc";
  113. [MobClick event:ExclusiveServiceCopy label:@"1"];
  114. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
  115. }
  116. - (void)backAction {
  117. [self.navigationController popViewControllerAnimated:YES];
  118. [MobClick event:ExclusiveServiceOpen label:@"1"];
  119. }
  120. - (void)configNavigationbar {
  121. [self.navigationBar setNavTitle:@"意见反馈"];
  122. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  123. [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  124. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  125. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  126. [self.navigationBar setShowNavigationBarBottomLine:YES];
  127. }
  128. - (void)configTextView {
  129. PlaceholderTextView *textView = [[PlaceholderTextView alloc]init];
  130. textView.placeholderLabel.font = [UIFont systemFontOfSize:15];
  131. textView.placeholder = @"请输入反馈文字...";
  132. textView.font = [UIFont systemFontOfSize:15];
  133. textView.frame = (CGRect){10,NavBarHeight+20,CGRectGetWidth(self.view.frame)-20,200};
  134. textView.maxLength = 200;
  135. textView.layer.cornerRadius = 5.f;
  136. textView.layer.borderColor = [[UIColor grayColor]colorWithAlphaComponent:0.3].CGColor;
  137. textView.layer.borderWidth = 0.5f;
  138. [self.view addSubview:textView];
  139. self.textView = textView;
  140. [textView didChangeText:^(PlaceholderTextView *textView) {
  141. NSLog(@"%@",textView.text);
  142. }];
  143. UILabel *logOut = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-50-BottomMargin, SCREEN_WIDTH, 50)];
  144. logOut.backgroundColor = [UIColor whiteColor];
  145. logOut.textColor = [UIColor homeRedColor];
  146. logOut.textAlignment = NSTextAlignmentCenter;
  147. logOut.font = [UIFont systemFontOfSize:14];
  148. logOut.text = @"提交反馈";
  149. logOut.userInteractionEnabled = YES;
  150. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(feedbackAction)];
  151. [logOut addGestureRecognizer:tap];
  152. [self.view addSubview:logOut];
  153. }
  154. - (void)feedbackAction {
  155. if (![AccountTool isLogin]) {
  156. DRLoginViewController *login = [[DRLoginViewController alloc] init];
  157. [self presentViewController:login animated:YES completion:nil];
  158. return;
  159. }
  160. NSString *text = self.textView.text;
  161. NSDictionary *para = @{@"user_feedback":text};
  162. [DRHttp post:UserFeedback params:para success:^(id json) {
  163. self.textView.text = @"";
  164. [SVProgressHUD showSuccessWithStatus:@"提交成功,感谢您宝贵的意见"];
  165. } failure:^(NSError *error) {
  166. }];
  167. }
  168. - (void)didReceiveMemoryWarning {
  169. [super didReceiveMemoryWarning];
  170. // Dispose of any resources that can be recreated.
  171. }
  172. /*
  173. #pragma mark - Navigation
  174. // In a storyboard-based application, you will often want to do a little preparation before navigation
  175. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  176. // Get the new view controller using [segue destinationViewController].
  177. // Pass the selected object to the new view controller.
  178. }
  179. */
  180. @end