Skip to content

Commit

Permalink
perf: 优化用户管理-裁剪图片上传功能 (#1027)
Browse files Browse the repository at this point in the history
* perf: 优化用户管理-裁剪图片上传功能
  • Loading branch information
ZM25XC authored Mar 25, 2024
1 parent e38610f commit bc1da0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/views/system/user/utils/hook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { zxcvbn } from "@zxcvbn-ts/core";
import { handleTree } from "@/utils/tree";
import { message } from "@/utils/message";
import croppingUpload from "../upload.vue";
import userAvatar from "@/assets/user.jpg";
import { usePublicHooks } from "../../hooks";
import { addDialog } from "@/components/ReDialog";
import type { PaginationProps } from "@pureadmin/table";
Expand Down Expand Up @@ -85,8 +86,8 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
<el-image
fit="cover"
preview-teleported={true}
src={row.avatar}
preview-src-list={Array.of(row.avatar)}
src={row.avatar || userAvatar}
preview-src-list={Array.of(row.avatar || userAvatar)}
class="w-[24px] h-[24px] rounded-full align-middle"
/>
),
Expand Down Expand Up @@ -370,7 +371,7 @@ export function useUser(tableRef: Ref, treeRef: Ref) {
contentRenderer: () =>
h(croppingUpload, {
ref: cropRef,
imgSrc: row.avatar,
imgSrc: row.avatar || userAvatar,
onCropper: info => (avatarInfo.value = info)
}),
beforeSure: done => {
Expand Down

0 comments on commit bc1da0b

Please sign in to comment.