// // HSQPushToWeixViewController.m // YouHuiProject // // Created by 王奥东 on 2018/11/13. // Copyright © 2018 kuxuan. All rights reserved. // #import "HSQPushToWeixViewController.h" #import #import "HYUMShareManager.h" #import #import "HSQShareManager.h" #import "HSQAuthorityManager.h" #import @interface HSQPushToWeixViewController (){ NSString *_weChatStr; NSInteger _showType;//1注册 2客服 ActivityIndicatorView *_indicatorView; } @property(nonatomic, strong)UILabel *detailLabel;//“添加专属客服微信,了解更多赚钱秘籍” @property(nonatomic, strong)UIImageView *icon;//图标 @property(nonatomic, strong)UILabel *userName;//用户名称 @property(nonatomic, strong)UILabel *userWeixin;//用户微信号 @property(nonatomic, strong)UILabel *noteLabel;//非专属客服的提醒 @property(nonatomic, strong)UILabel *InviteCardLabel;//添加邀请码的提示 @property(nonatomic, strong)UIButton *weixinNumebrButton;//复制微信号 @property(nonatomic, strong)UIButton *pushWeixinButton;//跳转到微信 @property(nonatomic, strong)UIButton *leftBtn;//返回,除注册时显示返回按钮 @property(nonatomic, strong)UIButton *rightJump;//跳过,注册时显示跳过按钮 //二维码 @property(nonatomic,strong)UIImageView *codeImgv; @property(nonatomic, strong)UIButton *savecodeBtn;//保存二维码 @property(nonatomic, strong)UIButton *copysBtn;//复制 @property(nonatomic, strong) UITableView *tableView; @end @implementation HSQPushToWeixViewController - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; } - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; self.detailLabel = [[UILabel alloc] init]; [self.view addSubview:self.detailLabel]; 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.backgroundColor=[UIColor backgroudColor]; self.icon.layer.cornerRadius=FITSIZE(20); self.icon.layer.masksToBounds=YES; [self.icon mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.view).mas_offset(FITSIZE(103)); make.left.mas_equalTo(FITSIZE(26)); make.width.height.mas_equalTo(FITSIZE(40)); }]; [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.view).mas_offset(FITSIZE(103)); make.width.mas_greaterThanOrEqualTo(FITSIZE(120)); make.height.mas_greaterThanOrEqualTo(FITSIZE(40)); make.left.mas_equalTo(self.icon.mas_right).mas_offset(FITSIZE(16)); }]; //添加二维码 self.codeImgv =[[UIImageView alloc]init]; self.codeImgv.backgroundColor =[UIColor backgroudColor]; [self.view addSubview:self.codeImgv]; [self.codeImgv mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(FITSIZE(153)); make.centerX.mas_equalTo(self.view); make.top.mas_equalTo(217); }]; self.savecodeBtn =[[UIButton alloc]init]; self.savecodeBtn.backgroundColor =[UIColor homeRedColor]; self.savecodeBtn.layer.cornerRadius=FITSIZE(4); self.savecodeBtn.layer.masksToBounds=YES; [self.savecodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; self.savecodeBtn.titleLabel.font =[UIFont systemFontOfSize:FITSIZE(16)]; [self.savecodeBtn setTitle:@"保存二维码到手机" forState:UIControlStateNormal]; [self.savecodeBtn addTarget:self action:@selector(saveCodePhone) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.savecodeBtn]; [self.savecodeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.view); make.top.mas_equalTo(self.codeImgv.mas_bottom).mas_offset(FITSIZE(38)); make.width.mas_equalTo(FITSIZE(223)); make.height.mas_offset(FITSIZE(37)); }]; self.copysBtn =[[UIButton alloc]init]; self.copysBtn.backgroundColor =[UIColor homeRedColor]; self.copysBtn.layer.cornerRadius=FITSIZE(4); self.copysBtn.layer.masksToBounds=YES; [self.copysBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; self.copysBtn.titleLabel.font =[UIFont systemFontOfSize:FITSIZE(16)]; [self.copysBtn setTitle:@"复制微信号打开微信" forState:UIControlStateNormal]; [self.view addSubview:self.copysBtn]; [self.copysBtn addTarget:self action:@selector(pushToWeixin) forControlEvents:UIControlEventTouchUpInside]; [self.copysBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.view); make.top.mas_equalTo(self.savecodeBtn.mas_top).mas_offset(FITSIZE(50)); make.width.mas_equalTo(FITSIZE(223)); make.height.mas_offset(FITSIZE(37)); }]; self.userWeixin = [[UILabel alloc] init]; self.userWeixin.textColor = [UIColor YHColorWithHex:0x000000]; self.userWeixin.font = [UIFont systemFontOfSize:FITSIZE(13)]; self.userWeixin.textAlignment=NSTextAlignmentCenter; [self.view addSubview:self.userWeixin]; [self.userWeixin mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self.view); make.top.mas_equalTo(self.copysBtn.mas_bottom).mas_offset(FITSIZE(8)); make.width.mas_greaterThanOrEqualTo(FITSIZE(124)); make.height.mas_greaterThanOrEqualTo(FITSIZE(18)); }]; [self setNavBar]; [self initHUD]; [self requestDetail]; // [self getNetworkerWithPushWeixin]; } - (void)initHUD { ActivityIndicatorView *indicatorView = [ActivityIndicatorView showInView:self.view frame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight)]; _indicatorView = indicatorView; [_indicatorView startAnimating]; } //请求 -(void)requestDetail { NSString *url= [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/belongToYou",BaseURL]; [HSQHttp post:url params:nil success:^(id json) { [self.icon sd_setImageWithURL:[NSURL URLWithString:json[@"headimgurl"]]]; [self.codeImgv sd_setImageWithURL:[NSURL URLWithString:json[@"qrcode"]]]; self.userWeixin.text=[NSString stringWithFormat:@"微信号:%@",json[@"wechat"]]; _weChatStr =json[@"wechat"]; NSArray *array =json[@"text"]; for (int i =0 ;i