Steven 5 years ago
parent
commit
1380efac1b

+ 7 - 4
MusicGradeExam/MusicGradeExam/UI/UserCenter/Controller/Mine/Controller/UserViewController.m

@@ -163,13 +163,16 @@
         [self removehub];
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             UserInfo *info = USER_MANAGER.userInfo;
-            info.realName = realName;
-            info.idCardNo = idCardNo;
-            info.nation = nation;
-            info.birthdate = [[dic dictionaryValueForKey:@"data"] stringValueForKey:@"birthdate"];
+            
             if (![NSString isEmptyString:avatar]) {
                 info.avatar = avatar;
             }
+            else {
+                info.realName = realName;
+                info.idCardNo = idCardNo;
+                info.nation = nation;
+                info.birthdate = [[dic dictionaryValueForKey:@"data"] stringValueForKey:@"birthdate"];
+            }
             [self.bodyView refreshView];
         }
         else {

+ 7 - 0
MusicGradeExam/MusicGradeExam/UI/UserCenter/View/UserCenterBodyView.m

@@ -11,6 +11,7 @@
 @interface UserCenterBodyView ()
 
 @property (nonatomic, copy) UserCenterAction callback;
+@property (weak, nonatomic) IBOutlet UIImageView *userAvatar;
 
 @end
 
@@ -24,6 +25,12 @@
 - (void)configMessage {
     UserInfo *info = USER_MANAGER.userInfo;
     self.userName.text = [NSString returnNoNullStringWithString:info.realName];
+    if ([NSString isEmptyString:info.avatar]) {
+        [self.userAvatar setImage:[UIImage imageNamed:USER_LOGO]];
+    }
+    else {
+        [self.userAvatar sd_setImageWithURL:[NSURL URLWithString:info.avatar] placeholderImage:[UIImage imageNamed:USER_LOGO]];
+    }
     if ([NSString isEmptyString:info.birthdate]) {
         self.birthday.text = @"";
         self.userNation.text = @"";

+ 1 - 0
MusicGradeExam/MusicGradeExam/UI/UserCenter/View/UserCenterBodyView.xib

@@ -263,6 +263,7 @@
             <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
             <connections>
                 <outlet property="birthday" destination="85j-TL-W3B" id="JqE-lM-bpe"/>
+                <outlet property="userAvatar" destination="7Aj-mc-w5i" id="3gu-25-4Tg"/>
                 <outlet property="userName" destination="br8-HA-xec" id="2dW-5g-Pg6"/>
                 <outlet property="userNation" destination="DTT-Zs-WXV" id="8yf-dZ-jrc"/>
                 <outlet property="userSex" destination="1Jk-n0-UV8" id="Npf-CP-18x"/>