Browse Source

头像字段问题

桂欢 1 year ago
parent
commit
9f6682effa

+ 1 - 1
SLAiELTS/SLAiELTS/ViewControllers/LoginVC/Models/SLUserModel.m

@@ -57,7 +57,7 @@
 }
 
 - (NSString *)getUserHeadUrl {
-    NSString *userImg = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl, self.head];
+    NSString *userImg = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl, self.userHead];
     return userImg;
 }
 

+ 4 - 3
SLAiELTS/SLAiELTS/ViewControllers/Moments/MomentsVc/SLMomentsVc.m

@@ -61,9 +61,6 @@ static CGFloat textFieldH = 56;
         self.userModel = [SLGlobalInfo SharedInstance].loginInfo.user;
     }
     SDTimeLineTableHeaderView *headerView = [[SDTimeLineTableHeaderView alloc] initWithFrame:CGRectMake(0, 0, 0, 220 * KScaleW)];
-    if (self.isFriendList) {
-        [headerView confignHeaderWith:self.userModel];
-    }
     self.tableView.tableHeaderView = headerView;
     self.tableView.tableHeaderView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, 250 * KScaleW);
     //添加分隔线颜色设置
@@ -105,6 +102,10 @@ static CGFloat textFieldH = 56;
 }
 - (void)viewWillAppear:(BOOL)animated {
     [super viewWillAppear:animated];
+    if ([self.tableView.tableHeaderView isKindOfClass:SDTimeLineTableHeaderView.class]) {
+        SDTimeLineTableHeaderView *headerView = (SDTimeLineTableHeaderView *)self.tableView.tableHeaderView;
+        [headerView confignHeaderWith:self.userModel];
+    }
     if (self.tableView.contentOffset.y < 300 && !self.tableView.mj_header.refreshing) {
         [self.tableView.mj_header beginRefreshing];
     }

+ 7 - 7
SLAiELTS/SLAiELTS/ViewControllers/Moments/Views/HeaderView/SDTimeLineTableHeaderView.m

@@ -63,14 +63,14 @@
     [self addSubview:_backgroundImageView];
     
     _iconView = [UIImageView new];
-    NSString *urlStr = [[SLGlobalInfo SharedInstance].loginInfo.user getUserHeadUrl];
-    [_iconView sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:ImageName(@"icon_ellipse")];
+//    NSString *urlStr = [[SLGlobalInfo SharedInstance].loginInfo.user getUserHeadUrl];
+//    [_iconView sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:ImageName(@"icon_ellipse")];
     [self addSubview:_iconView];
-    
-    WS(weakSelf);
-    [self.KVOController observe:[SLGlobalInfo SharedInstance] keyPath:@"loginInfo" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
-        [weakSelf setHeaderWithLoginInfo];
-    }];
+//    
+//    WS(weakSelf);
+//    [self.KVOController observe:[SLGlobalInfo SharedInstance] keyPath:@"loginInfo" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
+//        [weakSelf setHeaderWithLoginInfo];
+//    }];
     
     _nameLabel = [UILabel new];
     SLLoginInfo *targetModel = [SLGlobalInfo SharedInstance].loginInfo;