验证20%
This commit is contained in:
@@ -155,6 +155,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
function setProfileLoadStatus(message) {
|
||||
var statusNode = query('[data-profile-load-status]');
|
||||
|
||||
if (statusNode) statusNode.textContent = message || '';
|
||||
}
|
||||
|
||||
function buildUnavailableProfileView() {
|
||||
return {
|
||||
displayName: '账户资料暂时无法读取',
|
||||
avatarText: '!',
|
||||
phone: '暂无数据',
|
||||
birthday: '暂无数据',
|
||||
regionText: '暂无数据'
|
||||
};
|
||||
}
|
||||
|
||||
function getFormValues(form) {
|
||||
var values = {};
|
||||
|
||||
@@ -236,6 +252,7 @@
|
||||
|
||||
if (!api || !documentRef || !documentRef.querySelector('[data-profile-page]')) return;
|
||||
if (redirectUnauthorized(api)) return;
|
||||
setProfileLoadStatus('正在读取账户资料…');
|
||||
|
||||
try {
|
||||
profile = await api.currentProfile();
|
||||
@@ -244,8 +261,11 @@
|
||||
fillProfileForm(profile);
|
||||
fillRegionPicker(profile);
|
||||
renderRegionText(profile, requestId);
|
||||
setProfileLoadStatus('');
|
||||
} catch (error) {
|
||||
if (redirectUnauthorized(api, error)) return;
|
||||
renderProfile(buildUnavailableProfileView());
|
||||
setProfileLoadStatus('资料读取失败,请刷新页面后重试。');
|
||||
showMessage(error.message || '个人资料加载失败');
|
||||
}
|
||||
}
|
||||
@@ -293,6 +313,7 @@
|
||||
getFinalRegionCode: getFinalRegionCode,
|
||||
buildRegionText: buildRegionText,
|
||||
buildProfileView: buildProfileView,
|
||||
buildUnavailableProfileView: buildUnavailableProfileView,
|
||||
buildProfileUpdateBody: buildProfileUpdateBody,
|
||||
shouldRedirectToLogin: shouldRedirectToLogin,
|
||||
reloadProfile: loadProfile,
|
||||
|
||||
Reference in New Issue
Block a user