From d90afcc08b71931ed1620419000b10f67fabb15f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Tue, 11 Apr 2023 16:28:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E5=91=98=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E8=AF=B7=E6=B1=82api=E5=92=8C=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/tree-category/index.tsx | 17 ++++++++------- src/compenents/upload-image-button/index.tsx | 6 ++++-- src/pages/course/compenents/create.tsx | 1 + src/pages/course/compenents/update.tsx | 1 + .../resource/resource-category/index.tsx | 21 +++++++++++-------- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index af7f36b..7e4cb67 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -89,13 +89,16 @@ export const TreeCategory = (props: PropInterface) => { 全部{props.text} - } - /> + {treeData.length > 0 && ( + } + /> + )} ); }; diff --git a/src/compenents/upload-image-button/index.tsx b/src/compenents/upload-image-button/index.tsx index 545a0ab..2eb4a20 100644 --- a/src/compenents/upload-image-button/index.tsx +++ b/src/compenents/upload-image-button/index.tsx @@ -71,8 +71,10 @@ export const UploadImageButton = (props: PropsInterface) => { // 加载图片列表 useEffect(() => { - getImageList(); - }, [category_ids, refresh, page, size]); + if (showModal) { + getImageList(); + } + }, [category_ids, refresh, page, size, showModal]); return ( <> diff --git a/src/pages/course/compenents/create.tsx b/src/pages/course/compenents/create.tsx index 815ffce..2a2db6f 100644 --- a/src/pages/course/compenents/create.tsx +++ b/src/pages/course/compenents/create.tsx @@ -434,6 +434,7 @@ export const CourseCreate: React.FC = ({ style={{ width: 424 }} treeData={categories} placeholder="请选择课程分类" + treeDefaultExpandAll /> = ({ style={{ width: 424 }} treeData={categories} placeholder="请选择课程分类" + treeDefaultExpandAll /> { - } - /> + {treeData.length > 0 && ( + } + /> + )}