修改功能

This commit is contained in:
2026-08-29 19:06:07 +08:00
parent f94c652c7c
commit aaed0584b1
142 changed files with 6176 additions and 869 deletions
+19 -2
View File
@@ -15,6 +15,7 @@
'use strict';
var documentRef = root.document;
var MediaDisplay = root.MediaDisplay || (typeof require === 'function' ? require('./media-display.js') : null);
function trimOrUndefined(value) {
var text = value === undefined || value === null ? '' : String(value).trim();
@@ -40,18 +41,23 @@
}
function buildProfileView(profile) {
var avatarFile = MediaDisplay && MediaDisplay.normalizeFileAccess(profile && profile.avatarFile);
var view;
// 页面展示模型和接口返回分开,后续改文案不影响接口契约。
return {
view = {
displayName: profileValue(profile, 'nickName', '未设置昵称'),
realName: profileValue(profile, 'realName', '待填写'),
avatarText: getAvatarText(profile),
avatarStatus: profile && profile.avatar ? '已设置' : '未设置',
avatarStatus: avatarFile ? '已设置' : '未设置',
phone: profileValue(profile, 'phone', '未绑定'),
sex: getSexText(profile && profile.sex),
birthday: profileValue(profile, 'birthday', '待填写'),
email: profileValue(profile, 'email', '待填写'),
regionText: '当前资料接口未提供'
};
if (avatarFile) view.avatarFile = avatarFile;
return view;
}
function buildProfileUpdateBody(values) {
@@ -159,10 +165,21 @@
var key = node.getAttribute('data-profile-text');
var value = view[key];
if (key === 'avatarText' && view.avatarFile) return;
if (value !== undefined && value !== null && value !== '') {
node.textContent = value;
}
});
queryAll('[data-profile-avatar]').forEach(function (node) {
if (!MediaDisplay) {
node.textContent = view.avatarText;
return;
}
node.innerHTML = MediaDisplay.renderAvatar(view.avatarFile, {
name: view.displayName,
className: 'profile-avatar-media'
});
});
}
function setProfileLoadStatus(type, message) {