|
@@ -10,12 +10,12 @@
|
|
|
#import "LoginViewController.h"
|
|
#import "LoginViewController.h"
|
|
|
#import "AgreementViewController.h"
|
|
#import "AgreementViewController.h"
|
|
|
#import "privateViewController.h"
|
|
#import "privateViewController.h"
|
|
|
|
|
+
|
|
|
#define SET_WIFI_TIMES 60
|
|
#define SET_WIFI_TIMES 60
|
|
|
|
|
|
|
|
-@interface RegisterViewController ()<UITextFieldDelegate>
|
|
|
|
|
-{
|
|
|
|
|
- UILabel * _dcLab; //倒计时lab
|
|
|
|
|
- NSTimer * _timer; //倒计时定时器
|
|
|
|
|
|
|
+@interface RegisterViewController () <UITextFieldDelegate> {
|
|
|
|
|
+ UILabel *_dcLab; //倒计时lab
|
|
|
|
|
+ NSTimer *_timer; //倒计时定时器
|
|
|
UITextField *input;
|
|
UITextField *input;
|
|
|
UIButton *deleteBtn;
|
|
UIButton *deleteBtn;
|
|
|
UIButton *getCodeBtn;
|
|
UIButton *getCodeBtn;
|
|
@@ -30,54 +30,53 @@
|
|
|
BOOL canUsePhone;
|
|
BOOL canUsePhone;
|
|
|
int dcTimes;
|
|
int dcTimes;
|
|
|
}
|
|
}
|
|
|
-@property (weak, nonatomic) IBOutlet UITableView *tableView;
|
|
|
|
|
-@property (weak, nonatomic) IBOutlet UIButton *registerBtn;
|
|
|
|
|
-@property (weak, nonatomic) IBOutlet NSLayoutConstraint *tableHeight;
|
|
|
|
|
-@property (weak, nonatomic) IBOutlet UILabel *agrementLabel;
|
|
|
|
|
-@property (weak, nonatomic) IBOutlet UILabel *privateLabel;
|
|
|
|
|
|
|
+@property(weak, nonatomic) IBOutlet UITableView *tableView;
|
|
|
|
|
+@property(weak, nonatomic) IBOutlet UIButton *registerBtn;
|
|
|
|
|
+@property(weak, nonatomic) IBOutlet NSLayoutConstraint *tableHeight;
|
|
|
|
|
+@property(weak, nonatomic) IBOutlet UILabel *agrementLabel;
|
|
|
|
|
+@property(weak, nonatomic) IBOutlet UILabel *privateLabel;
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
-@implementation RegisterViewController
|
|
|
|
|
-{
|
|
|
|
|
- NSString * randomCode;
|
|
|
|
|
|
|
+@implementation RegisterViewController {
|
|
|
|
|
+ NSString *randomCode;
|
|
|
BOOL isRight;
|
|
BOOL isRight;
|
|
|
BOOL isSel;
|
|
BOOL isSel;
|
|
|
}
|
|
}
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
-
|
|
|
|
|
- if ([UIScreen spt_currentScreenMode]== LESScreenModeIPhoneX){
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if ([UIScreen spt_currentScreenMode] == LESScreenModeIPhoneX) {
|
|
|
|
|
+
|
|
|
self.tableHeight.constant = 400;
|
|
self.tableHeight.constant = 400;
|
|
|
}
|
|
}
|
|
|
- UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
|
|
+ UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
btn.frame = CGRectMake(0, 0, 40, 40);
|
|
btn.frame = CGRectMake(0, 0, 40, 40);
|
|
|
[btn setImage:[UIImage imageNamed:@"fanhui2"] forState:UIControlStateNormal];
|
|
[btn setImage:[UIImage imageNamed:@"fanhui2"] forState:UIControlStateNormal];
|
|
|
- btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
|
|
|
|
|
|
|
+ btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
|
|
|
[btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
|
|
[btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
|
|
|
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
|
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
|
|
- UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
|
|
|
|
|
|
+ UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
|
|
nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
|
|
nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
|
|
|
self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
|
|
self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
|
|
|
self.navigationItem.title = @"新用户注册";
|
|
self.navigationItem.title = @"新用户注册";
|
|
|
self.tableView.scrollEnabled = NO;
|
|
self.tableView.scrollEnabled = NO;
|
|
|
UITapGestureRecognizer *argeementTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toArgeement:)];
|
|
UITapGestureRecognizer *argeementTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toArgeement:)];
|
|
|
- [self.agrementLabel addGestureRecognizer:argeementTap];
|
|
|
|
|
|
|
+ [self.agrementLabel addGestureRecognizer:argeementTap];
|
|
|
self.agrementLabel.userInteractionEnabled = YES;
|
|
self.agrementLabel.userInteractionEnabled = YES;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
UITapGestureRecognizer *privateTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toPrivate:)];
|
|
UITapGestureRecognizer *privateTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toPrivate:)];
|
|
|
- [self.privateLabel addGestureRecognizer:privateTap];
|
|
|
|
|
|
|
+ [self.privateLabel addGestureRecognizer:privateTap];
|
|
|
self.privateLabel.userInteractionEnabled = YES;
|
|
self.privateLabel.userInteractionEnabled = YES;
|
|
|
// Do any additional setup after loading the view.
|
|
// Do any additional setup after loading the view.
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
--(void)backClick{
|
|
|
|
|
- LoginViewController *lVc = [[LoginViewController alloc]init];
|
|
|
|
|
|
|
+- (void)backClick {
|
|
|
|
|
+ LoginViewController *lVc = [[LoginViewController alloc] init];
|
|
|
[self.navigationController pushViewController:lVc animated:NO];
|
|
[self.navigationController pushViewController:lVc animated:NO];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)successBack{
|
|
|
|
|
- LoginViewController *lVc = [[LoginViewController alloc]init];
|
|
|
|
|
|
|
+- (void)successBack {
|
|
|
|
|
+ LoginViewController *lVc = [[LoginViewController alloc] init];
|
|
|
lVc.registerAccount = phoneNum;
|
|
lVc.registerAccount = phoneNum;
|
|
|
lVc.registerPwd = password;
|
|
lVc.registerPwd = password;
|
|
|
[self.navigationController pushViewController:lVc animated:NO];
|
|
[self.navigationController pushViewController:lVc animated:NO];
|
|
@@ -88,19 +87,20 @@
|
|
|
isSel = !isSel;
|
|
isSel = !isSel;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)toArgeement:(UITapGestureRecognizer*)recognizer{
|
|
|
|
|
- AgreementViewController *aVc = [[AgreementViewController alloc]init];
|
|
|
|
|
|
|
+- (void)toArgeement:(UITapGestureRecognizer *)recognizer {
|
|
|
|
|
+ AgreementViewController *aVc = [[AgreementViewController alloc] init];
|
|
|
[self.navigationController pushViewController:aVc animated:YES];
|
|
[self.navigationController pushViewController:aVc animated:YES];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)toPrivate:(UITapGestureRecognizer*)recognizer{
|
|
|
|
|
- privateViewController *pVc = [[privateViewController alloc]init];
|
|
|
|
|
|
|
+- (void)toPrivate:(UITapGestureRecognizer *)recognizer {
|
|
|
|
|
+ privateViewController *pVc = [[privateViewController alloc] init];
|
|
|
[self.navigationController pushViewController:pVc animated:YES];
|
|
[self.navigationController pushViewController:pVc animated:YES];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)viewWillAppear:(BOOL)animated{
|
|
|
|
|
|
|
+- (void)viewWillAppear:(BOOL)animated {
|
|
|
dcTimes = SET_WIFI_TIMES;
|
|
dcTimes = SET_WIFI_TIMES;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
- (IBAction)toRegister:(id)sender {
|
|
- (IBAction)toRegister:(id)sender {
|
|
|
// if([password isEqualToString:repassword]&&password.length!=0&&repassword.length!=0&&nickName.length!=0&&phoneNum.length!=0&&pkCode.length!=0&&code.length!=0&&[code isEqualToString:randomCode]){
|
|
// if([password isEqualToString:repassword]&&password.length!=0&&repassword.length!=0&&nickName.length!=0&&phoneNum.length!=0&&pkCode.length!=0&&code.length!=0&&[code isEqualToString:randomCode]){
|
|
|
// if(isSel){
|
|
// if(isSel){
|
|
@@ -115,29 +115,29 @@
|
|
|
[self check];
|
|
[self check];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)check{
|
|
|
|
|
- if (nickName.length==0){
|
|
|
|
|
|
|
+- (void)check {
|
|
|
|
|
+ if (nickName.length == 0) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写正确昵称" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写正确昵称" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (phoneNum.length==0) {
|
|
|
|
|
|
|
+ if (phoneNum.length == 0) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写正确手机号" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写正确手机号" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (password.length<6) {
|
|
|
|
|
|
|
+ if (password.length < 6) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写至少6位数密码" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写至少6位数密码" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (repassword.length<6) {
|
|
|
|
|
|
|
+ if (repassword.length < 6) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写至少6位数密码" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写至少6位数密码" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (code.length==0){
|
|
|
|
|
|
|
+ if (code.length == 0) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写正确验证码" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写正确验证码" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (![code isEqualToString:randomCode]){
|
|
|
|
|
|
|
+ if (![code isEqualToString:randomCode]) {
|
|
|
[MBProgressHUD showOnlyText:@"请填写正确验证码" controller:self];
|
|
[MBProgressHUD showOnlyText:@"请填写正确验证码" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -145,28 +145,28 @@
|
|
|
[MBProgressHUD showOnlyText:@"两次输入密码必须一致" controller:self];
|
|
[MBProgressHUD showOnlyText:@"两次输入密码必须一致" controller:self];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if(isSel){
|
|
|
|
|
|
|
+ if (isSel) {
|
|
|
[self doRegister];
|
|
[self doRegister];
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
[MBProgressHUD showTextHUD:@"请勾选阅读协议" inView:self.view hideAfterDelay:1];
|
|
[MBProgressHUD showTextHUD:@"请勾选阅读协议" inView:self.view hideAfterDelay:1];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
--(void)havePhone{
|
|
|
|
|
-
|
|
|
|
|
|
|
+- (void)havePhone {
|
|
|
|
|
+
|
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:phoneNum,@"Phone", nil];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:phoneNum, @"Phone", nil];
|
|
|
|
|
+
|
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_testPhone(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_testPhone(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSString *issuccess = dataDic[@"msg"];
|
|
NSString *issuccess = dataDic[@"msg"];
|
|
|
if ([issuccess isEqualToString:@"success"]) {
|
|
if ([issuccess isEqualToString:@"success"]) {
|
|
|
-
|
|
|
|
|
- NSString * desc = [dataDic objectForKey:@"desc"];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSString *desc = [dataDic objectForKey:@"desc"];
|
|
|
if ([desc isEqualToString:@"未注册"]) {
|
|
if ([desc isEqualToString:@"未注册"]) {
|
|
|
canUsePhone = YES;
|
|
canUsePhone = YES;
|
|
|
- if([getCodeLabel.text isEqualToString:@"获取验证码"]){
|
|
|
|
|
|
|
+ if ([getCodeLabel.text isEqualToString:@"获取验证码"]) {
|
|
|
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
|
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
|
|
target:self
|
|
target:self
|
|
|
selector:@selector(downTimes:)
|
|
selector:@selector(downTimes:)
|
|
@@ -174,7 +174,7 @@
|
|
|
repeats:YES];
|
|
repeats:YES];
|
|
|
[_timer fire];
|
|
[_timer fire];
|
|
|
[self getNum];
|
|
[self getNum];
|
|
|
- }else if ([getCodeLabel.text isEqualToString:@"重新获取"]){
|
|
|
|
|
|
|
+ } else if ([getCodeLabel.text isEqualToString:@"重新获取"]) {
|
|
|
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
|
_timer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
|
|
target:self
|
|
target:self
|
|
|
selector:@selector(downTimes:)
|
|
selector:@selector(downTimes:)
|
|
@@ -183,58 +183,57 @@
|
|
|
[_timer fire];
|
|
[_timer fire];
|
|
|
[self getNum];
|
|
[self getNum];
|
|
|
}
|
|
}
|
|
|
- }else if([desc isEqualToString:@"已注册"]){
|
|
|
|
|
|
|
+ } else if ([desc isEqualToString:@"已注册"]) {
|
|
|
[MBProgressHUD showInfo:@"手机号已注册"];
|
|
[MBProgressHUD showInfo:@"手机号已注册"];
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
[MBProgressHUD showInfo:@"请求失败!"];
|
|
[MBProgressHUD showInfo:@"请求失败!"];
|
|
|
}
|
|
}
|
|
|
- } enError:^(NSError *error) {
|
|
|
|
|
|
|
+ } enError:^(NSError *error) {
|
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
}];
|
|
}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+- (void)doRegister {
|
|
|
|
|
|
|
|
--(void)doRegister{
|
|
|
|
|
-
|
|
|
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:phoneNum,@"mobile",password,@"pass",nickName,@"pet",pkCode,@"introducerpk", nil];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ NSDictionary *dic = @{@"mobile": phoneNum, @"pass": password, @"pet": nickName, @"qrcode": pkCode};
|
|
|
|
|
+
|
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_doRegister(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_doRegister(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
NSString *issuccess = dataDic[@"msg"];
|
|
NSString *issuccess = dataDic[@"msg"];
|
|
|
if ([issuccess isEqualToString:@"success"]) {
|
|
if ([issuccess isEqualToString:@"success"]) {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[MBProgressHUD showInfo:@"注册成功"];
|
|
[MBProgressHUD showInfo:@"注册成功"];
|
|
|
[self successBack];
|
|
[self successBack];
|
|
|
|
|
|
|
|
- }else if ([dataDic[@"msg"] isEqualToString:@"fail"]){
|
|
|
|
|
|
|
+ } else if ([dataDic[@"msg"] isEqualToString:@"fail"]) {
|
|
|
NSString *str = dataDic[@"desc"];
|
|
NSString *str = dataDic[@"desc"];
|
|
|
[MBProgressHUD showTextHUD:str inView:self.view hideAfterDelay:1];
|
|
[MBProgressHUD showTextHUD:str inView:self.view hideAfterDelay:1];
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
[MBProgressHUD showInfo:@"注册失败"];
|
|
[MBProgressHUD showInfo:@"注册失败"];
|
|
|
}
|
|
}
|
|
|
[self.tableView reloadData];
|
|
[self.tableView reloadData];
|
|
|
- } enError:^(NSError *error) {
|
|
|
|
|
|
|
+ } enError:^(NSError *error) {
|
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
}];
|
|
}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
--(void)getNum{
|
|
|
|
|
|
|
+- (void)getNum {
|
|
|
NSString *sn = @"SDK-FHD-010-00328";
|
|
NSString *sn = @"SDK-FHD-010-00328";
|
|
|
//NSString *md5Pwd = [MD5String md5String:[NSString stringWithFormat:@"%@%@",sn,password]];
|
|
//NSString *md5Pwd = [MD5String md5String:[NSString stringWithFormat:@"%@%@",sn,password]];
|
|
|
NSString *Md5Pwd = @"54774CB6E781A142206F756B3E18142C";
|
|
NSString *Md5Pwd = @"54774CB6E781A142206F756B3E18142C";
|
|
|
int a = arc4random() % 100000;
|
|
int a = arc4random() % 100000;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
randomCode = [NSString stringWithFormat:@"%06d", a];
|
|
randomCode = [NSString stringWithFormat:@"%06d", a];
|
|
|
-
|
|
|
|
|
- NSString *content = [NSString stringWithFormat:@"【千模科技】验证码%@,快注册,你的人生即将开挂,更快挣钱,更多代言和影视表演机会都在千模。非本人操作,请勿理会。",randomCode];
|
|
|
|
|
-
|
|
|
|
|
- NSString *str = [NSString stringWithFormat:@"http://sdk.entinfo.cn:8061/mdsmssend.ashx?sn=%@&pwd=%@&mobile=%@&content=%@&ext=&stime=&rrid=&msgfmt=",sn,Md5Pwd,phoneNum,content];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSString *content = [NSString stringWithFormat:@"【千模科技】验证码%@,快注册,你的人生即将开挂,更快挣钱,更多代言和影视表演机会都在千模。非本人操作,请勿理会。", randomCode];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *str = [NSString stringWithFormat:@"http://sdk.entinfo.cn:8061/mdsmssend.ashx?sn=%@&pwd=%@&mobile=%@&content=%@&ext=&stime=&rrid=&msgfmt=", sn, Md5Pwd, phoneNum, content];
|
|
|
// NSString *str = @"";
|
|
// NSString *str = @"";
|
|
|
- NSLog(@"str=%@",str);
|
|
|
|
|
|
|
+ NSLog(@"str=%@", str);
|
|
|
// NSURL *url = [NSURL URLWithString:@"http://222.73.161.212/ispace2/servlet/com.lemon.xml.XmlAction"];
|
|
// NSURL *url = [NSURL URLWithString:@"http://222.73.161.212/ispace2/servlet/com.lemon.xml.XmlAction"];
|
|
|
//
|
|
//
|
|
|
// //A Boolean value that turns an indicator of network activity on or off.
|
|
// //A Boolean value that turns an indicator of network activity on or off.
|
|
@@ -252,57 +251,60 @@
|
|
|
// else {
|
|
// else {
|
|
|
// NSLog(@"File read succeed!:%@",xmlString);
|
|
// NSLog(@"File read succeed!:%@",xmlString);
|
|
|
// }
|
|
// }
|
|
|
-
|
|
|
|
|
- AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
|
|
|
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
|
|
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
|
|
|
[manager GET:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
[manager GET:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
|
|
|
- NSString *result = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
|
|
|
|
+ NSString *result = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
isRight = [result containsString:@"-"];
|
|
isRight = [result containsString:@"-"];
|
|
|
- NSLog(@"%@",result);
|
|
|
|
|
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
|
|
- NSLog(@"%@",error);
|
|
|
|
|
|
|
+ NSLog(@"%@", result);
|
|
|
|
|
+ } failure:^(NSURLSessionDataTask *task, NSError *error) {
|
|
|
|
|
+ NSLog(@"%@", error);
|
|
|
}];
|
|
}];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark tableViewDelegate
|
|
#pragma mark tableViewDelegate
|
|
|
--(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
-- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
|
|
|
|
-{
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
|
|
|
|
|
|
|
return 0.1;
|
|
return 0.1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
--(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
|
|
|
return 50;
|
|
return 50;
|
|
|
}
|
|
}
|
|
|
--(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
|
|
|
|
|
return 6;
|
|
return 6;
|
|
|
}
|
|
}
|
|
|
--(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
static NSString *CellIdentifier = @"Cell";
|
|
static NSString *CellIdentifier = @"Cell";
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
|
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
|
|
if (!cell) {
|
|
if (!cell) {
|
|
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
|
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
|
|
|
}
|
|
}
|
|
|
- input = [[UITextField alloc]initWithFrame:CGRectMake(100, 5, 200, 40)];
|
|
|
|
|
|
|
+ input = [[UITextField alloc] initWithFrame:CGRectMake(100, 5, 200, 40)];
|
|
|
input.backgroundColor = [UIColor clearColor];
|
|
input.backgroundColor = [UIColor clearColor];
|
|
|
input.delegate = self;
|
|
input.delegate = self;
|
|
|
[input addTarget:self action:@selector(textFieldwithText:) forControlEvents:UIControlEventEditingChanged];
|
|
[input addTarget:self action:@selector(textFieldwithText:) forControlEvents:UIControlEventEditingChanged];
|
|
|
[input setTextAlignment:NSTextAlignmentLeft];
|
|
[input setTextAlignment:NSTextAlignmentLeft];
|
|
|
[cell addSubview:input];
|
|
[cell addSubview:input];
|
|
|
-
|
|
|
|
|
- deleteBtn = [[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-20-17, 16, 17, 17)];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ deleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth - 20 - 17, 16, 17, 17)];
|
|
|
[deleteBtn setImage:[UIImage imageNamed:@"shanchu"] forState:UIControlStateNormal];
|
|
[deleteBtn setImage:[UIImage imageNamed:@"shanchu"] forState:UIControlStateNormal];
|
|
|
[deleteBtn addTarget:self action:@selector(delete) forControlEvents:UIControlEventTouchUpInside];
|
|
[deleteBtn addTarget:self action:@selector(delete) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- getCodeBtn = [[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth-20-97,10 , 97, 30)];
|
|
|
|
|
|
|
+ getCodeBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth - 20 - 97, 10, 97, 30)];
|
|
|
[getCodeBtn setImage:[UIImage imageNamed:@"yanzhengma"] forState:UIControlStateNormal];
|
|
[getCodeBtn setImage:[UIImage imageNamed:@"yanzhengma"] forState:UIControlStateNormal];
|
|
|
-
|
|
|
|
|
- getCodeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 ,5, 80, 20)];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ getCodeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, 80, 20)];
|
|
|
getCodeLabel.text = @"获取验证码";
|
|
getCodeLabel.text = @"获取验证码";
|
|
|
getCodeLabel.textAlignment = NSTextAlignmentCenter;
|
|
getCodeLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
getCodeLabel.font = [UIFont systemFontOfSize:14];
|
|
getCodeLabel.font = [UIFont systemFontOfSize:14];
|
|
@@ -363,15 +365,15 @@
|
|
|
return YES;
|
|
return YES;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)delete{
|
|
|
|
|
|
|
+- (void)delete {
|
|
|
phoneNum = @"";
|
|
phoneNum = @"";
|
|
|
[self.tableView reloadData];
|
|
[self.tableView reloadData];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)getCode{
|
|
|
|
|
|
|
+- (void)getCode {
|
|
|
if ([Helper valiMobile:phoneNum]) {
|
|
if ([Helper valiMobile:phoneNum]) {
|
|
|
[self havePhone];
|
|
[self havePhone];
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
[MBProgressHUD showInfo:@"请填写正确手机号"];
|
|
[MBProgressHUD showInfo:@"请填写正确手机号"];
|
|
|
}
|
|
}
|
|
|
// if (canUsePhone) {
|
|
// if (canUsePhone) {
|
|
@@ -400,20 +402,18 @@
|
|
|
// }
|
|
// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)timeInvalidates
|
|
|
|
|
-{
|
|
|
|
|
|
|
+- (void)timeInvalidates {
|
|
|
dcTimes = SET_WIFI_TIMES;
|
|
dcTimes = SET_WIFI_TIMES;
|
|
|
[_timer invalidate];
|
|
[_timer invalidate];
|
|
|
_timer = nil;
|
|
_timer = nil;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)downTimes:(NSTimer*)time
|
|
|
|
|
-{
|
|
|
|
|
|
|
+- (void)downTimes:(NSTimer *)time {
|
|
|
if (dcTimes > 0) {
|
|
if (dcTimes > 0) {
|
|
|
getCodeLabel.text = [NSString stringWithFormat:@"%ds", dcTimes];
|
|
getCodeLabel.text = [NSString stringWithFormat:@"%ds", dcTimes];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
dcTimes--;
|
|
dcTimes--;
|
|
|
} else {
|
|
} else {
|
|
|
getCodeLabel.text = @"重新获取";
|
|
getCodeLabel.text = @"重新获取";
|
|
@@ -426,13 +426,13 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (void)textFieldwithText:(UITextField*)textField{
|
|
|
|
|
- switch (textField.tag-100) {
|
|
|
|
|
|
|
+- (void)textFieldwithText:(UITextField *)textField {
|
|
|
|
|
+ switch (textField.tag - 100) {
|
|
|
case 1:
|
|
case 1:
|
|
|
nickName = textField.text;
|
|
nickName = textField.text;
|
|
|
break;
|
|
break;
|