feat(personal-center): 实现个人信息功能
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
function getNullableText(value?: string | null) {
|
||||
return value?.trim() || null;
|
||||
}
|
||||
|
||||
export function formatProfileDateTime(value?: string | number | null) {
|
||||
if (!value) {
|
||||
return '--';
|
||||
}
|
||||
|
||||
return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
export function resolveProfileRoleLabels(roles: Api.SystemManage.RoleSimple[]) {
|
||||
return roles.map(role => role.name?.trim() || role.code || role.id);
|
||||
}
|
||||
|
||||
export function buildProfileUpdatePayload(form: Api.Auth.UpdateMyProfileParams): Api.Auth.UpdateMyProfileParams {
|
||||
return {
|
||||
nickname: getNullableText(form.nickname),
|
||||
email: getNullableText(form.email),
|
||||
mobile: getNullableText(form.mobile),
|
||||
sex: form.sex ?? null,
|
||||
avatar: getNullableText(form.avatar)
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user