diff --git a/src/api/department.ts b/src/api/department.ts index 9a462c0..00101a6 100644 --- a/src/api/department.ts +++ b/src/api/department.ts @@ -50,3 +50,7 @@ export function dropDiffClass(id: number, parent_id: number, ids: number[]) { ids: ids, }); } + +export function checkDestroy(id: number) { + return client.get(`/backend/v1/department/${id}/destroy`, {}); +} diff --git a/src/api/resource-category.ts b/src/api/resource-category.ts index 8802f5b..e2e1686 100644 --- a/src/api/resource-category.ts +++ b/src/api/resource-category.ts @@ -54,3 +54,7 @@ export function dropDiffClass(id: number, parent_id: number, ids: number[]) { ids: ids, }); } + +export function checkDestroy(id: number) { + return client.get(`/backend/v1/resource-category/${id}/destroy`, {}); +} diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index cca0ab8..7c93467 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -20,14 +20,12 @@ export const TreeCategory = (props: PropInterface) => { const [selectKey, setSelectKey] = useState([]); useEffect(() => { - setLoading(true); resourceCategory.resourceCategoryList().then((res: any) => { const categories = res.data.categories; if (JSON.stringify(categories) !== "{}") { const new_arr: Option[] = checkArr(categories, 0); setTreeData(new_arr); } - setLoading(false); }); }, [props.categoryCount]); @@ -93,14 +91,21 @@ export const TreeCategory = (props: PropInterface) => { ? "mb-8 category-label active" : "mb-8 category-label" } - onClick={() => onSelect([], "")} + onClick={() => { + onSelect([], ""); + }} > 全部{props.text} {JSON.stringify(props.categoryCount) !== "{}" && ( ({props.categoryCount["0"]}) )} - + ); }; diff --git a/src/compenents/tree-department/index.tsx b/src/compenents/tree-department/index.tsx index c3093bb..14fd668 100644 --- a/src/compenents/tree-department/index.tsx +++ b/src/compenents/tree-department/index.tsx @@ -89,7 +89,12 @@ export const TreeDepartment = (props: PropInterface) => { > 全部{props.text} - + ); }; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index aaf1212..cb9fe31 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -43,7 +43,7 @@ export const CoursePage = () => { const [category_ids, setCategoryIds] = useState([]); const [title, setTitle] = useState(""); const [dep_ids, setDepIds] = useState([]); - const [selLabel, setLabel] = useState("全部视频"); + const [selLabel, setLabel] = useState("全部课程"); const [categoryCount, setCategoryCount] = useState({}); const items: TabsProps["items"] = [