This commit is contained in:
2025-12-03 20:31:33 +08:00
parent 9651ae7ad7
commit 819d74cc8d
6 changed files with 19 additions and 4 deletions

View File

@@ -21,6 +21,8 @@
@property (nonatomic, strong) UIImageView *cardLeft; @property (nonatomic, strong) UIImageView *cardLeft;
@property (nonatomic, strong) UIImageView *cardRight; @property (nonatomic, strong) UIImageView *cardRight;
@property (nonatomic, strong) UIImageView *avatarEditIcon; // @property (nonatomic, strong) UIImageView *avatarEditIcon; //
@property (nonatomic, strong) KBUser *userModel;
@end @end
@implementation KBMyHeaderView @implementation KBMyHeaderView
@@ -91,6 +93,7 @@
- (void)configureWithUser:(KBUser *)user { - (void)configureWithUser:(KBUser *)user {
// Settings // Settings
self.userModel = user;
NSString *name = user.nickName; NSString *name = user.nickName;
if (name.length == 0) { if (name.length == 0) {
name = KBLocalized(@"Settings"); name = KBLocalized(@"Settings");
@@ -224,6 +227,7 @@
} }
- (void)onAvatarTap { - (void)onAvatarTap {
KBPersonInfoVC *vc = [[KBPersonInfoVC alloc] init]; KBPersonInfoVC *vc = [[KBPersonInfoVC alloc] init];
vc.userModel = self.userModel;
[KB_CURRENT_NAV pushViewController:vc animated:true]; [KB_CURRENT_NAV pushViewController:vc animated:true];
} }
- (void)onLeftCardTap { - (void)onLeftCardTap {

View File

@@ -6,10 +6,12 @@
// 个人资料 // 个人资料
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "KBUser.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface KBPersonInfoVC : BaseViewController @interface KBPersonInfoVC : BaseViewController
@property (nonatomic, strong) KBUser *userModel;
@end @end

View File

@@ -51,9 +51,9 @@
// //
self.items = @[ 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(@"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]; [self.view addSubview:self.tableView];
@@ -80,6 +80,12 @@
self.tableView.contentInset = inset; 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 #pragma mark - UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }

View File

@@ -13,7 +13,7 @@
@implementation KBMyVM @implementation KBMyVM
- (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion { - (void)fetchUserDetailWithCompletion:(KBMyUserDetailCompletion)completion {
[KBHUD show]; // [KBHUD show];
[[KBNetworkManager shared] GET:KB_API_USER_DETAIL [[KBNetworkManager shared] GET:KB_API_USER_DETAIL
parameters:nil parameters:nil
headers:nil headers:nil

View File

@@ -43,10 +43,11 @@ NSErrorDomain const KBNetworkErrorDomain = @"com.company.keyboard.network";
_timeout = 10.0; _timeout = 10.0;
// Accept + 使 Accept-Language // Accept + 使 Accept-Language
NSString *lang = [KBLocalizationManager shared].currentLanguageCode ?: KBLanguageCodeEnglish; NSString *lang = [KBLocalizationManager shared].currentLanguageCode ?: KBLanguageCodeEnglish;
NSString *token = [KBUserSessionManager shared].accessToken ? [KBUserSessionManager shared].accessToken : @"";
_defaultHeaders = @{ _defaultHeaders = @{
@"Accept": @"*/*", @"Accept": @"*/*",
@"Accept-Language": lang, @"Accept-Language": lang,
@"auth-token" : @"" @"auth-token" : token
}; };
// //
_baseURL = [NSURL URLWithString:KB_BASE_URL]; _baseURL = [NSURL URLWithString:KB_BASE_URL];

View File

@@ -37,6 +37,8 @@
#import "UIView+KBShadow.h" #import "UIView+KBShadow.h"
#import "UIImage+KBColor.h" #import "UIImage+KBColor.h"
#import "UIColor+Extension.h" #import "UIColor+Extension.h"
#import "UIImageView+KBWebImage.h"
#import "UIViewController+Extension.h" #import "UIViewController+Extension.h"
#import "BaseNavigationController.h" #import "BaseNavigationController.h"