fix 个人信息
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@property(nonatomic,copy) NSString *occupationCode;
|
||||
@property(nonatomic,copy) NSString *provinceId;
|
||||
@property(nonatomic,copy) NSString *provinceName;
|
||||
@property(nonatomic,copy) NSString *sexCode;
|
||||
@property(nonatomic,assign) int sexCode;
|
||||
@property(nonatomic,copy) NSString *sexName;
|
||||
@property(nonatomic,copy) NSString *weixin;
|
||||
|
||||
|
||||
@@ -9,5 +9,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface GIGaUserCityViewCell : UITableViewCell
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *cityLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *detalTitle;
|
||||
|
||||
@end
|
||||
|
||||
@@ -15,6 +15,33 @@
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user{
|
||||
if (indexPath.section == 2 && indexPath.row == 1) {
|
||||
self.cityLabel.text = @"生日";
|
||||
if (user.birthday && ![user.birthday isKindOfClass:[NSNull class]]) {
|
||||
self.detalTitle.text = user.birthday;
|
||||
}else{
|
||||
self.detalTitle.text = @"选择生日";
|
||||
}
|
||||
|
||||
}else if (indexPath.section == 2 && indexPath.row == 2){
|
||||
self.cityLabel.text = @"城市";
|
||||
if (user.cityName && ![user.cityName isKindOfClass:[NSNull class]]) {
|
||||
self.detalTitle.text = user.cityName;
|
||||
}else{
|
||||
self.detalTitle.text = @"选择城市";
|
||||
}
|
||||
}else if (indexPath.section == 2 && indexPath.row == 3){
|
||||
self.cityLabel.text = @"职业";
|
||||
if (user.occupationCode && ![user.occupationCode isKindOfClass:[NSNull class]]) {
|
||||
self.detalTitle.text = user.occupationCode;
|
||||
}else{
|
||||
self.detalTitle.text = @"选择职业";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
|
||||
@@ -59,7 +59,11 @@
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<point key="canvasLocation" x="33.5" y="68"/>
|
||||
<connections>
|
||||
<outlet property="cityLabel" destination="OA0-rJ-5qY" id="sFb-nt-6vY"/>
|
||||
<outlet property="detalTitle" destination="y6H-zg-4yv" id="Yhl-Hx-EGv"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-41" y="69"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
@@ -9,5 +9,8 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface GIGaUserIDViewCell : UITableViewCell
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *IdLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *userTitle;
|
||||
|
||||
@end
|
||||
|
||||
@@ -14,7 +14,22 @@
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)loadCellData:(NSIndexPath *)indexPath user:(GiGaUser*)user{
|
||||
|
||||
if (indexPath.section == 1 && indexPath.row == 0 ) {
|
||||
|
||||
self.IdLabel.text = user.userId;
|
||||
self.userTitle.text = @"用户ID";
|
||||
|
||||
}else if (indexPath.section == 1 && indexPath.row == 1){
|
||||
self.userTitle.text = @"昵称";
|
||||
if (user.nickName && ![user.nickName isKindOfClass:[NSNull class]]) {
|
||||
self.IdLabel.text = user.nickName;
|
||||
}else{
|
||||
self.IdLabel.text = @"昵称";
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="IdLabel" destination="4Oa-fe-SvG" id="zho-2s-rPC"/>
|
||||
<outlet property="userTitle" destination="HzQ-bQ-e0n" id="kPd-kc-XZU"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="33.5" y="68"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
|
||||
@@ -9,5 +9,6 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface GIGaUserInfoAvatorCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userAvator;
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user;
|
||||
@end
|
||||
|
||||
@@ -7,12 +7,22 @@
|
||||
//
|
||||
|
||||
#import "GIGaUserInfoAvatorCell.h"
|
||||
#import "UIImageView+WebCache.h"
|
||||
|
||||
@implementation GIGaUserInfoAvatorCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
self.userAvator.layer.masksToBounds = YES;
|
||||
self.userAvator.layer.cornerRadius = self.userAvator.frame.size.height /2 ;
|
||||
|
||||
}
|
||||
- (void)loadCellData:(NSIndexPath *)indexPath user:(GiGaUser *)user{
|
||||
if (user.headImgUrl && ![user.headImgUrl isKindOfClass:[NSNull class]]) {
|
||||
[self.userAvator sd_setImageWithURL:[NSURL URLWithString:user.headImgUrl]];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<constraint firstAttribute="height" constant="82" id="ipN-ci-Ha3"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" 用户名" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bZT-xd-Nax">
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" 点击修改头像" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bZT-xd-Nax">
|
||||
<rect key="frame" x="16" y="106" width="343" height="16"/>
|
||||
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="11"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
@@ -43,6 +43,9 @@
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" red="0.51372549020000002" green="0.039215686270000001" blue="0.039215686270000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="userAvator" destination="L0Q-5Y-jXq" id="IIT-bz-CcZ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="9.5" y="62.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
|
||||
@interface GIGaUserWeChatViewCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UITextField *weiXinCount;
|
||||
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user;
|
||||
@end
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
// Initialization code
|
||||
|
||||
}
|
||||
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user{
|
||||
|
||||
if (user.weixin && ![user.weixin isKindOfClass:[NSNull class]]) {
|
||||
self.weiXinCount.text = user.weixin;
|
||||
}
|
||||
|
||||
}
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
|
||||
@@ -8,8 +8,14 @@
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef void (^femaleBtnAction)(int sex);
|
||||
|
||||
@interface GiGaUserSexViewCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIButton *usefemale;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *usermale;
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user;
|
||||
-(void)userSelectSexAction:(femaleBtnAction)block;
|
||||
@property (nonatomic,copy) femaleBtnAction actionblock;
|
||||
-(void)configUserSex:(int)sex;
|
||||
|
||||
@end
|
||||
|
||||
@@ -13,8 +13,39 @@
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
[self.usermale addTarget:self action:@selector(usermaleClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.usefemale addTarget:self action:@selector(userfemaleClick) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
-(void)loadCellData:(NSIndexPath*)indexPath user:(GiGaUser*)user{
|
||||
|
||||
int sex = user.sexCode;
|
||||
[self configUserSex:sex];
|
||||
|
||||
}
|
||||
|
||||
-(void)configUserSex:(int)sex{
|
||||
|
||||
if (sex == 0) {
|
||||
[self.usefemale setImage:[UIImage imageNamed:@"sex_selected"] forState:UIControlStateNormal];
|
||||
[self.usermale setImage:[UIImage imageNamed:@"sex_disselect"] forState:UIControlStateNormal];
|
||||
}else{
|
||||
[self.usermale setImage:[UIImage imageNamed:@"sex_selected"] forState:UIControlStateNormal];
|
||||
[self.usefemale setImage:[UIImage imageNamed:@"sex_disselect"] forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
}
|
||||
-(void)usermaleClick{
|
||||
self.actionblock(1);
|
||||
[self configUserSex:1];
|
||||
}
|
||||
|
||||
-(void)userfemaleClick{
|
||||
self.actionblock(0);
|
||||
[self configUserSex:0];
|
||||
}
|
||||
-(void)userSelectSexAction:(femaleBtnAction)block{
|
||||
self.actionblock = block;
|
||||
}
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user