feat:【ele/antd】profile todo 优化

This commit is contained in:
puhui999
2025-12-28 18:55:07 +08:00
parent 6353f0a8e9
commit aa95d0e87c
4 changed files with 20 additions and 15 deletions

View File

@@ -100,7 +100,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
toolbarConfig: { toolbarConfig: {
enabled: false, enabled: false,
}, },
} as VxeTableGridOptions<SystemSocialUserApi.SocialUser>, },
}); });
/** 解绑账号 */ /** 解绑账号 */

View File

@@ -21,10 +21,13 @@ const emit = defineEmits<{
(e: 'success'): void; (e: 'success'): void;
}>(); }>();
// TODO @puhui999展示貌似不太对应该是左右不是上下哈
const [Form, formApi] = useVbenForm({ const [Form, formApi] = useVbenForm({
commonConfig: { commonConfig: {
labelWidth: 70, componentProps: {
class: 'w-full',
},
formItemClass: 'col-span-2',
labelWidth: 80,
}, },
schema: [ schema: [
{ {

View File

@@ -25,7 +25,6 @@ const avatar = computed(
() => props.profile?.avatar || preferences.app.defaultAvatar, () => props.profile?.avatar || preferences.app.defaultAvatar,
); );
// TODO @puhui999头像上传没跑通
async function handelUpload({ async function handelUpload({
file, file,
filename, filename,
@@ -37,9 +36,9 @@ async function handelUpload({
const { httpRequest } = useUpload(); const { httpRequest } = useUpload();
// 将 Blob 转换为 File // 将 Blob 转换为 File
const fileObj = new File([file], filename, { type: file.type }); const fileObj = new File([file], filename, { type: file.type });
const avatar = await httpRequest(fileObj); const res = await httpRequest(fileObj);
// 2. 更新用户头像 // 2. 更新用户头像httpRequest 返回 { url: string }
await updateUserProfile({ avatar }); await updateUserProfile({ avatar: res.url });
} }
</script> </script>
@@ -57,8 +56,8 @@ async function handelUpload({
</ElTooltip> </ElTooltip>
</div> </div>
<div class="mt-8"> <div class="mt-8">
<ElDescriptions :column="2"> <ElDescriptions :column="2" border>
<ElDescriptionsItem> <ElDescriptionsItem label="用户账号">
<template #label> <template #label>
<div class="flex items-center"> <div class="flex items-center">
<IconifyIcon icon="ant-design:user-outlined" class="mr-1" /> <IconifyIcon icon="ant-design:user-outlined" class="mr-1" />
@@ -116,7 +115,11 @@ async function handelUpload({
所属岗位 所属岗位
</div> </div>
</template> </template>
{{ profile.posts.map((post) => post.name).join(',') }} {{
profile.posts && profile.posts.length > 0
? profile.posts.map((post) => post.name).join(',')
: '-'
}}
</ElDescriptionsItem> </ElDescriptionsItem>
<ElDescriptionsItem> <ElDescriptionsItem>
<template #label> <template #label>

View File

@@ -100,7 +100,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
toolbarConfig: { toolbarConfig: {
enabled: false, enabled: false,
}, },
} as VxeTableGridOptions<SystemSocialUserApi.SocialUser>, },
}); });
/** 解绑账号 */ /** 解绑账号 */
@@ -167,13 +167,12 @@ onMounted(() => {
> >
<ElCard v-for="item in allBindList" :key="item.type" class="!mb-2"> <ElCard v-for="item in allBindList" :key="item.type" class="!mb-2">
<div class="flex w-full items-center gap-4"> <div class="flex w-full items-center gap-4">
<!-- TODO @puhui999图片大小不太对 -->
<ElImage <ElImage
:src="item.img" :src="item.img"
:width="40" style="width: 40px; height: 40px"
:height="40"
:alt="item.title" :alt="item.title"
:preview="false" :preview-disabled="true"
fit="contain"
/> />
<div class="flex flex-1 items-center justify-between"> <div class="flex flex-1 items-center justify-between">
<div class="flex flex-col"> <div class="flex flex-col">