diff --git a/keyBoard/Class/Me/V/KBMyHeaderView.m b/keyBoard/Class/Me/V/KBMyHeaderView.m index f3db9ac..398cfd2 100644 --- a/keyBoard/Class/Me/V/KBMyHeaderView.m +++ b/keyBoard/Class/Me/V/KBMyHeaderView.m @@ -21,6 +21,8 @@ @property (nonatomic, strong) UIImageView *cardLeft; @property (nonatomic, strong) UIImageView *cardRight; @property (nonatomic, strong) UIImageView *avatarEditIcon; // 头像右下角的编辑图标 +@property (nonatomic, strong) KBUser *userModel; + @end @implementation KBMyHeaderView @@ -91,6 +93,7 @@ - (void)configureWithUser:(KBUser *)user { // 名称:优先昵称,兜底展示本地化的“Settings”或固定提示 + self.userModel = user; NSString *name = user.nickName; if (name.length == 0) { name = KBLocalized(@"Settings"); @@ -224,6 +227,7 @@ } - (void)onAvatarTap { KBPersonInfoVC *vc = [[KBPersonInfoVC alloc] init]; + vc.userModel = self.userModel; [KB_CURRENT_NAV pushViewController:vc animated:true]; } - (void)onLeftCardTap { diff --git a/keyBoard/Class/Me/VC/KBPersonInfoVC.h b/keyBoard/Class/Me/VC/KBPersonInfoVC.h index dcf3a5f..96129bd 100644 --- a/keyBoard/Class/Me/VC/KBPersonInfoVC.h +++ b/keyBoard/Class/Me/VC/KBPersonInfoVC.h @@ -6,10 +6,12 @@ // 个人资料 #import +#import "KBUser.h" NS_ASSUME_NONNULL_BEGIN @interface KBPersonInfoVC : BaseViewController +@property (nonatomic, strong) KBUser *userModel; @end diff --git a/keyBoard/Class/Me/VC/KBPersonInfoVC.m b/keyBoard/Class/Me/VC/KBPersonInfoVC.m index 42d593b..fb32a57 100644 --- a/keyBoard/Class/Me/VC/KBPersonInfoVC.m +++ b/keyBoard/Class/Me/VC/KBPersonInfoVC.m @@ -51,9 +51,9 @@ // 构造数据 self.items = @[ - @{ @"title": KBLocalized(@"Nickname"), @"value": @"Nickname", @"arrow": @YES, @"copy": @NO }, + @{ @"title": KBLocalized(@"Nickname"), @"value": @"", @"arrow": @YES, @"copy": @NO }, @{ @"title": KBLocalized(@"Gender"), @"value": @"Choose", @"arrow": @YES, @"copy": @NO }, - @{ @"title": KBLocalized(@"User ID"), @"value": @"8888888", @"arrow": @NO, @"copy": @YES }, + @{ @"title": KBLocalized(@"User ID"), @"value": @"", @"arrow": @NO, @"copy": @YES }, ]; [self.view addSubview:self.tableView]; @@ -80,6 +80,12 @@ self.tableView.contentInset = inset; } +- (void)setUserModel:(KBUser *)userModel{ + _userModel = userModel; + [self.avatarView kb_setAvatarURL:userModel.avatarUrl placeholder:KBPlaceholderImage]; + self.modifyLabel.text = userModel.nickName; +} + #pragma mark - UITableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } diff --git a/keyBoard/Class/Me/VM/KBMyVM.m b/keyBoard/Class/Me/VM/KBMyVM.m index 94e7ba7..79f01c7 100644 --- a/keyBoard/Class/Me/VM/KBMyVM.m +++ b/keyBoard/Class/Me/VM/KBMyVM.m @@ -13,7 +13,7 @@ @implementation KBMyVM - (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion { - [KBHUD show]; +// [KBHUD show]; [[KBNetworkManager shared] GET:KB_API_USER_DETAIL parameters:nil headers:nil diff --git a/keyBoard/Class/Network/KBNetworkManager.m b/keyBoard/Class/Network/KBNetworkManager.m index 9dd4781..b2e4148 100644 --- a/keyBoard/Class/Network/KBNetworkManager.m +++ b/keyBoard/Class/Network/KBNetworkManager.m @@ -43,10 +43,11 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network"; _timeout = 10.0; // 默认请求头:Accept 任意类型 + 使用项目多语言管理器设置 Accept-Language NSString *lang = [KBLocalizationManager shared].currentLanguageCode ?: KBLanguageCodeEnglish; + NSString *token = [KBUserSessionManager shared].accessToken ? [KBUserSessionManager shared].accessToken : @""; _defaultHeaders = @{ @"Accept": @"*/*", @"Accept-Language": lang, - @"auth-token" : @"" + @"auth-token" : token }; // 设置基础域名,路径可相对该地址拼接 _baseURL = [NSURL URLWithString:KB_BASE_URL]; diff --git a/keyBoard/KeyBoardPrefixHeader.pch b/keyBoard/KeyBoardPrefixHeader.pch index 30c7571..082f974 100644 --- a/keyBoard/KeyBoardPrefixHeader.pch +++ b/keyBoard/KeyBoardPrefixHeader.pch @@ -37,6 +37,8 @@ #import "UIView+KBShadow.h" #import "UIImage+KBColor.h" #import "UIColor+Extension.h" +#import "UIImageView+KBWebImage.h" + #import "UIViewController+Extension.h" #import "BaseNavigationController.h"