mirror of
https://github.com/PlayEdu/backend
synced 2025-07-19 21:59:44 +08:00
分类、部门组件点击全部取消选中状态修复
This commit is contained in:
parent
b54bf7646e
commit
7d253ef888
@ -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`, {});
|
||||
}
|
||||
|
@ -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`, {});
|
||||
}
|
||||
|
@ -20,14 +20,12 @@ export const TreeCategory = (props: PropInterface) => {
|
||||
const [selectKey, setSelectKey] = useState<any>([]);
|
||||
|
||||
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) !== "{}" && (
|
||||
<span className="tree-num">({props.categoryCount["0"]})</span>
|
||||
)}
|
||||
</div>
|
||||
<Tree onSelect={onSelect} onExpand={onExpand} treeData={treeData} />
|
||||
<Tree
|
||||
onSelect={onSelect}
|
||||
selectedKeys={selectKey}
|
||||
onExpand={onExpand}
|
||||
treeData={treeData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -89,7 +89,12 @@ export const TreeDepartment = (props: PropInterface) => {
|
||||
>
|
||||
全部{props.text}
|
||||
</div>
|
||||
<Tree onSelect={onSelect} onExpand={onExpand} treeData={treeData} />
|
||||
<Tree
|
||||
selectedKeys={selectKey}
|
||||
onSelect={onSelect}
|
||||
onExpand={onExpand}
|
||||
treeData={treeData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -43,7 +43,7 @@ export const CoursePage = () => {
|
||||
const [category_ids, setCategoryIds] = useState<any>([]);
|
||||
const [title, setTitle] = useState<string>("");
|
||||
const [dep_ids, setDepIds] = useState<any>([]);
|
||||
const [selLabel, setLabel] = useState<string>("全部视频");
|
||||
const [selLabel, setLabel] = useState<string>("全部课程");
|
||||
const [categoryCount, setCategoryCount] = useState<any>({});
|
||||
|
||||
const items: TabsProps["items"] = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user