From f4e1404b6edeafc2e0e4cbbe8e9edd25451b8c89 Mon Sep 17 00:00:00 2001 From: ZM25XC <78628186+ZM25XC@users.noreply.github.com> Date: Mon, 25 Mar 2024 10:29:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E8=A3=81=E5=89=AA=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=BB=84=E4=BB=B6=E9=80=BB=E8=BE=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 当用户avatar字段为空时,使用平台默认图片,以确保裁剪组件能正确加载 --- src/views/system/user/utils/hook.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/views/system/user/utils/hook.tsx b/src/views/system/user/utils/hook.tsx index 5cad74de3..77d15d474 100644 --- a/src/views/system/user/utils/hook.tsx +++ b/src/views/system/user/utils/hook.tsx @@ -10,6 +10,7 @@ import { usePublicHooks } from "../../hooks"; import { addDialog } from "@/components/ReDialog"; import type { PaginationProps } from "@pureadmin/table"; import type { FormItemProps, RoleFormItemProps } from "../utils/types"; +import userAvatar from "@/assets/user.jpg"; import { getKeyList, isAllEmpty, @@ -85,8 +86,8 @@ export function useUser(tableRef: Ref, treeRef: Ref) { ), @@ -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 => {