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 = () => {
{