图片、视频label联动

This commit is contained in:
禺狨 2023-03-14 10:00:36 +08:00
parent 52126882ee
commit 558407b34f
5 changed files with 42 additions and 22 deletions

View File

@ -61,8 +61,8 @@ const items = [
<i className="iconfont icon-icon-setting" />, <i className="iconfont icon-icon-setting" />,
[ [
getItem("管理人员", "/system/administrator", null, null, null), getItem("管理人员", "/system/administrator", null, null, null),
getItem("系统配置", "/system/index", null, null, null),
getItem("角色配置", "/system/adminroles", null, null, null), getItem("角色配置", "/system/adminroles", null, null, null),
getItem("系统配置", "/system/index", null, null, null),
], ],
null null
), ),

View File

@ -10,7 +10,7 @@ interface Option {
interface PropInterface { interface PropInterface {
text: string; text: string;
onUpdate: (keys: any) => void; onUpdate: (keys: any, title: any) => void;
} }
export const TreeCategory = (props: PropInterface) => { export const TreeCategory = (props: PropInterface) => {
@ -59,7 +59,11 @@ export const TreeCategory = (props: PropInterface) => {
}; };
const onSelect = (selectedKeys: any, info: any) => { const onSelect = (selectedKeys: any, info: any) => {
props.onUpdate(selectedKeys); let label = "全部" + props.text;
if (info) {
label = info.node.title;
}
props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys); setSelectKey(selectedKeys);
}; };
@ -75,7 +79,7 @@ export const TreeCategory = (props: PropInterface) => {
> >
{props.text} {props.text}
</div> </div>
<Tree onSelect={onSelect} treeData={treeData} /> <Tree onSelect={onSelect} treeData={treeData} />
</div> </div>
); );
}; };

View File

@ -10,7 +10,7 @@ interface Option {
interface PropInterface { interface PropInterface {
text: string; text: string;
onUpdate: (keys: any) => void; onUpdate: (keys: any, title: any) => void;
} }
export const TreeDepartment = (props: PropInterface) => { export const TreeDepartment = (props: PropInterface) => {
@ -60,7 +60,11 @@ export const TreeDepartment = (props: PropInterface) => {
}; };
const onSelect = (selectedKeys: any, info: any) => { const onSelect = (selectedKeys: any, info: any) => {
props.onUpdate(selectedKeys); let label = "全部" + props.text;
if (info) {
label = info.node.title;
}
props.onUpdate(selectedKeys, label);
setSelectKey(selectedKeys); setSelectKey(selectedKeys);
}; };

View File

@ -40,6 +40,7 @@ export 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 removeResource = () => { const removeResource = () => {
@ -142,12 +143,15 @@ export const ResourceImagesPage = () => {
<div className="left-box"> <div className="left-box">
<TreeCategory <TreeCategory
text={"图片"} text={"图片"}
onUpdate={(keys: any) => setCategoryIds(keys)} onUpdate={(keys: any, title: any) => {
setCategoryIds(keys);
setLabel(title);
}}
/> />
</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">
/ / {selLabel}
</div> </div>
<Row gutter={16} style={{ marginBottom: 24 }}> <Row gutter={16} style={{ marginBottom: 24 }}>
<Col span={24}> <Col span={24}>
@ -164,18 +168,22 @@ export const ResourceImagesPage = () => {
</Button> </Button>
)} )}
<Button className="mr-16" onClick={() => selectAll()}> {imageList.length !== 0 && (
<>
</Button> <Button className="mr-16" onClick={() => selectAll()}>
<PerButton
disabled={selectKey.length === 0} </Button>
type="primary" <PerButton
text="删除" disabled={selectKey.length === 0}
class="" type="primary"
icon={null} text="删除"
p="resource-destroy" class=""
onClick={() => removeResource()} icon={null}
/> p="resource-destroy"
onClick={() => removeResource()}
/>
</>
)}
</div> </div>
</div> </div>
</Col> </Col>

View File

@ -28,6 +28,7 @@ export 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 columns: ColumnsType<DataType> = [ const columns: ColumnsType<DataType> = [
// { // {
@ -165,12 +166,15 @@ export const ResourceVideosPage = () => {
<div className="left-box"> <div className="left-box">
<TreeCategory <TreeCategory
text={"视频"} text={"视频"}
onUpdate={(keys: any) => setCategoryIds(keys)} onUpdate={(keys: any, title: any) => {
setCategoryIds(keys);
setLabel(title);
}}
/> />
</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">
/ / {selLabel}
</div> </div>
<div className="float-left mb-24"> <div className="float-left mb-24">
<UploadVideoButton <UploadVideoButton