diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index 4789496..aedc7ea 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -12,7 +12,6 @@ interface Option { interface PropInterface { type: string; text: string; - refresh: boolean; onUpdate: (keys: any, title: any) => void; } @@ -38,10 +37,6 @@ 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 6b38bca..3da48c5 100644 --- a/src/compenents/tree-department/index.tsx +++ b/src/compenents/tree-department/index.tsx @@ -24,7 +24,6 @@ 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 3fb13c9..89fc6bb 100644 --- a/src/compenents/upload-image-button/index.tsx +++ b/src/compenents/upload-image-button/index.tsx @@ -110,7 +110,6 @@ export const UploadImageButton = (props: PropsInterface) => { { diff --git a/src/compenents/upload-video-sub/index.tsx b/src/compenents/upload-video-sub/index.tsx index 525564d..d7819fb 100644 --- a/src/compenents/upload-video-sub/index.tsx +++ b/src/compenents/upload-video-sub/index.tsx @@ -173,7 +173,6 @@ export const UploadVideoSub = (props: PropsInterface) => { setCategoryIds(keys)} diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index 527e80b..14cb94b 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -51,6 +51,7 @@ const CoursePage = () => { const [title, setTitle] = useState(""); const [dep_ids, setDepIds] = useState([]); const [selLabel, setLabel] = useState("全部分类"); + const [selDepLabel, setDepLabel] = useState("全部部门"); const [course_category_ids, setCourseCategoryIds] = useState({}); const [course_dep_ids, setCourseDepIds] = useState({}); const [categories, setCategories] = useState({}); @@ -69,7 +70,6 @@ const CoursePage = () => { children: (
{ @@ -96,7 +96,7 @@ const CoursePage = () => { text={"部门"} onUpdate={(keys: any, title: any) => { setDepIds(keys); - setLabel(title); + setDepLabel(title); }} />
@@ -283,11 +283,16 @@ const CoursePage = () => { }); }; - // 获取视频列表 + // 获取列表 const getList = () => { setLoading(true); - let categoryIds = category_ids.join(","); - let depIds = dep_ids.join(","); + let categoryIds = ""; + let depIds = ""; + if (tabKey === 1) { + categoryIds = category_ids.join(","); + } else { + depIds = dep_ids.join(","); + } course .courseList(page, size, "", "", title, depIds, categoryIds) .then((res: any) => { @@ -315,7 +320,7 @@ const CoursePage = () => { // 加载列表 useEffect(() => { getList(); - }, [category_ids, dep_ids, refresh, page, size]); + }, [category_ids, dep_ids, refresh, page, size, tabKey]); const paginationProps = { current: page, //当前页码 @@ -332,14 +337,6 @@ const CoursePage = () => { }; const onChange = (key: string) => { - setCategoryIds([]); - setDepIds([]); - if (Number(key) === 1) { - setLabel("全部分类"); - } else { - setLabel("全部部门"); - } - setRefresh(!refresh); setTabKey(Number(key)); }; @@ -357,7 +354,7 @@ const CoursePage = () => {
- 线上课 | {selLabel} + 线上课 | {tabKey === 1 ? selLabel : selDepLabel}
diff --git a/src/pages/resource/images/index.tsx b/src/pages/resource/images/index.tsx index f2f4f5f..4ca1430 100644 --- a/src/pages/resource/images/index.tsx +++ b/src/pages/resource/images/index.tsx @@ -150,7 +150,6 @@ const ResourceImagesPage = () => {
{ diff --git a/src/pages/resource/videos/index.tsx b/src/pages/resource/videos/index.tsx index e1fe13b..6d5a363 100644 --- a/src/pages/resource/videos/index.tsx +++ b/src/pages/resource/videos/index.tsx @@ -170,7 +170,6 @@ const ResourceVideosPage = () => {
{