Skip to content

Commit 2059430

Browse files
committed
新的注册流程
1 parent cbdb4d2 commit 2059430

17 files changed

Lines changed: 474 additions & 167 deletions

Coding_iOS.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@
465465
4EC461B41B39360F00D08970 /* file_changeType_MODIFY@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC461B11B39360F00D08970 /* file_changeType_MODIFY@2x.png */; };
466466
4EC461B71B3939DC00D08970 /* task_activity_icon_commit_refer@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC461B51B3939DC00D08970 /* task_activity_icon_commit_refer@2x.png */; };
467467
4EC4800C1C2936DA005F1772 /* PhoneCodeButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EC4800B1C2936DA005F1772 /* PhoneCodeButton.m */; };
468+
4EC480111C2A909D005F1772 /* register_step_ed@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC4800D1C2A909D005F1772 /* register_step_ed@2x.png */; };
469+
4EC480121C2A909D005F1772 /* register_step_ed@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC4800E1C2A909D005F1772 /* register_step_ed@3x.png */; };
470+
4EC480131C2A909D005F1772 /* register_step_un@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC4800F1C2A909D005F1772 /* register_step_un@2x.png */; };
471+
4EC480141C2A909D005F1772 /* register_step_un@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC480101C2A909D005F1772 /* register_step_un@3x.png */; };
468472
4EC5AD921A258DF8006FA97C /* icon_file_cell_delete@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD8F1A258DF8006FA97C /* icon_file_cell_delete@2x.png */; };
469473
4EC5AD931A258DF8006FA97C /* icon_file_cell_move@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD901A258DF8006FA97C /* icon_file_cell_move@2x.png */; };
470474
4EC5AD941A258DF8006FA97C /* icon_file_cell_rename@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4EC5AD911A258DF8006FA97C /* icon_file_cell_rename@2x.png */; };
@@ -1728,6 +1732,10 @@
17281732
4EC461B51B3939DC00D08970 /* task_activity_icon_commit_refer@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "task_activity_icon_commit_refer@2x.png"; sourceTree = "<group>"; };
17291733
4EC4800A1C2936DA005F1772 /* PhoneCodeButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneCodeButton.h; sourceTree = "<group>"; };
17301734
4EC4800B1C2936DA005F1772 /* PhoneCodeButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneCodeButton.m; sourceTree = "<group>"; };
1735+
4EC4800D1C2A909D005F1772 /* register_step_ed@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "register_step_ed@2x.png"; sourceTree = "<group>"; };
1736+
4EC4800E1C2A909D005F1772 /* register_step_ed@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "register_step_ed@3x.png"; sourceTree = "<group>"; };
1737+
4EC4800F1C2A909D005F1772 /* register_step_un@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "register_step_un@2x.png"; sourceTree = "<group>"; };
1738+
4EC480101C2A909D005F1772 /* register_step_un@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "register_step_un@3x.png"; sourceTree = "<group>"; };
17311739
4EC5AD8F1A258DF8006FA97C /* icon_file_cell_delete@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_delete@2x.png"; sourceTree = "<group>"; };
17321740
4EC5AD901A258DF8006FA97C /* icon_file_cell_move@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_move@2x.png"; sourceTree = "<group>"; };
17331741
4EC5AD911A258DF8006FA97C /* icon_file_cell_rename@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_file_cell_rename@2x.png"; sourceTree = "<group>"; };
@@ -4370,6 +4378,10 @@
43704378
4EAC8B691BA01F190060B0FC /* little_phone_icon@2x.png */,
43714379
4E5D13161C0EF48200985AEB /* button_close@2x.png */,
43724380
4E5D13171C0EF48200985AEB /* button_close@3x.png */,
4381+
4EC4800D1C2A909D005F1772 /* register_step_ed@2x.png */,
4382+
4EC4800E1C2A909D005F1772 /* register_step_ed@3x.png */,
4383+
4EC4800F1C2A909D005F1772 /* register_step_un@2x.png */,
4384+
4EC480101C2A909D005F1772 /* register_step_un@3x.png */,
43734385
);
43744386
path = Images;
43754387
sourceTree = "<group>";
@@ -5187,6 +5199,7 @@
51875199
files = (
51885200
4E09DCA51C156387001C9392 /* hot_topic_Nav@2x.png in Resources */,
51895201
8E97CE6C1A0B243B006F9AD7 /* keyboard_add@2x.png in Resources */,
5202+
4EC480131C2A909D005F1772 /* register_step_un@2x.png in Resources */,
51905203
4E6383FD1B33C18700D98648 /* task_activity_icon_restore@2x.png in Resources */,
51915204
4E9F5D201C03051D007CCDCC /* tipIcon_tweetReward@2x.png in Resources */,
51925205
4EA6791A1A14BFA0001A0324 /* icon_file_folder_normal@2x.png in Resources */,
@@ -5331,6 +5344,7 @@
53315344
8E97CE9F1A0C7E26006F9AD7 /* coding_emoji_08@2x.png in Resources */,
53325345
4E5D130D1C0ECB3400985AEB /* tweet_btn_liked@2x.png in Resources */,
53335346
4E93F2451B85C4C300017916 /* FileInfoViewController.xib in Resources */,
5347+
4EC480141C2A909D005F1772 /* register_step_un@3x.png in Resources */,
53345348
0A782FDE1AB5B78B00E96661 /* TweetSendCreateLocationCell.xib in Resources */,
53355349
8E8F7B3219EF6306006BA8BD /* btn_privateMsg_white@2x.png in Resources */,
53365350
8E97CEBB1A0C7E26006F9AD7 /* coding_emoji_36@2x.png in Resources */,
@@ -5549,6 +5563,7 @@
55495563
4E96E7E11A1B537E0037C098 /* icon_file_ppt@2x.png in Resources */,
55505564
8EA6D16619E240C40076D59C /* nav_arrow_down@2x.png in Resources */,
55515565
D0C448141C02F76600DC1C4B /* icon_search_searchbar@2x.png in Resources */,
5566+
4EC480111C2A909D005F1772 /* register_step_ed@2x.png in Resources */,
55525567
D0C447E01C02DB8900DC1C4B /* project_normal@3x.png in Resources */,
55535568
D0C447A51C02A3C700DC1C4B /* privatemessage_normal@2x.png in Resources */,
55545569
8EA6D19819E240C40076D59C /* tipIcon_ProjectMember@2x.png in Resources */,
@@ -5595,6 +5610,7 @@
55955610
4E4D6ACB1B2571B100FD2E49 /* git_icon_stared@2x.png in Resources */,
55965611
4ED20A7A1AFCC43600C63498 /* button_download_cancel@2x.png in Resources */,
55975612
4E217F0D1A70EDC700F6DF88 /* SVWebViewController.bundle in Resources */,
5613+
4EC480121C2A909D005F1772 /* register_step_ed@3x.png in Resources */,
55985614
4E38CF641A7B8DD4005536C0 /* icon_triangle@2x.png in Resources */,
55995615
4E4D6AC81B252F4800FD2E49 /* icon_add_comment@2x.png in Resources */,
56005616
4E0022A71B7362EF005308DE /* intro_page0_ip5@2x.png in Resources */,

Coding_iOS/Controllers/Login/CannotLoginViewController.m

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ @interface CannotLoginViewController ()<UITableViewDataSource, UITableViewDelega
1616
@property (nonatomic, assign) NSUInteger stepIndex;
1717
@property (strong, nonatomic) NSString *userStr, *phoneCode, *password, *confirm_password, *j_captcha;
1818

19-
@property (strong, nonatomic) UIButton *footerBtn;
2019
@property (strong, nonatomic) TPKeyboardAvoidingTableView *myTableView;
20+
@property (strong, nonatomic) UIButton *footerBtn;
21+
@property (strong, nonatomic) NSString *phoneCodeCellIdentifier;
2122
@end
2223

2324
@implementation CannotLoginViewController
2425

25-
static NSString *kIdentifierOfPhoneCodeCell;
26-
2726
+ (instancetype)vcWithPurposeType:(PurposeType)purposeType methodType:(CannotLoginMethodType)methodType stepIndex:(NSUInteger)stepIndex userStr:(NSString *)userStr{
2827
CannotLoginViewController *vc = [self new];
2928
vc.purposeType = purposeType;
@@ -37,14 +36,14 @@ - (void)viewDidLoad
3736
[super viewDidLoad];
3837

3938
self.title = [self titleStr];
40-
kIdentifierOfPhoneCodeCell = [Input_OnlyText_Cell randomCellIdentifierOfPhoneCodeType];
39+
self.phoneCodeCellIdentifier = [Input_OnlyText_Cell randomCellIdentifierOfPhoneCodeType];
4140

4241
// 添加myTableView
4342
_myTableView = ({
4443
TPKeyboardAvoidingTableView *tableView = [[TPKeyboardAvoidingTableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
4544
[tableView registerClass:[Input_OnlyText_Cell class] forCellReuseIdentifier:kCellIdentifier_Input_OnlyText_Cell_Text];
4645
[tableView registerClass:[Input_OnlyText_Cell class] forCellReuseIdentifier:kCellIdentifier_Input_OnlyText_Cell_Captcha];
47-
[tableView registerClass:[Input_OnlyText_Cell class] forCellReuseIdentifier:kIdentifierOfPhoneCodeCell];
46+
[tableView registerClass:[Input_OnlyText_Cell class] forCellReuseIdentifier:self.phoneCodeCellIdentifier];
4847
tableView.backgroundColor = kColorTableSectionBg;
4948
tableView.dataSource = self;
5049
tableView.delegate = self;
@@ -193,7 +192,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
193192
}else{
194193
if (_medthodType == CannotLoginMethodPhone) {
195194
if (indexPath.row == 0) {
196-
cellIdentifier = kIdentifierOfPhoneCodeCell;
195+
cellIdentifier = self.phoneCodeCellIdentifier;
197196
}else if (indexPath.row <= 2){
198197
cellIdentifier = kCellIdentifier_Input_OnlyText_Cell_Text;
199198
}else{
@@ -224,9 +223,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
224223
cell.textValueChangedBlock = ^(NSString *valueStr){
225224
weakSelf.phoneCode = valueStr;
226225
};
226+
cell.phoneCodeBtnClckedBlock = ^(PhoneCodeButton *btn){
227+
[weakSelf phoneCodeBtnClicked:btn];
228+
};
227229
static bool is_first_load = true;
228230
if (is_first_load) {
229231
[cell.verify_codeBtn startUpTimer];
232+
is_first_load = false;
230233
}
231234
break;
232235
}
@@ -240,7 +243,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
240243
}
241244
case 2:{
242245
cell.textField.secureTextEntry = YES;
243-
[cell setPlaceholder:@" 重复密码" value:self.confirm_password];
246+
[cell setPlaceholder:@" 确认密码" value:self.confirm_password];
244247
cell.textValueChangedBlock = ^(NSString *valueStr){
245248
weakSelf.confirm_password = valueStr;
246249
};
@@ -278,6 +281,17 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
278281
}
279282

280283
#pragma mark Btn Clicked
284+
- (void)phoneCodeBtnClicked:(PhoneCodeButton *)sender{
285+
sender.enabled = NO;
286+
[[Coding_NetAPIManager sharedManager] request_GeneratePhoneCodeWithPhone:_userStr type:_purposeType block:^(id data, NSError *error) {
287+
if (data) {
288+
[sender startUpTimer];
289+
}else{
290+
[sender invalidateTimer];
291+
}
292+
}];
293+
}
294+
281295
- (void)footerBtnClicked:(id)sender{
282296
if (_stepIndex == 0) {
283297
if ([_userStr isPhoneNo]) {

Coding_iOS/Controllers/Login/IntroductionViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ - (void)configureTipAndTitleViewAnimations{
282282

283283
#pragma mark Action
284284
- (void)registerBtnClicked{
285-
RegisterViewController *vc = [[RegisterViewController alloc] init];
285+
RegisterViewController *vc = [RegisterViewController vcWithMethodType:RegisterMethodPhone stepIndex:0 registerObj:nil];
286286
UINavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:vc];
287287
[self presentViewController:nav animated:YES completion:nil];
288288
}

Coding_iOS/Controllers/Login/LoginViewController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,12 @@ - (void)sendLogin{
420420
NSString *global_key = error.userInfo[@"msg"][@"two_factor_auth_code_not_empty"];
421421
if (global_key.length > 0) {
422422
[weakSelf changeUITo2FAWithGK:global_key];
423+
}else if (error.userInfo[@"msg"][@"user_need_activate"]){
424+
[NSObject showError:error];
425+
Register *re = [Register new];
426+
re.phone = weakSelf.myLogin.email;
427+
RegisterViewController *vc = [RegisterViewController vcWithMethodType:RegisterMethodPhone stepIndex:2 registerObj:re];
428+
[self.navigationController pushViewController:vc animated:YES];
423429
}else{
424430
[NSObject showError:error];
425431
[weakSelf refreshCaptchaNeeded];
@@ -444,7 +450,7 @@ - (void)goToCannotLoginWithIndex:(NSInteger)index{
444450

445451

446452
- (IBAction)goRegisterVC:(id)sender {
447-
RegisterViewController *vc = [[RegisterViewController alloc] init];
453+
RegisterViewController *vc = [RegisterViewController vcWithMethodType:RegisterMethodPhone stepIndex:0 registerObj:nil];
448454
[self.navigationController pushViewController:vc animated:YES];
449455
}
450456

Coding_iOS/Controllers/Login/RegisterViewController.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
#import "BaseViewController.h"
1111
#import "Register.h"
1212

13-
@interface RegisterViewController : BaseViewController
14-
@property (nonatomic, strong) Register *myRegister;
13+
typedef NS_ENUM(NSInteger, RegisterMethodType) {
14+
RegisterMethodEamil = 0,
15+
RegisterMethodPhone
16+
};
1517

18+
@interface RegisterViewController : BaseViewController
19+
+ (instancetype)vcWithMethodType:(RegisterMethodType)methodType stepIndex:(NSUInteger)stepIndex registerObj:(Register *)obj;
1620
@end

0 commit comments

Comments
 (0)