Showing
1 changed file
with
12 additions
and
15 deletions
@@ -137,10 +137,7 @@ const getUserInfo = (channel, uid) => { | @@ -137,10 +137,7 @@ const getUserInfo = (channel, uid) => { | ||
137 | } | 137 | } |
138 | 138 | ||
139 | if (result[1].code === 200) { | 139 | if (result[1].code === 200) { |
140 | - let email, | ||
141 | - nickname, | ||
142 | - username, | ||
143 | - gender, | 140 | + let gender, |
144 | genderArr, | 141 | genderArr, |
145 | birthday, | 142 | birthday, |
146 | birthdayJson, | 143 | birthdayJson, |
@@ -152,14 +149,14 @@ const getUserInfo = (channel, uid) => { | @@ -152,14 +149,14 @@ const getUserInfo = (channel, uid) => { | ||
152 | income, | 149 | income, |
153 | incomeArr; | 150 | incomeArr; |
154 | 151 | ||
155 | - userInfo = result[1].data; | ||
156 | - email = userInfo.email !== undefined ? userInfo.email : ''; | ||
157 | - nickname = userInfo.nickname !== undefined ? userInfo.nickname : ''; | ||
158 | - username = userInfo.username !== undefined ? userInfo.username : ''; | ||
159 | - gender = userInfo.gender !== undefined ? userInfo.gender : 3; | ||
160 | - birthday = userInfo.birthday !== undefined ? userInfo.birthday : ''; | ||
161 | - profession = userInfo.profession !== undefined ? userInfo.profession : 0; | ||
162 | - income = userInfo.income !== undefined ? userInfo.income : 0; | 152 | + userInfo = result[1].data || {}; |
153 | + | ||
154 | + if (userInfo) { | ||
155 | + gender = userInfo.gender || 3; | ||
156 | + birthday = userInfo.birthday || ''; | ||
157 | + profession = userInfo.profession || 0; | ||
158 | + income = userInfoincome !== undefined ? userInfo.income : 0; | ||
159 | + } | ||
163 | 160 | ||
164 | genderArr = configData.gender; | 161 | genderArr = configData.gender; |
165 | for (let value of genderArr) { | 162 | for (let value of genderArr) { |
@@ -194,18 +191,18 @@ const getUserInfo = (channel, uid) => { | @@ -194,18 +191,18 @@ const getUserInfo = (channel, uid) => { | ||
194 | profileSrc: userInfo.head_ico, | 191 | profileSrc: userInfo.head_ico, |
195 | email: { | 192 | email: { |
196 | labelText: '登录邮箱:', | 193 | labelText: '登录邮箱:', |
197 | - value: email | 194 | + value: userInfo.email || '' |
198 | }, | 195 | }, |
199 | name: [ | 196 | name: [ |
200 | { | 197 | { |
201 | labelText: '昵称:', | 198 | labelText: '昵称:', |
202 | - value: nickname, | 199 | + value: userInfo.nickname, |
203 | key: 'nickname', | 200 | key: 'nickname', |
204 | tips: '与Yoho!业务或商家品牌冲突的昵称,Yoho!将有可能收回' | 201 | tips: '与Yoho!业务或商家品牌冲突的昵称,Yoho!将有可能收回' |
205 | }, | 202 | }, |
206 | { | 203 | { |
207 | labelText: '真实姓名:', | 204 | labelText: '真实姓名:', |
208 | - value: username, | 205 | + value: userInfo.username, |
209 | key: 'username', | 206 | key: 'username', |
210 | tips: '' // 4.8去掉该提示 | 207 | tips: '' // 4.8去掉该提示 |
211 | } | 208 | } |
-
Please register or login to post a comment