123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- //
- // DRFeedbackController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/2/5.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRFeedbackController.h"
- #import "PlaceholderTextView.h"
- #import "DRLoginViewController.h"
- @interface DRFeedbackController ()
- @property (nonatomic, strong) UITextView *textView;
- @property(nonatomic, strong)UILabel *detailLabel;//“添加专属客服微信,了解更多赚钱秘籍”
- @property(nonatomic, strong)UIImageView *icon;//图标
- @property(nonatomic, strong)UILabel *userName;//用户名称
- @property(nonatomic, strong)UILabel *userWeixin;//用户微信号
- @property(nonatomic, strong)UIButton *weixinNumebrButton;//复制微信号
- @property(nonatomic, strong)UIButton *pushWeixinButton;//跳转到微信
- @end
- @implementation DRFeedbackController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self configNavigationbar];
- [self configTextView];
- // [self pushToWeixinUI];
- }
- -(void)pushToWeixinUI {
-
- [self getNetworkerWithPushWeixin];
-
- self.detailLabel = [[UILabel alloc] init];
- [self.view addSubview:self.detailLabel];
- [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.mas_equalTo(self.textView.mas_bottom).mas_offset(FITSIZE(131));
- make.width.mas_greaterThanOrEqualTo(FITSIZE(120));
- make.height.mas_greaterThanOrEqualTo(FITSIZE(21));
- make.centerX.mas_equalTo(self.view);
- }];
- self.detailLabel.text = @"添加专属客服微信,了解更多赚钱秘籍";
- self.detailLabel.textColor = [UIColor YHColorWithHex:0x000000];
- self.detailLabel.font = [UIFont systemFontOfSize:FITSIZE(15)];
-
- self.icon = [[UIImageView alloc] init];
- [self.view addSubview:self.icon];
- [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.detailLabel.mas_bottom).mas_offset(FITSIZE(41));
- make.left.mas_equalTo(self.detailLabel).mas_offset(FITSIZE(34));
- make.width.height.mas_equalTo(FITSIZE(50));
- }];
-
-
- self.userName = [[UILabel alloc] init];
- [self.view addSubview:self.userName];
- [self.userName mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.left.mas_equalTo(self.icon.mas_right).mas_offset(FITSIZE(11));
- make.top.mas_equalTo(self.icon);
- make.width.mas_greaterThanOrEqualTo(FITSIZE(64));
- make.height.mas_greaterThanOrEqualTo(FITSIZE(22));
- }];
- self.userName.textColor = [UIColor YHColorWithHex:0x000000];
- self.userName.font = [UIFont systemFontOfSize:FITSIZE(16)];
-
- self.userWeixin = [[UILabel alloc] init];
- [self.view addSubview:self.userWeixin];
- [self.userWeixin mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.left.mas_equalTo(self.userName);
- make.top.mas_equalTo(self.userName.mas_bottom).mas_offset(FITSIZE(8));
- make.width.mas_greaterThanOrEqualTo(FITSIZE(124));
- make.height.mas_greaterThanOrEqualTo(FITSIZE(18));
- }];
- self.userWeixin.textColor = [UIColor YHColorWithHex:0x000000];
- self.userWeixin.font = [UIFont systemFontOfSize:FITSIZE(13)];
-
-
- self.weixinNumebrButton = [[UIButton alloc] init];
- [self.view addSubview:self.weixinNumebrButton];
- [self.weixinNumebrButton mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.mas_equalTo(self.userWeixin.mas_bottom).mas_offset(FITSIZE(40));
- make.width.mas_equalTo(FITSIZE(160));
- make.height.mas_equalTo(FITSIZE(160*37/223));
- make.left.mas_equalTo(self.view).mas_offset(FITSIZE(20));
- }];
- [self.weixinNumebrButton setImage:[UIImage imageNamed:@"复制微信号"] forState:UIControlStateNormal];
- [self.weixinNumebrButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [self.weixinNumebrButton setFont:[UIFont systemFontOfSize:FITSIZE(16)]];
- [self.weixinNumebrButton addTarget:self action:@selector(copyWeixinNumber) forControlEvents:UIControlEventTouchUpInside];
-
- self.pushWeixinButton = [[UIButton alloc] init];
- [self.view addSubview:self.pushWeixinButton];
- [self.pushWeixinButton mas_makeConstraints:^(MASConstraintMaker *make) {
-
- make.top.mas_equalTo(self.weixinNumebrButton);
- make.width.mas_equalTo(FITSIZE(160));
- make.height.mas_equalTo(FITSIZE(160*37/223));
- make.right.mas_equalTo(self.view).mas_offset(FITSIZE(-20));
- }];
- [self.pushWeixinButton setImage:[UIImage imageNamed:@"打开微信"] forState:UIControlStateNormal];
- [self.pushWeixinButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- [self.pushWeixinButton setFont:[UIFont systemFontOfSize:FITSIZE(16)]];
- [self.pushWeixinButton addTarget:self action:@selector(pushToWeixin) forControlEvents:UIControlEventTouchUpInside];
-
-
-
- }
- -(void)getNetworkerWithPushWeixin {
-
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setValue:@"1" forKey:@"flag"];
-
- [DRHttp post:newServiceWechat params:dict success:^(id json) {
-
- NSDictionary *rstDict = (NSDictionary*)json;
-
- NSString *imgUrl = rstDict[@"headimgurl"];
- NSString *weixinNumber = rstDict[@"wechat"];
- [self.icon sd_setImageWithURL:[NSURL URLWithString:imgUrl]];
- self.userWeixin.text = weixinNumber;
- self.userName.text = rstDict[@"nickname"];
-
- } failure:^(NSError *error) {
-
-
- }];
- }
- -(void)copyWeixinNumber {
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- pasteboard.string = self.userWeixin.text;
-
- UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"复制成功" message:@"" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alter show];
- }
- -(void)pushToWeixin {
- NSString *str = @"weixin://wx86eb866db4b5e8dc";
- [MobClick event:ExclusiveServiceCopy label:@"1"];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
- }
- - (void)backAction {
- [self.navigationController popViewControllerAnimated:YES];
- [MobClick event:ExclusiveServiceOpen label:@"1"];
- }
- - (void)configNavigationbar {
- [self.navigationBar setNavTitle:@"意见反馈"];
- UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
- [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- [self.navigationBar setCustomLeftButtons:@[leftBtn]];
- [self.navigationBar setShowNavigationBarBottomLine:YES];
- }
- - (void)configTextView {
- PlaceholderTextView *textView = [[PlaceholderTextView alloc]init];
- textView.placeholderLabel.font = [UIFont systemFontOfSize:15];
- textView.placeholder = @"请输入反馈文字...";
- textView.font = [UIFont systemFontOfSize:15];
- textView.frame = (CGRect){10,NavBarHeight+20,CGRectGetWidth(self.view.frame)-20,200};
- textView.maxLength = 200;
- textView.layer.cornerRadius = 5.f;
- textView.layer.borderColor = [[UIColor grayColor]colorWithAlphaComponent:0.3].CGColor;
- textView.layer.borderWidth = 0.5f;
- [self.view addSubview:textView];
- self.textView = textView;
-
- [textView didChangeText:^(PlaceholderTextView *textView) {
- NSLog(@"%@",textView.text);
- }];
-
- UILabel *logOut = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-50-BottomMargin, SCREEN_WIDTH, 50)];
- logOut.backgroundColor = [UIColor whiteColor];
- logOut.textColor = [UIColor homeRedColor];
- logOut.textAlignment = NSTextAlignmentCenter;
- logOut.font = [UIFont systemFontOfSize:14];
- logOut.text = @"提交反馈";
- logOut.userInteractionEnabled = YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(feedbackAction)];
- [logOut addGestureRecognizer:tap];
- [self.view addSubview:logOut];
-
- }
- - (void)feedbackAction {
-
- if (![AccountTool isLogin]) {
- DRLoginViewController *login = [[DRLoginViewController alloc] init];
- [self presentViewController:login animated:YES completion:nil];
- return;
- }
-
- NSString *text = self.textView.text;
- NSDictionary *para = @{@"user_feedback":text};
- [DRHttp post:UserFeedback params:para success:^(id json) {
-
- self.textView.text = @"";
-
- [SVProgressHUD showSuccessWithStatus:@"提交成功,感谢您宝贵的意见"];
-
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|