mirror of
https://github.com/PlayEdu/backend
synced 2025-06-27 05:32:43 +08:00
线上课列表切换tab重置分类、部门组件
This commit is contained in:
parent
27ec0e6c4a
commit
b34cd955c4
@ -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++) {
|
||||
|
@ -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;
|
||||
|
@ -101,6 +101,7 @@ export const UploadImageButton = (props: PropsInterface) => {
|
||||
<Row style={{ width: 752, minHeight: 520, marginTop: 24 }}>
|
||||
<Col span={7}>
|
||||
<TreeCategory
|
||||
refresh={false}
|
||||
type="no-cate"
|
||||
text={"图片"}
|
||||
onUpdate={(keys: any) => setCategoryIds(keys)}
|
||||
|
@ -173,6 +173,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
||||
<Row style={{ width: 752, minHeight: 520 }}>
|
||||
<Col span={7}>
|
||||
<TreeCategory
|
||||
refresh={false}
|
||||
type="no-cate"
|
||||
text={props.label}
|
||||
onUpdate={(keys: any) => setCategoryIds(keys)}
|
||||
|
@ -69,6 +69,7 @@ const CoursePage = () => {
|
||||
children: (
|
||||
<div className="float-left">
|
||||
<TreeCategory
|
||||
refresh={refresh}
|
||||
type=""
|
||||
text={"分类"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
@ -331,6 +332,14 @@ const CoursePage = () => {
|
||||
};
|
||||
|
||||
const onChange = (key: string) => {
|
||||
setCategoryIds([]);
|
||||
setDepIds([]);
|
||||
if (Number(key) === 1) {
|
||||
setLabel("全部分类");
|
||||
} else {
|
||||
setLabel("全部部门");
|
||||
}
|
||||
setRefresh(!refresh);
|
||||
setTabKey(Number(key));
|
||||
};
|
||||
|
||||
|
@ -150,6 +150,7 @@ const ResourceImagesPage = () => {
|
||||
<div className="tree-main-body">
|
||||
<div className="left-box">
|
||||
<TreeCategory
|
||||
refresh={false}
|
||||
type="no-cate"
|
||||
text={"图片"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
|
@ -170,6 +170,7 @@ const ResourceVideosPage = () => {
|
||||
<div className="tree-main-body">
|
||||
<div className="left-box">
|
||||
<TreeCategory
|
||||
refresh={false}
|
||||
type="no-cate"
|
||||
text={"视频"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user