mirror of
https://github.com/PlayEdu/backend
synced 2025-06-28 03:55:02 +08:00
线上课tab切换
This commit is contained in:
parent
b897dfffac
commit
18f6056dc9
@ -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++) {
|
||||
|
@ -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;
|
||||
|
@ -110,7 +110,6 @@ 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) => {
|
||||
|
@ -173,7 +173,6 @@ 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)}
|
||||
|
@ -51,6 +51,7 @@ const CoursePage = () => {
|
||||
const [title, setTitle] = useState<string>("");
|
||||
const [dep_ids, setDepIds] = useState<any>([]);
|
||||
const [selLabel, setLabel] = useState<string>("全部分类");
|
||||
const [selDepLabel, setDepLabel] = useState<string>("全部部门");
|
||||
const [course_category_ids, setCourseCategoryIds] = useState<any>({});
|
||||
const [course_dep_ids, setCourseDepIds] = useState<any>({});
|
||||
const [categories, setCategories] = useState<any>({});
|
||||
@ -69,7 +70,6 @@ const CoursePage = () => {
|
||||
children: (
|
||||
<div className="float-left">
|
||||
<TreeCategory
|
||||
refresh={refresh}
|
||||
type=""
|
||||
text={"分类"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
@ -96,7 +96,7 @@ const CoursePage = () => {
|
||||
text={"部门"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
setDepIds(keys);
|
||||
setLabel(title);
|
||||
setDepLabel(title);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
@ -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 = () => {
|
||||
</div>
|
||||
<div className="right-box">
|
||||
<div className="playedu-main-title float-left mb-24">
|
||||
线上课 | {selLabel}
|
||||
线上课 | {tabKey === 1 ? selLabel : selDepLabel}
|
||||
</div>
|
||||
<div className="float-left j-b-flex mb-24">
|
||||
<div className="d-flex">
|
||||
|
@ -150,7 +150,6 @@ const ResourceImagesPage = () => {
|
||||
<div className="tree-main-body">
|
||||
<div className="left-box">
|
||||
<TreeCategory
|
||||
refresh={false}
|
||||
type="no-cate"
|
||||
text={"图片"}
|
||||
onUpdate={(keys: any, title: any) => {
|
||||
|
@ -170,7 +170,6 @@ 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