Skip to content

Commit 9a43eb2

Browse files
committed
账号信息 页面调整
1 parent b318bfe commit 9a43eb2

5 files changed

Lines changed: 60 additions & 20 deletions

File tree

Coding_iOS/Controllers/Login/CannotLoginViewController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ - (UIView *)customFooterView{
117117
reduce:^id(NSString *userStr){
118118
return @([userStr isEmail] || [userStr isPhoneNo]);
119119
}];
120-
121120
}else{
122121
if (_medthodType == CannotLoginMethodPhone) {
123122
RAC(self, footerBtn.enabled) = [RACSignal combineLatest:@[RACObserve(self, userStr),

Coding_iOS/Controllers/MeSetting/SettingAccountViewController.m

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#import "SettingPasswordViewController.h"
1515
#import "SettingPhoneViewController.h"
16-
16+
#import "Coding_NetAPIManager.h"
1717
#import "Login.h"
1818

1919
@interface SettingAccountViewController ()
@@ -62,36 +62,43 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
6262
}
6363

6464
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
65-
NSInteger row = (section == 0? 2: 1);
65+
NSInteger row = (section == 1? 2: 1);
6666
return row;
6767
}
6868

6969
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
7070
if (indexPath.section == 0) {
7171
TitleValueCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValue forIndexPath:indexPath];
72-
73-
switch (indexPath.row) {
74-
case 0:
75-
[cell setTitleStr:@"邮箱" valueStr:self.myUser.email];
76-
break;
77-
default:
78-
[cell setTitleStr:@"个性后缀" valueStr:self.myUser.global_key];
79-
break;
80-
}
72+
cell.selectionStyle = UITableViewCellSelectionStyleNone;
73+
[cell setTitleStr:@"个性后缀" valueStr:self.myUser.global_key];
8174
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
8275
return cell;
8376
}else if (indexPath.section == 1){
84-
TitleValueMoreCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValueMore forIndexPath:indexPath];
85-
[cell setTitleStr:@"手机号码" valueStr:self.myUser.phone.length > 0? self.myUser.phone: @"未验证"];
86-
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
87-
return cell;
77+
if (indexPath.row == 0) {
78+
if (self.myUser.email_validation.boolValue || self.myUser.email.length <= 0) {
79+
TitleValueCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValue forIndexPath:indexPath];
80+
cell.selectionStyle = UITableViewCellSelectionStyleNone;
81+
[cell setTitleStr:@"邮箱" valueStr:self.myUser.email ?: @"未绑定"];
82+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
83+
return cell;
84+
}else{
85+
TitleValueMoreCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValueMore forIndexPath:indexPath];
86+
[cell setTitleStr:@"邮箱" valueStr:[NSString stringWithFormat:@"%@(未验证)",self.myUser.email]];
87+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
88+
return cell;
89+
}
90+
}else{
91+
TitleValueMoreCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleValueMore forIndexPath:indexPath];
92+
[cell setTitleStr:@"手机号码" valueStr:self.myUser.phone ?: @"未绑定"];
93+
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
94+
return cell;
95+
}
8896
}else{
8997
TitleDisclosureCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_TitleDisclosure forIndexPath:indexPath];
9098
[cell setTitleStr:@"修改密码"];
9199
[tableView addLineforPlainCell:cell forRowAtIndexPath:indexPath withLeftSpace:kPaddingLeftWidth];
92100
return cell;
93101
}
94-
95102
}
96103
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
97104
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 20)];
@@ -110,15 +117,37 @@ - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSIntege
110117
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
111118
[tableView deselectRowAtIndexPath:indexPath animated:YES];
112119
if (indexPath.section == 1) {
113-
SettingPhoneViewController *vc = [[SettingPhoneViewController alloc] init];
114-
[self.navigationController pushViewController:vc animated:YES];
120+
if (indexPath.row == 0) {
121+
if (!self.myUser.email_validation.boolValue && self.myUser.email.length > 0) {
122+
UIAlertView *alertView = [UIAlertView bk_alertViewWithTitle:@"激活邮箱" message:@"该邮箱尚未激活,请尽快去邮箱查收邮件并激活账号。如果在收件箱中没有看到,请留意一下垃圾邮件箱子(T_T)"];
123+
[alertView bk_setCancelButtonWithTitle:@"取消" handler:nil];
124+
[alertView bk_addButtonWithTitle:@"重发激活邮件" handler:nil];
125+
[alertView bk_setDidDismissBlock:^(UIAlertView *alert, NSInteger index) {
126+
if (index == 1) {
127+
[self sendActivateEmail];
128+
}
129+
}];
130+
[alertView show];
131+
}
132+
}else{
133+
SettingPhoneViewController *vc = [[SettingPhoneViewController alloc] init];
134+
[self.navigationController pushViewController:vc animated:YES];
135+
}
115136
}else if (indexPath.section == 2){
116137
SettingPasswordViewController *vc = [[SettingPasswordViewController alloc] init];
117138
vc.myUser = self.myUser;
118139
[self.navigationController pushViewController:vc animated:YES];
119140
}
120141
}
121142

143+
- (void)sendActivateEmail{
144+
[[Coding_NetAPIManager sharedManager] request_SendActivateEmail:self.myUser.email block:^(id data, NSError *error) {
145+
if (data) {
146+
[NSObject showHudTipStr:@"邮件已发送"];
147+
}
148+
}];
149+
}
150+
122151
- (void)dealloc
123152
{
124153
_myTableView.delegate = nil;

Coding_iOS/Models/User.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@property (readwrite, nonatomic, strong) NSString *avatar, *name, *global_key, *path, *slogan, *company, *tags_str, *tags, *location, *job_str, *job, *email, *birthday, *pinyinName;
1313
@property (readwrite, nonatomic, strong) NSString *curPassword, *resetPassword, *resetPasswordConfirm, *phone, *introduction;
1414

15-
@property (readwrite, nonatomic, strong) NSNumber *id, *sex, *follow, *followed, *fans_count, *follows_count, *tweets_count, *status, *points_left, *email_validation;
15+
@property (readwrite, nonatomic, strong) NSNumber *id, *sex, *follow, *followed, *fans_count, *follows_count, *tweets_count, *status, *points_left, *email_validation, *is_phone_validated;
1616
@property (readwrite, nonatomic, strong) NSDate *created_at, *last_logined_at, *last_activity_at, *updated_at;
1717

1818
+ (User *)userWithGlobalKey:(NSString *)global_key;

Coding_iOS/Util/Manager/Coding_NetAPIManager.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ typedef NS_ENUM(NSInteger, PurposeType) {
7373
- (void)request_SetPasswordWithEmail:(NSString *)email captcha:(NSString *)captcha type:(PurposeType)type block:(void (^)(id data, NSError *error))block;
7474
- (void)request_ActivateByPhone:(NSString *)phone setEmail:(NSString *)email global_key:(NSString *)global_key block:(void (^)(id data, NSError *error))block;
7575
- (void)request_ActivateBySetGlobal_key:(NSString *)global_key block:(void (^)(id data, NSError *error))block;
76+
- (void)request_SendActivateEmail:(NSString *)email block:(void (^)(id data, NSError *error))block;
7677

7778
#pragma mark - Project
7879
- (void)request_Projects_WithObj:(Projects *)projects andBlock:(void (^)(Projects *data, NSError *error))block;

Coding_iOS/Util/Manager/Coding_NetAPIManager.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ - (void)request_ActivateBySetGlobal_key:(NSString *)global_key block:(void (^)(i
309309
}
310310
}];
311311
}
312+
- (void)request_SendActivateEmail:(NSString *)email block:(void (^)(id data, NSError *error))block{
313+
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:@"api/account/register/email/send" withParams:@{@"email": email} withMethodType:Post andBlock:^(id data, NSError *error) {
314+
if (data) {
315+
[MobClick event:kUmeng_Event_Request_ActionOfServer label:@"激活账号_重发激活邮件"];
316+
317+
block(data, nil);
318+
}else{
319+
block(nil, error);
320+
}
321+
}];
322+
}
312323
#pragma mark Project
313324
- (void)request_Projects_WithObj:(Projects *)projects andBlock:(void (^)(Projects *data, NSError *error))block{
314325
projects.isLoading = YES;

0 commit comments

Comments
 (0)