From b34cd955c4c2042c04715cdc3dba24e623660b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Mon, 24 Apr 2023 09:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E8=AF=BE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=88=87=E6=8D=A2tab=E9=87=8D=E7=BD=AE=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E3=80=81=E9=83=A8=E9=97=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/tree-category/index.tsx | 6 ++++++ src/compenents/tree-department/index.tsx | 1 + src/compenents/upload-image-button/index.tsx | 1 + src/compenents/upload-video-sub/index.tsx | 1 + src/pages/course/index.tsx | 9 +++++++++ src/pages/resource/images/index.tsx | 1 + src/pages/resource/videos/index.tsx | 1 + 7 files changed, 20 insertions(+) diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index 7e4cb67..4789496 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -5,12 +5,14 @@ import { resourceCategory } from "../../api/index"; interface Option { key: string | number; title: any; + children?: Option[]; } interface PropInterface { type: string; text: string; + refresh: boolean; onUpdate: (keys: any, title: any) => void; } @@ -36,6 +38,10 @@ export const TreeCategory = (props: PropInterface) => { }); }, []); + useEffect(() => { + setSelectKey([]); + }, [props.refresh]); + const checkArr = (categories: any[], id: number) => { const arr = []; for (let i = 0; i < categories[id].length; i++) { diff --git a/src/compenents/tree-department/index.tsx b/src/compenents/tree-department/index.tsx index 3da48c5..6b38bca 100644 --- a/src/compenents/tree-department/index.tsx +++ b/src/compenents/tree-department/index.tsx @@ -24,6 +24,7 @@ export const TreeDepartment = (props: PropInterface) => { useEffect(() => { setLoading(true); + setSelectKey([]) department.departmentList().then((res: any) => { const departments = res.data.departments; const departCount = res.data.dep_user_count; diff --git a/src/compenents/upload-image-button/index.tsx b/src/compenents/upload-image-button/index.tsx index 8c6cdb8..a6a8521 100644 --- a/src/compenents/upload-image-button/index.tsx +++ b/src/compenents/upload-image-button/index.tsx @@ -101,6 +101,7 @@ export const UploadImageButton = (props: PropsInterface) => { setCategoryIds(keys)} diff --git a/src/compenents/upload-video-sub/index.tsx b/src/compenents/upload-video-sub/index.tsx index d7819fb..525564d 100644 --- a/src/compenents/upload-video-sub/index.tsx +++ b/src/compenents/upload-video-sub/index.tsx @@ -173,6 +173,7 @@ export const UploadVideoSub = (props: PropsInterface) => { setCategoryIds(keys)} diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index ad94cbb..527e80b 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -69,6 +69,7 @@ const CoursePage = () => { children: (
{ @@ -331,6 +332,14 @@ const CoursePage = () => { }; const onChange = (key: string) => { + setCategoryIds([]); + setDepIds([]); + if (Number(key) === 1) { + setLabel("全部分类"); + } else { + setLabel("全部部门"); + } + setRefresh(!refresh); setTabKey(Number(key)); }; diff --git a/src/pages/resource/images/index.tsx b/src/pages/resource/images/index.tsx index 4ca1430..f2f4f5f 100644 --- a/src/pages/resource/images/index.tsx +++ b/src/pages/resource/images/index.tsx @@ -150,6 +150,7 @@ const ResourceImagesPage = () => {
{ diff --git a/src/pages/resource/videos/index.tsx b/src/pages/resource/videos/index.tsx index 6d5a363..e1fe13b 100644 --- a/src/pages/resource/videos/index.tsx +++ b/src/pages/resource/videos/index.tsx @@ -170,6 +170,7 @@ const ResourceVideosPage = () => {
{