fix 个人信息

This commit is contained in:
lianxiang
2018-09-16 13:42:55 +08:00
parent 9bba78987b
commit 718900a428
62 changed files with 17474 additions and 29 deletions
@@ -47,9 +47,13 @@
if (!currentuser) {
[self.view makeToastActivity:CSToastPositionCenter];
[[GiGaUserManager shareUser] synsisUserInfo:^(GiGaUser *user) {
[self.view hideToastActivity];
self.user = user;
[self.view hideToastActivity];
self.user = user;
} userErrorMsgBlock:^(NSDictionary *errorCodemsg) {
[self.view hideToastActivity];
GIGA_ShowToast(errorCodemsg[@"msg"]);
}];
}else{
self.user = currentuser;
@@ -12,9 +12,13 @@
#import "GIGaUserWeChatViewCell.h"
#import "GiGaUserSexViewCell.h"
#import "GIGaUserCityViewCell.h"
#import "GiGaUser.h"
#import "GiGaUserManager.h"
#import "LYSDatePickerController.h"
#import "JYAddressPicker.h"
@interface GiGaUserViewController ()
@interface GiGaUserViewController ()<LYSDatePickerSelectDelegate>
@property (nonatomic,strong) GiGaUser *user;
@end
@implementation GiGaUserViewController
@@ -24,6 +28,7 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
//self.title = @"个人中心";
self.user = [[GiGaUserManager shareUser] getCurrentUser];
[self addNavTitile:@"个人信息"];
UIButton *saveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -73,7 +78,7 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserInfoAvatorCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user:self.user];
return cell;
}else if (indexPath.section == 1 && indexPath.row < 2){
GIGaUserIDViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaUserIDViewCell"];
@@ -81,15 +86,18 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserIDViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user: self.user];
return cell;
}else if (indexPath.section == 1 && indexPath.row == 2){
GIGaUserWeChatViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaUserWeChatViewCell"];
GIGaUserWeChatViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GIGaUserWeChatViewCell"];
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserWeChatViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user:self.user];
return cell;
}else if (indexPath.section == 2 && indexPath.row == 0){
@@ -98,7 +106,13 @@
cell = [[[NSBundle mainBundle] loadNibNamed:@"GiGaUserSexViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user:self.user];
//0 女 1 男
weakify(self);
[cell userSelectSexAction:^(int sex) {
weakSelf.user.sexCode = sex;
}];
GILog(@"sex:%d",self.user.sexCode);
return cell;
}else if (indexPath.section == 2 && indexPath.row >= 1){
@@ -106,16 +120,39 @@
if(!cell){
cell = [[[NSBundle mainBundle] loadNibNamed:@"GIGaUserCityViewCell" owner:self options:nil] lastObject];
}
[cell loadCellData:indexPath user:self.user];
return cell;
}
return nil;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
GILog(@"sex:%d",self.user.sexCode);
if (indexPath.section == 2 && indexPath.row == 1) {
[LYSDatePickerController alertDatePickerWithController:self type:(LYSDatePickerTypeDay)];
[LYSDatePickerController customPickerDelegate:self];
[LYSDatePickerController customdidSelectDatePicker:^(NSDate *date) {
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy/MM/dd"];
NSString *currentDate = [dateFormat stringFromDate:date];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.detailTextLabel.text = currentDate;
}];
}else if (indexPath.section == 2 && indexPath.row == 2){
JYAddressPicker *addressPicker = [JYAddressPicker jy_showAt:self];
addressPicker.selectedItemBlock = ^(NSArray *addressArr) {
NSString *province = [addressArr objectAtIndex:0][@"text"];
NSString *city = [addressArr objectAtIndex:1][@"text"];
NSString *county = [addressArr objectAtIndex:2][@"text"];
NSString *addres = [NSString stringWithFormat:@"%@%@%@",province,city,county];
GILog(@"%@",addres);
};
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{