Skip to content

Commit 8ada80a

Browse files
committed
done
1 parent e547c0f commit 8ada80a

7 files changed

Lines changed: 31 additions & 3 deletions

File tree

Coding_iOS/Controllers/Login/LoginViewController.m

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import <NYXImagesKit/NYXImagesKit.h>
1616
#import <UIImage+BlurredFrame/UIImage+BlurredFrame.h>
1717
#import <Masonry/Masonry.h>
18+
#import <SDWebImage/UIImageView+WebCache.h>
1819

1920

2021
@interface LoginViewController ()
@@ -151,6 +152,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
151152
cell.textField.secureTextEntry = NO;
152153
cell.textValueChangedBlock = ^(NSString *valueStr){
153154
weakSelf.myLogin.email = valueStr;
155+
[weakSelf.iconUserView setImage:[UIImage imageNamed:@"icon_user_monkey"]];
156+
};
157+
cell.editDidEndBlock = ^(NSString *textStr){
158+
[weakSelf refreshIconUserImage:textStr];
154159
};
155160
}else if (indexPath.row == 1){
156161
cell.isCaptcha = NO;
@@ -159,24 +164,39 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
159164
cell.textValueChangedBlock = ^(NSString *valueStr){
160165
weakSelf.myLogin.password = valueStr;
161166
};
167+
cell.editDidEndBlock = nil;
162168
}else{
163169
cell.isCaptcha = YES;
164170
[cell configWithPlaceholder:@" 验证码" andValue:self.myLogin.j_captcha];
165171
cell.textField.secureTextEntry = NO;
166172
cell.textValueChangedBlock = ^(NSString *valueStr){
167173
weakSelf.myLogin.j_captcha = valueStr;
168174
};
175+
cell.editDidEndBlock = nil;
169176
}
170177
return cell;
171178
}
172179

180+
- (void)refreshIconUserImage:(NSString *)textStr{
181+
if (textStr) {
182+
User *curUser = [Login userWithGlobaykeyOrEmail:textStr];
183+
if (curUser && curUser.avatar) {
184+
[self.iconUserView sd_setImageWithURL:[curUser.avatar urlImageWithCodePathResizeToView:self.iconUserView] placeholderImage:[UIImage imageNamed:@"icon_user_monkey"]];
185+
}
186+
}
187+
}
188+
173189
#pragma mark - Table view Header Footer
174190
- (UIView *)customHeaderView{
175191
UIView *headerV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, 220)];
176192

177193
_iconUserView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)];
178194
_iconUserView.contentMode = UIViewContentModeScaleAspectFit;
179-
[_iconUserView doCircleFrame];
195+
_iconUserView.layer.masksToBounds = YES;
196+
_iconUserView.layer.cornerRadius = _iconUserView.frame.size.width/2;
197+
_iconUserView.layer.borderWidth = 2;
198+
_iconUserView.layer.borderColor = [UIColor whiteColor].CGColor;
199+
180200

181201
[headerV addSubview:_iconUserView];
182202
[_iconUserView mas_makeConstraints:^(MASConstraintMaker *make) {

Coding_iOS/Controllers/ProjectMemberListViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ - (void)loadView{
8282
if (_type == ProMemTypeAT) {
8383
__weak typeof(self) weakSelf = self;
8484
//首先尝试加载本地数据,无数据的情况下才去服务器请求
85-
id resultData = [self loadResponseWithPath:[_myProject localMembersPath]];
85+
id resultData = [NSObject loadResponseWithPath:[_myProject localMembersPath]];
8686
resultData = [resultData objectForKey:@"list"];
8787

8888
if (resultData) {

Coding_iOS/Controllers/UsersViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ - (void)loadView{
120120
}];
121121
if (_curUsers.type == UsersTypeFriends_At || _curUsers.type == UsersTypeFriends_Transpond) {
122122
//首先尝试加载本地数据,无数据的情况下才去服务器请求
123-
id resultData = [self loadResponseWithPath:[[Login curLoginUser] localFriendsPath]];
123+
id resultData = [NSObject loadResponseWithPath:[[Login curLoginUser] localFriendsPath]];
124124
if (resultData) {
125125
Users *users = [NSObject objectOfClass:@"Users" fromJSON:resultData];
126126
[self.curUsers configWithObj:users];

Coding_iOS/Models/Login.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
+ (void)addUmengAliasWithCurUser:(BOOL)add;
2424
+ (void)setXGAccountWithCurUser;
2525
+ (BOOL)isOwnerOfProjectWithOwnerId:(NSNumber *)owner_id;
26+
+ (User *)userWithGlobaykeyOrEmail:(NSString *)textStr;
2627
@end

Coding_iOS/Models/Login.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ + (BOOL)saveLoginData:(NSDictionary *)loginData{
101101
[loginDataList setObject:loginData forKey:curUser.email];
102102
saved = YES;
103103
}
104+
if (saved) {
105+
saved = [NSObject saveResponseData:loginDataList toPath:kLoginDataListPath];
106+
}
104107
}
105108
return saved;
106109
}

Coding_iOS/Views/Cell/Input_OnlyText_Cell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@property (weak, nonatomic) IBOutlet UIButton *clearBtn;
1919

2020
@property (nonatomic,copy) void(^textValueChangedBlock)(NSString*);
21+
@property (nonatomic,copy) void(^editDidEndBlock)(NSString*);
2122

2223
- (IBAction)editDidBegin:(id)sender;
2324
- (IBAction)editDidEnd:(id)sender;

Coding_iOS/Views/Cell/Input_OnlyText_Cell.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ - (IBAction)editDidEnd:(id)sender {
3939
[self.textField setValue:[UIColor colorWithHexString:@"0xffffff" andAlpha:0.5] forKeyPath:@"_placeholderLabel.textColor"];//修改placeholder颜色
4040
_lineView.backgroundColor = [UIColor colorWithHexString:@"0xffffff" andAlpha:0.5];
4141
self.clearBtn.hidden = YES;
42+
if (self.editDidEndBlock) {
43+
self.editDidEndBlock(self.textField.text);
44+
}
4245
}
4346

4447
- (void)configWithPlaceholder:(NSString *)phStr andValue:(NSString *)valueStr{

0 commit comments

Comments
 (0)