|
|
@ -53,6 +53,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,strong) NSString *checkCode; |
|
|
|
@property (nonatomic ,strong) NSString *checkCode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIButton *agreementBtn; |
|
|
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@end |
|
|
|
|
|
|
|
|
|
|
|
@implementation RegisteredViewController |
|
|
|
@implementation RegisteredViewController |
|
|
@ -116,7 +118,8 @@ |
|
|
|
// lable.text = @"点击“注册”即表示你同意《用户服务协议》"; |
|
|
|
// lable.text = @"点击“注册”即表示你同意《用户服务协议》"; |
|
|
|
NSString * userAgreement = @"《用户服务协议》"; |
|
|
|
NSString * userAgreement = @"《用户服务协议》"; |
|
|
|
NSString * privacyPolicy = @"《隐私政策》"; |
|
|
|
NSString * privacyPolicy = @"《隐私政策》"; |
|
|
|
NSString * allStr = [NSString stringWithFormat:@"点击注册即表示您同意%@和%@",userAgreement,privacyPolicy]; |
|
|
|
NSString * erprivacyPolicy = @"《儿童隐私政策》"; |
|
|
|
|
|
|
|
NSString * allStr = [NSString stringWithFormat:@"同意%@、%@和%@",userAgreement,privacyPolicy,erprivacyPolicy]; |
|
|
|
NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc] initWithString:allStr]; |
|
|
|
NSMutableAttributedString * attributedStr = [[NSMutableAttributedString alloc] initWithString:allStr]; |
|
|
|
|
|
|
|
|
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:KKBlack20 range:[allStr rangeOfString:userAgreement]]; |
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:KKBlack20 range:[allStr rangeOfString:userAgreement]]; |
|
|
@ -125,23 +128,43 @@ |
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:KKBlack20 range:[allStr rangeOfString:privacyPolicy]]; |
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:KKBlack20 range:[allStr rangeOfString:privacyPolicy]]; |
|
|
|
[attributedStr addAttribute:NSLinkAttributeName value:PrivacyPolicyURLStr range:[allStr rangeOfString:privacyPolicy]]; |
|
|
|
[attributedStr addAttribute:NSLinkAttributeName value:PrivacyPolicyURLStr range:[allStr rangeOfString:privacyPolicy]]; |
|
|
|
|
|
|
|
|
|
|
|
// [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:[allStr rangeOfString:@"点击注册即表示您同意"]]; |
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:KKBlack20 range:[allStr rangeOfString:erprivacyPolicy]]; |
|
|
|
// [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:[allStr rangeOfString:@"和"]]; |
|
|
|
[attributedStr addAttribute:NSLinkAttributeName value:PrivacyPolicyURLStr_er range:[allStr rangeOfString:erprivacyPolicy]]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:RGB(121, 121, 121) range:[allStr rangeOfString:@"同意"]]; |
|
|
|
|
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:RGB(121, 121, 121) range:[allStr rangeOfString:@"、"]]; |
|
|
|
|
|
|
|
[attributedStr addAttribute:NSForegroundColorAttributeName value:RGB(121, 121, 121) range:[allStr rangeOfString:@"和"]]; |
|
|
|
|
|
|
|
|
|
|
|
lable.attributedText = attributedStr; |
|
|
|
lable.attributedText = attributedStr; |
|
|
|
lable.textAlignment = NSTextAlignmentCenter; |
|
|
|
lable.textAlignment = NSTextAlignmentCenter; |
|
|
|
lable.font = [UIFont systemFontOfSize:10]; |
|
|
|
lable.font = Font_(12); |
|
|
|
|
|
|
|
// lable.backgroundColor = mainColor; |
|
|
|
|
|
|
|
CGRect rect = [UICommon GetTextWidth:allStr ViewHeight:30 fontSize:Font_(12) type:@"w"]; |
|
|
|
[self.view addSubview:lable]; |
|
|
|
[self.view addSubview:lable]; |
|
|
|
//设置约束 |
|
|
|
//设置约束 |
|
|
|
[lable mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
[lable mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
make.centerX.equalTo(self.view.mas_centerX); |
|
|
|
make.centerX.equalTo(self.view.mas_centerX).offset(Adapted(15)); |
|
|
|
if(ScreenHeight >= 812){ |
|
|
|
if(ScreenHeight >= 812){ |
|
|
|
make.bottom.equalTo(self.view.mas_bottom).offset(-25); |
|
|
|
make.bottom.equalTo(self.view.mas_bottom).offset(-25); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
make.bottom.equalTo(self.view.mas_bottom).offset(-20); |
|
|
|
make.bottom.equalTo(self.view.mas_bottom).offset(-20); |
|
|
|
} |
|
|
|
} |
|
|
|
make.height.offset(30); |
|
|
|
make.height.offset(30); |
|
|
|
make.width.offset(SWIDTH-28); |
|
|
|
make.width.offset(rect.size.width+10); |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIButton *agreementBtn = [UICommon ui_buttonSimple:CGRectZero font:FontADA_(0) normalColor:KKWhiteColorColor normalText:@"" click:^(UIButton *btn) { |
|
|
|
|
|
|
|
btn.selected = !btn.selected; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
[agreementBtn setImage:ImageName_(@"login_no_the_selected_icon") forState:UIControlStateNormal]; |
|
|
|
|
|
|
|
[agreementBtn setImage:ImageName_(@"login_the_selected_icon") forState:UIControlStateSelected]; |
|
|
|
|
|
|
|
// agreementBtn.selected = YES; |
|
|
|
|
|
|
|
self.agreementBtn = agreementBtn; |
|
|
|
|
|
|
|
[self.view addSubview:agreementBtn]; |
|
|
|
|
|
|
|
[agreementBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
|
|
|
|
|
|
|
make.centerY.equalTo(lable.mas_centerY); |
|
|
|
|
|
|
|
make.right.equalTo(lable.mas_left); |
|
|
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(Adapted(15), Adapted(15))); |
|
|
|
}]; |
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
[xMyHttp getZYBTokenSuccess:^(id responseObject) { |
|
|
|
[xMyHttp getZYBTokenSuccess:^(id responseObject) { |
|
|
@ -226,14 +249,33 @@ |
|
|
|
|
|
|
|
|
|
|
|
[UICommon MessageErrorText:@"密码不一致"]; |
|
|
|
[UICommon MessageErrorText:@"密码不一致"]; |
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
} |
|
|
|
|
|
|
|
else if (!self.agreementBtn.selected) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
EasyAlertView *alertV = [EasyAlertView alertViewWithTitle:@"同意《用户服务协议》、《隐私政策》和《儿童隐私政策》" subtitle:nil AlertViewType:AlertViewTypeSystemAlert config:nil]; |
|
|
|
|
|
|
|
[alertV addAlertItem:^EasyAlertItem *{ |
|
|
|
|
|
|
|
return [EasyAlertItem itemWithTitle:@"取消" type:AlertItemTypeSystemCancel callback:^(EasyAlertView *showview, long index) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
[alertV addAlertItem:^EasyAlertItem *{ |
|
|
|
|
|
|
|
return [EasyAlertItem itemWithTitle:@"注册" type:AlertItemTypeSystemDefault callback:^(EasyAlertView *showview, long index) { |
|
|
|
|
|
|
|
self.agreementBtn.selected = YES; |
|
|
|
|
|
|
|
[self registerAction]; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
[alertV showAlertView]; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
//设置国家代码 |
|
|
|
//设置国家代码 |
|
|
|
NSString * code = [UserDefaults valueForKey:kSelectCountryCodeKey]; |
|
|
|
NSString * code = [UserDefaults valueForKey:kSelectCountryCodeKey]; |
|
|
|
[self.parameters setValue:code forKey:@"country_code"]; |
|
|
|
[self.parameters setValue:code forKey:@"country_code"]; |
|
|
|
WEAKSELF |
|
|
|
WEAKSELF |
|
|
|
[User newUserWithParameters:self.parameters success:^(id responseObject) { |
|
|
|
[User newUserWithParameters:self.parameters success:^(id responseObject) { |
|
|
|
if(weakSelf.successBack){weakSelf.successBack(weakSelf.parameters[@"phone"]);} |
|
|
|
if(weakSelf.successBack){weakSelf.successBack(weakSelf.parameters[@"phone"]);} |
|
|
|
[UICommon MessageSuccessText:@"注册成功,请登录账号" isImg:YES]; |
|
|
|
[UICommon MessageSuccessText:@"注册成功,请登录账号" isImg:YES]; |
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
|
|
|
[weakSelf.navigationController popViewControllerAnimated:YES]; |
|
|
|
[weakSelf.navigationController popViewControllerAnimated:YES]; |
|
|
@ -492,25 +534,30 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//MARK: ========UITextViewDelegate========= |
|
|
|
//MARK: UITextViewDelegate |
|
|
|
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange { |
|
|
|
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange { |
|
|
|
|
|
|
|
if ([URL.absoluteString containsString:AccoutXieYiURLStr]) |
|
|
|
|
|
|
|
{ |
|
|
|
if ([URL.absoluteString containsString:AccoutXieYiURLStr]) { |
|
|
|
|
|
|
|
xLog(@"跳转到用户协议"); |
|
|
|
|
|
|
|
WebViewController *vc = [WebViewController new]; |
|
|
|
WebViewController *vc = [WebViewController new]; |
|
|
|
vc.url = AccoutXieYiURLStr; |
|
|
|
vc.url = AccoutXieYiURLStr; |
|
|
|
vc.title = @"用户服务协议"; |
|
|
|
vc.title = @"用户服务协议"; |
|
|
|
[self.navigationController pushViewController:vc animated:YES]; |
|
|
|
[self.navigationController pushViewController:vc animated:YES]; |
|
|
|
return NO; |
|
|
|
return NO; |
|
|
|
} else if ([URL.absoluteString containsString:PrivacyPolicyURLStr]) { |
|
|
|
} |
|
|
|
xLog(@"跳转到隐私政策"); |
|
|
|
else if ([URL.absoluteString containsString:PrivacyPolicyURLStr]) { |
|
|
|
WebViewController *vc = [WebViewController new]; |
|
|
|
WebViewController *vc = [WebViewController new]; |
|
|
|
vc.url = PrivacyPolicyURLStr; |
|
|
|
vc.url = PrivacyPolicyURLStr; |
|
|
|
vc.title = @"隐私政策"; |
|
|
|
vc.title = @"隐私政策"; |
|
|
|
[self.navigationController pushViewController:vc animated:YES]; |
|
|
|
[self.navigationController pushViewController:vc animated:YES]; |
|
|
|
return NO; |
|
|
|
return NO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else if ([URL.absoluteString containsString:PrivacyPolicyURLStr_er]) { |
|
|
|
|
|
|
|
WebViewController *vc = [WebViewController new]; |
|
|
|
|
|
|
|
vc.url = PrivacyPolicyURLStr_er; |
|
|
|
|
|
|
|
vc.title = @"儿童隐私政策"; |
|
|
|
|
|
|
|
[self.navigationController pushViewController:vc animated:YES]; |
|
|
|
|
|
|
|
return NO; |
|
|
|
|
|
|
|
} |
|
|
|
return YES; |
|
|
|
return YES; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|