mirror of
https://github.com/PlayEdu/backend
synced 2025-06-29 20:42:42 +08:00
分类、部门删除关联跳转相关页面时选中
This commit is contained in:
parent
2e7466cea7
commit
12cc5edbf6
@ -5,13 +5,13 @@ import { resourceCategory } from "../../api/index";
|
|||||||
interface Option {
|
interface Option {
|
||||||
key: string | number;
|
key: string | number;
|
||||||
title: any;
|
title: any;
|
||||||
|
|
||||||
children?: Option[];
|
children?: Option[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PropInterface {
|
interface PropInterface {
|
||||||
type: string;
|
type: string;
|
||||||
text: string;
|
text: string;
|
||||||
|
selected: any;
|
||||||
onUpdate: (keys: any, title: any) => void;
|
onUpdate: (keys: any, title: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,6 +20,12 @@ export const TreeCategory = (props: PropInterface) => {
|
|||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [selectKey, setSelectKey] = useState<any>([]);
|
const [selectKey, setSelectKey] = useState<any>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (props.selected && props.selected.length > 0) {
|
||||||
|
setSelectKey(props.selected);
|
||||||
|
}
|
||||||
|
}, [props.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
resourceCategory.resourceCategoryList().then((res: any) => {
|
resourceCategory.resourceCategoryList().then((res: any) => {
|
||||||
const categories = res.data.categories;
|
const categories = res.data.categories;
|
||||||
|
@ -13,6 +13,7 @@ interface PropInterface {
|
|||||||
text: string;
|
text: string;
|
||||||
refresh: boolean;
|
refresh: boolean;
|
||||||
showNum: boolean;
|
showNum: boolean;
|
||||||
|
selected: any;
|
||||||
onUpdate: (keys: any, title: any) => void;
|
onUpdate: (keys: any, title: any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,6 +23,12 @@ export const TreeDepartment = (props: PropInterface) => {
|
|||||||
const [selectKey, setSelectKey] = useState<any>([]);
|
const [selectKey, setSelectKey] = useState<any>([]);
|
||||||
const [userTotal, setUserTotal] = useState(0);
|
const [userTotal, setUserTotal] = useState(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (props.selected && props.selected.length > 0) {
|
||||||
|
setSelectKey(props.selected);
|
||||||
|
}
|
||||||
|
}, [props.selected]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
department.departmentList().then((res: any) => {
|
department.departmentList().then((res: any) => {
|
||||||
|
@ -110,6 +110,7 @@ export const UploadImageButton = (props: PropsInterface) => {
|
|||||||
<Row style={{ width: 752, minHeight: 520, marginTop: 24 }}>
|
<Row style={{ width: 752, minHeight: 520, marginTop: 24 }}>
|
||||||
<Col span={7}>
|
<Col span={7}>
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
selected={category_ids}
|
||||||
type="no-cate"
|
type="no-cate"
|
||||||
text={"图片"}
|
text={"图片"}
|
||||||
onUpdate={(keys: any) => {
|
onUpdate={(keys: any) => {
|
||||||
|
@ -173,6 +173,7 @@ export const UploadVideoSub = (props: PropsInterface) => {
|
|||||||
<Row style={{ width: 752, minHeight: 520 }}>
|
<Row style={{ width: 752, minHeight: 520 }}>
|
||||||
<Col span={7}>
|
<Col span={7}>
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
selected={[]}
|
||||||
type="no-cate"
|
type="no-cate"
|
||||||
text={props.label}
|
text={props.label}
|
||||||
onUpdate={(keys: any) => setCategoryIds(keys)}
|
onUpdate={(keys: any) => setCategoryIds(keys)}
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
import type { MenuProps } from "antd";
|
import type { MenuProps } from "antd";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { dateFormat } from "../../utils/index";
|
import { dateFormat } from "../../utils/index";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate, useLocation } from "react-router-dom";
|
||||||
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
import { TreeDepartment, TreeCategory, PerButton } from "../../compenents";
|
||||||
import type { TabsProps } from "antd";
|
import type { TabsProps } from "antd";
|
||||||
import { CourseCreate } from "./compenents/create";
|
import { CourseCreate } from "./compenents/create";
|
||||||
@ -40,6 +40,7 @@ interface DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CoursePage = () => {
|
const CoursePage = () => {
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [list, setList] = useState<any>([]);
|
const [list, setList] = useState<any>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
@ -50,18 +51,43 @@ const CoursePage = () => {
|
|||||||
const [category_ids, setCategoryIds] = useState<any>([]);
|
const [category_ids, setCategoryIds] = useState<any>([]);
|
||||||
const [title, setTitle] = useState<string>("");
|
const [title, setTitle] = useState<string>("");
|
||||||
const [dep_ids, setDepIds] = useState<any>([]);
|
const [dep_ids, setDepIds] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部分类");
|
const [selLabel, setLabel] = useState<string>(
|
||||||
const [selDepLabel, setDepLabel] = useState<string>("全部部门");
|
result.get("label") ? String(result.get("label")) : "全部分类"
|
||||||
|
);
|
||||||
|
const [selDepLabel, setDepLabel] = useState<string>(
|
||||||
|
result.get("label") ? String(result.get("label")) : "全部部门"
|
||||||
|
);
|
||||||
const [course_category_ids, setCourseCategoryIds] = useState<any>({});
|
const [course_category_ids, setCourseCategoryIds] = useState<any>({});
|
||||||
const [course_dep_ids, setCourseDepIds] = useState<any>({});
|
const [course_dep_ids, setCourseDepIds] = useState<any>({});
|
||||||
const [categories, setCategories] = useState<any>({});
|
const [categories, setCategories] = useState<any>({});
|
||||||
const [departments, setDepartments] = useState<any>({});
|
const [departments, setDepartments] = useState<any>({});
|
||||||
const [tabKey, setTabKey] = useState(1);
|
const [tabKey, setTabKey] = useState(result.get("did") ? "2" : "1");
|
||||||
|
|
||||||
const [createVisible, setCreateVisible] = useState<boolean>(false);
|
const [createVisible, setCreateVisible] = useState<boolean>(false);
|
||||||
const [updateVisible, setUpdateVisible] = useState<boolean>(false);
|
const [updateVisible, setUpdateVisible] = useState<boolean>(false);
|
||||||
const [updateHourVisible, setHourUpdateVisible] = useState<boolean>(false);
|
const [updateHourVisible, setHourUpdateVisible] = useState<boolean>(false);
|
||||||
const [cid, setCid] = useState<number>(0);
|
const [cid, setCid] = useState<number>(0);
|
||||||
|
const [cateId, setCateId] = useState(Number(result.get("cid")));
|
||||||
|
const [did, setDid] = useState(Number(result.get("did")));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getList();
|
||||||
|
}, [category_ids, dep_ids, refresh, page, size, tabKey]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCateId(Number(result.get("cid")));
|
||||||
|
if (Number(result.get("cid"))) {
|
||||||
|
let arr = [];
|
||||||
|
arr.push(Number(result.get("cid")));
|
||||||
|
setCategoryIds(arr);
|
||||||
|
}
|
||||||
|
setDid(Number(result.get("did")));
|
||||||
|
if (Number(result.get("did"))) {
|
||||||
|
let arr = [];
|
||||||
|
arr.push(Number(result.get("did")));
|
||||||
|
setDepIds(arr);
|
||||||
|
}
|
||||||
|
}, [result.get("cid"), result.get("did")]);
|
||||||
|
|
||||||
const items: TabsProps["items"] = [
|
const items: TabsProps["items"] = [
|
||||||
{
|
{
|
||||||
@ -70,6 +96,7 @@ const CoursePage = () => {
|
|||||||
children: (
|
children: (
|
||||||
<div className="float-left">
|
<div className="float-left">
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
selected={category_ids}
|
||||||
type=""
|
type=""
|
||||||
text={"分类"}
|
text={"分类"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
@ -90,6 +117,7 @@ const CoursePage = () => {
|
|||||||
children: (
|
children: (
|
||||||
<div className="float-left">
|
<div className="float-left">
|
||||||
<TreeDepartment
|
<TreeDepartment
|
||||||
|
selected={dep_ids}
|
||||||
refresh={refresh}
|
refresh={refresh}
|
||||||
showNum={false}
|
showNum={false}
|
||||||
type="no-course"
|
type="no-course"
|
||||||
@ -288,7 +316,7 @@ const CoursePage = () => {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
let categoryIds = "";
|
let categoryIds = "";
|
||||||
let depIds = "";
|
let depIds = "";
|
||||||
if (tabKey === 1) {
|
if (tabKey === "1") {
|
||||||
categoryIds = category_ids.join(",");
|
categoryIds = category_ids.join(",");
|
||||||
} else {
|
} else {
|
||||||
depIds = dep_ids.join(",");
|
depIds = dep_ids.join(",");
|
||||||
@ -317,11 +345,6 @@ const CoursePage = () => {
|
|||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 加载列表
|
|
||||||
useEffect(() => {
|
|
||||||
getList();
|
|
||||||
}, [category_ids, dep_ids, refresh, page, size, tabKey]);
|
|
||||||
|
|
||||||
const paginationProps = {
|
const paginationProps = {
|
||||||
current: page, //当前页码
|
current: page, //当前页码
|
||||||
pageSize: size,
|
pageSize: size,
|
||||||
@ -337,7 +360,7 @@ const CoursePage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onChange = (key: string) => {
|
const onChange = (key: string) => {
|
||||||
setTabKey(Number(key));
|
setTabKey(key);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -345,7 +368,7 @@ const CoursePage = () => {
|
|||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<Tabs
|
<Tabs
|
||||||
defaultActiveKey="1"
|
defaultActiveKey={tabKey}
|
||||||
centered
|
centered
|
||||||
tabBarGutter={55}
|
tabBarGutter={55}
|
||||||
items={items}
|
items={items}
|
||||||
@ -354,7 +377,7 @@ const CoursePage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="right-box">
|
<div className="right-box">
|
||||||
<div className="playedu-main-title float-left mb-24">
|
<div className="playedu-main-title float-left mb-24">
|
||||||
线上课 | {tabKey === 1 ? selLabel : selDepLabel}
|
线上课 | {tabKey === "1" ? selLabel : selDepLabel}
|
||||||
</div>
|
</div>
|
||||||
<div className="float-left j-b-flex mb-24">
|
<div className="float-left j-b-flex mb-24">
|
||||||
<div className="d-flex">
|
<div className="d-flex">
|
||||||
@ -406,8 +429,8 @@ const CoursePage = () => {
|
|||||||
rowKey={(record) => record.id}
|
rowKey={(record) => record.id}
|
||||||
/>
|
/>
|
||||||
<CourseCreate
|
<CourseCreate
|
||||||
cateIds={tabKey === 1 ? category_ids : []}
|
cateIds={tabKey === "1" ? category_ids : []}
|
||||||
depIds={tabKey === 2 ? dep_ids : []}
|
depIds={tabKey === "2" ? dep_ids : []}
|
||||||
open={createVisible}
|
open={createVisible}
|
||||||
onCancel={() => {
|
onCancel={() => {
|
||||||
setCreateVisible(false);
|
setCreateVisible(false);
|
||||||
|
@ -89,7 +89,12 @@ const DepartmentPage = () => {
|
|||||||
<i
|
<i
|
||||||
className="iconfont icon-icon-delete"
|
className="iconfont icon-icon-delete"
|
||||||
style={{ fontSize: 24 }}
|
style={{ fontSize: 24 }}
|
||||||
onClick={() => removeItem(departments[id][i].id)}
|
onClick={() =>
|
||||||
|
removeItem(
|
||||||
|
departments[id][i].id,
|
||||||
|
departments[id][i].name
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -124,7 +129,12 @@ const DepartmentPage = () => {
|
|||||||
<i
|
<i
|
||||||
className="iconfont icon-icon-delete"
|
className="iconfont icon-icon-delete"
|
||||||
style={{ fontSize: 24 }}
|
style={{ fontSize: 24 }}
|
||||||
onClick={() => removeItem(departments[id][i].id)}
|
onClick={() =>
|
||||||
|
removeItem(
|
||||||
|
departments[id][i].id,
|
||||||
|
departments[id][i].name
|
||||||
|
)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@ -144,7 +154,7 @@ const DepartmentPage = () => {
|
|||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeItem = (id: number) => {
|
const removeItem = (id: number, label: string) => {
|
||||||
if (id === 0) {
|
if (id === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -187,7 +197,9 @@ const DepartmentPage = () => {
|
|||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
type="link"
|
type="link"
|
||||||
danger
|
danger
|
||||||
onClick={() => navigate("/course")}
|
onClick={() =>
|
||||||
|
navigate("/course?did=" + id + "&label=" + label)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
({res.data.courses.length}个线上课程),
|
({res.data.courses.length}个线上课程),
|
||||||
</Button>
|
</Button>
|
||||||
@ -197,7 +209,9 @@ const DepartmentPage = () => {
|
|||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
danger
|
danger
|
||||||
onClick={() => navigate("/member/index")}
|
onClick={() =>
|
||||||
|
navigate("/member/index?did=" + id + "&label=" + label)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
({res.data.users.length}个学员),
|
({res.data.users.length}个学员),
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { user } from "../../api/index";
|
import { user } from "../../api/index";
|
||||||
import { dateFormat } from "../../utils/index";
|
import { dateFormat } from "../../utils/index";
|
||||||
import { Link, Navigate } from "react-router-dom";
|
import { Link, Navigate, useLocation } from "react-router-dom";
|
||||||
import { TreeDepartment, PerButton } from "../../compenents";
|
import { TreeDepartment, PerButton } from "../../compenents";
|
||||||
import { MemberCreate } from "./compenents/create";
|
import { MemberCreate } from "./compenents/create";
|
||||||
import { MemberUpdate } from "./compenents/update";
|
import { MemberUpdate } from "./compenents/update";
|
||||||
@ -37,6 +37,7 @@ interface DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MemberPage = () => {
|
const MemberPage = () => {
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [size, setSize] = useState(10);
|
const [size, setSize] = useState(10);
|
||||||
@ -47,12 +48,24 @@ const MemberPage = () => {
|
|||||||
const [nickname, setNickname] = useState<string>("");
|
const [nickname, setNickname] = useState<string>("");
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
const [dep_ids, setDepIds] = useState<any>([]);
|
const [dep_ids, setDepIds] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部部门");
|
const [selLabel, setLabel] = useState<string>(
|
||||||
|
result.get("label") ? String(result.get("label")) : "全部部门"
|
||||||
|
);
|
||||||
const [createVisible, setCreateVisible] = useState<boolean>(false);
|
const [createVisible, setCreateVisible] = useState<boolean>(false);
|
||||||
const [updateVisible, setUpdateVisible] = useState<boolean>(false);
|
const [updateVisible, setUpdateVisible] = useState<boolean>(false);
|
||||||
const [mid, setMid] = useState<number>(0);
|
const [mid, setMid] = useState<number>(0);
|
||||||
const [user_dep_ids, setUserDepIds] = useState<any>({});
|
const [user_dep_ids, setUserDepIds] = useState<any>({});
|
||||||
const [departments, setDepartments] = useState<any>({});
|
const [departments, setDepartments] = useState<any>({});
|
||||||
|
const [did, setDid] = useState(Number(result.get("did")));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setDid(Number(result.get("did")));
|
||||||
|
if (Number(result.get("did"))) {
|
||||||
|
let arr = [];
|
||||||
|
arr.push(Number(result.get("did")));
|
||||||
|
setDepIds(arr);
|
||||||
|
}
|
||||||
|
}, [result.get("did")]);
|
||||||
|
|
||||||
const columns: ColumnsType<DataType> = [
|
const columns: ColumnsType<DataType> = [
|
||||||
{
|
{
|
||||||
@ -247,6 +260,7 @@ const MemberPage = () => {
|
|||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<TreeDepartment
|
<TreeDepartment
|
||||||
|
selected={dep_ids}
|
||||||
refresh={refresh}
|
refresh={refresh}
|
||||||
showNum={true}
|
showNum={true}
|
||||||
type=""
|
type=""
|
||||||
|
@ -11,6 +11,7 @@ import {
|
|||||||
Pagination,
|
Pagination,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { resource } from "../../../api";
|
import { resource } from "../../../api";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { UploadImageSub } from "../../../compenents/upload-image-button/upload-image-sub";
|
import { UploadImageSub } from "../../../compenents/upload-image-button/upload-image-sub";
|
||||||
import { TreeCategory, PerButton } from "../../../compenents";
|
import { TreeCategory, PerButton } from "../../../compenents";
|
||||||
@ -32,6 +33,7 @@ interface ImageItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ResourceImagesPage = () => {
|
const ResourceImagesPage = () => {
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const [imageList, setImageList] = useState<ImageItem[]>([]);
|
const [imageList, setImageList] = useState<ImageItem[]>([]);
|
||||||
const [refresh, setRefresh] = useState(false);
|
const [refresh, setRefresh] = useState(false);
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
@ -41,8 +43,20 @@ const ResourceImagesPage = () => {
|
|||||||
const [selectKey, setSelectKey] = useState<any>([]);
|
const [selectKey, setSelectKey] = useState<any>([]);
|
||||||
const [visibleArr, setVisibleArr] = useState<any>([]);
|
const [visibleArr, setVisibleArr] = useState<any>([]);
|
||||||
const [hoverArr, setHoverArr] = useState<any>([]);
|
const [hoverArr, setHoverArr] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部图片");
|
const [selLabel, setLabel] = useState<string>(
|
||||||
|
result.get("label") ? String(result.get("label")) : "全部图片"
|
||||||
|
);
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
|
const [cateId, setCateId] = useState(Number(result.get("cid")));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCateId(Number(result.get("cid")));
|
||||||
|
if (Number(result.get("cid"))) {
|
||||||
|
let arr = [];
|
||||||
|
arr.push(Number(result.get("cid")));
|
||||||
|
setCategoryIds(arr);
|
||||||
|
}
|
||||||
|
}, [result.get("cid")]);
|
||||||
|
|
||||||
// 删除图片
|
// 删除图片
|
||||||
const removeResource = () => {
|
const removeResource = () => {
|
||||||
@ -151,6 +165,7 @@ const ResourceImagesPage = () => {
|
|||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
selected={category_ids}
|
||||||
type="no-cate"
|
type="no-cate"
|
||||||
text={"图片"}
|
text={"图片"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
|
@ -88,7 +88,9 @@ const ResourceCategoryPage = () => {
|
|||||||
<i
|
<i
|
||||||
className="iconfont icon-icon-delete"
|
className="iconfont icon-icon-delete"
|
||||||
style={{ fontSize: 24 }}
|
style={{ fontSize: 24 }}
|
||||||
onClick={() => removeItem(categories[id][i].id)}
|
onClick={() =>
|
||||||
|
removeItem(categories[id][i].id, categories[id][i].name)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -123,7 +125,9 @@ const ResourceCategoryPage = () => {
|
|||||||
<i
|
<i
|
||||||
className="iconfont icon-icon-delete"
|
className="iconfont icon-icon-delete"
|
||||||
style={{ fontSize: 24 }}
|
style={{ fontSize: 24 }}
|
||||||
onClick={() => removeItem(categories[id][i].id)}
|
onClick={() =>
|
||||||
|
removeItem(categories[id][i].id, categories[id][i].name)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -142,7 +146,7 @@ const ResourceCategoryPage = () => {
|
|||||||
setRefresh(!refresh);
|
setRefresh(!refresh);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeItem = (id: number) => {
|
const removeItem = (id: number, label: string) => {
|
||||||
if (id === 0) {
|
if (id === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -187,7 +191,9 @@ const ResourceCategoryPage = () => {
|
|||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
type="link"
|
type="link"
|
||||||
danger
|
danger
|
||||||
onClick={() => navigate("/course")}
|
onClick={() =>
|
||||||
|
navigate("/course?cid=" + id + "&label=" + label)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
({res.data.courses.length}个线上课程),
|
({res.data.courses.length}个线上课程),
|
||||||
</Button>
|
</Button>
|
||||||
@ -197,7 +203,9 @@ const ResourceCategoryPage = () => {
|
|||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
danger
|
danger
|
||||||
onClick={() => navigate("/videos")}
|
onClick={() =>
|
||||||
|
navigate("/videos?cid=" + id + "&label=" + label)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
({res.data.videos.length}个视频文件),
|
({res.data.videos.length}个视频文件),
|
||||||
</Button>
|
</Button>
|
||||||
@ -207,7 +215,9 @@ const ResourceCategoryPage = () => {
|
|||||||
type="link"
|
type="link"
|
||||||
style={{ paddingLeft: 4, paddingRight: 4 }}
|
style={{ paddingLeft: 4, paddingRight: 4 }}
|
||||||
danger
|
danger
|
||||||
onClick={() => navigate("/images")}
|
onClick={() =>
|
||||||
|
navigate("/images?cid=" + id + "&label=" + label)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
({res.data.images.length}个图片文件),
|
({res.data.images.length}个图片文件),
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
|
|||||||
import { Modal, Table, message, Space } from "antd";
|
import { Modal, Table, message, Space } from "antd";
|
||||||
import { resource } from "../../../api";
|
import { resource } from "../../../api";
|
||||||
// import styles from "./index.module.less";
|
// import styles from "./index.module.less";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
import { ExclamationCircleFilled } from "@ant-design/icons";
|
import { ExclamationCircleFilled } from "@ant-design/icons";
|
||||||
import type { ColumnsType } from "antd/es/table";
|
import type { ColumnsType } from "antd/es/table";
|
||||||
import { dateFormat } from "../../../utils/index";
|
import { dateFormat } from "../../../utils/index";
|
||||||
@ -18,6 +19,7 @@ interface DataType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ResourceVideosPage = () => {
|
const ResourceVideosPage = () => {
|
||||||
|
const result = new URLSearchParams(useLocation().search);
|
||||||
const [videoList, setVideoList] = useState<any>([]);
|
const [videoList, setVideoList] = useState<any>([]);
|
||||||
const [videosExtra, setVideoExtra] = useState<any>([]);
|
const [videosExtra, setVideoExtra] = useState<any>([]);
|
||||||
const [adminUsers, setAdminUsers] = useState<any>({});
|
const [adminUsers, setAdminUsers] = useState<any>({});
|
||||||
@ -27,7 +29,19 @@ const ResourceVideosPage = () => {
|
|||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
const [category_ids, setCategoryIds] = useState<any>([]);
|
const [category_ids, setCategoryIds] = useState<any>([]);
|
||||||
const [selLabel, setLabel] = useState<string>("全部视频");
|
const [selLabel, setLabel] = useState<string>(
|
||||||
|
result.get("label") ? String(result.get("label")) : "全部视频"
|
||||||
|
);
|
||||||
|
const [cateId, setCateId] = useState(Number(result.get("cid")));
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCateId(Number(result.get("cid")));
|
||||||
|
if (Number(result.get("cid"))) {
|
||||||
|
let arr = [];
|
||||||
|
arr.push(Number(result.get("cid")));
|
||||||
|
setCategoryIds(arr);
|
||||||
|
}
|
||||||
|
}, [result.get("cid")]);
|
||||||
|
|
||||||
const columns: ColumnsType<DataType> = [
|
const columns: ColumnsType<DataType> = [
|
||||||
// {
|
// {
|
||||||
@ -170,6 +184,7 @@ const ResourceVideosPage = () => {
|
|||||||
<div className="tree-main-body">
|
<div className="tree-main-body">
|
||||||
<div className="left-box">
|
<div className="left-box">
|
||||||
<TreeCategory
|
<TreeCategory
|
||||||
|
selected={category_ids}
|
||||||
type="no-cate"
|
type="no-cate"
|
||||||
text={"视频"}
|
text={"视频"}
|
||||||
onUpdate={(keys: any, title: any) => {
|
onUpdate={(keys: any, title: any) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user