From 5bc78f6192fdc16c30e518983b0a5064a20585ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Fri, 10 Mar 2023 18:46:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=88=97=E8=A1=A8=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/tree-category/index.tsx | 37 +++-- src/compenents/upload-image-button/index.tsx | 2 +- src/index.less | 51 +++++++ src/pages/course/index.tsx | 5 +- src/pages/resource/images/index.tsx | 135 +++++++++---------- src/pages/resource/videos/index.tsx | 81 ++++++----- 6 files changed, 186 insertions(+), 125 deletions(-) diff --git a/src/compenents/tree-category/index.tsx b/src/compenents/tree-category/index.tsx index f263bdd..c199d11 100644 --- a/src/compenents/tree-category/index.tsx +++ b/src/compenents/tree-category/index.tsx @@ -10,24 +10,20 @@ interface Option { } interface PropInterface { + text: string; onUpdate: (keys: any) => void; } export const TreeCategory = (props: PropInterface) => { const [treeData, setTreeData] = useState([]); const [loading, setLoading] = useState(true); + const [selectKey, setSelectKey] = useState([]); useEffect(() => { setLoading(true); resourceCategory.resourceCategoryList().then((res: any) => { const categories = res.data.categories; if (JSON.stringify(categories) !== "{}") { - const new_arr: Option[] = [ - { - key: "", - title: "全部", - children: checkArr(categories, 0), - }, - ]; + const new_arr: Option[] = checkArr(categories, 0); setTreeData(new_arr); } else { const new_arr: Option[] = [ @@ -65,6 +61,7 @@ export const TreeCategory = (props: PropInterface) => { const onSelect = (selectedKeys: any, info: any) => { props.onUpdate(selectedKeys); + setSelectKey(selectedKeys); }; const onDragEnter: TreeProps["onDragEnter"] = (info) => { @@ -80,12 +77,24 @@ export const TreeCategory = (props: PropInterface) => { }; return ( - +
+
onSelect([], "")} + > + 全部{props.text} +
+ +
); }; diff --git a/src/compenents/upload-image-button/index.tsx b/src/compenents/upload-image-button/index.tsx index 6e36056..b7dc097 100644 --- a/src/compenents/upload-image-button/index.tsx +++ b/src/compenents/upload-image-button/index.tsx @@ -97,7 +97,7 @@ export const UploadImageButton = (props: PropsInterface) => { > - setCategoryIds(keys)} /> + setCategoryIds(keys)} /> diff --git a/src/index.less b/src/index.less index 0be2a5d..7dad59b 100644 --- a/src/index.less +++ b/src/index.less @@ -32,6 +32,10 @@ code { margin-right: 16px; } +.mb-8 { + margin-bottom: 8px; +} + .mb-10 { margin-bottom: 10px; } @@ -117,6 +121,22 @@ code { color: @primaryColor; } +.category-label { + width: 100%; + height: 40px; + border-radius: 6px; + font-size: 14px; + font-weight: 500; + color: rgba(0, 0, 0, 0.88); + line-height: 40px; + box-sizing: border-box; + padding-left: 16px; + cursor: pointer; + &.active { + background: rgba(#ff4d4f, 0.1); + } +} + .form-avatar { width: 100px; height: 100px; @@ -160,6 +180,37 @@ code { } } +.tree-main-body { + width: 100%; + height: auto; + min-height: calc(100vh - 172px); + float: left; + box-sizing: border-box; + border-radius: 12px; + display: flex; + flex-direction: row; + overflow: hidden; + .left-box { + width: 250px; + float: left; + height: auto; + min-height: calc(100vh - 172px); + border-right: 1px solid #f6f6f6; + box-sizing: border-box; + padding: 24px 16px; + background-color: white; + } + .right-box { + width: calc(100% - 251px); + float: left; + height: auto; + min-height: calc(100vh - 172px); + box-sizing: border-box; + padding: 24px; + background-color: white; + } +} + .ant-menu, .ant-menu-sub, .ant-menu-inline { diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index e530d32..0380cb7 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -172,7 +172,10 @@ export const CoursePage = () => {
资源分类:
- setCategoryIds(keys)} /> + setCategoryIds(keys)} + />
diff --git a/src/pages/resource/images/index.tsx b/src/pages/resource/images/index.tsx index 00d4704..dfad31f 100644 --- a/src/pages/resource/images/index.tsx +++ b/src/pages/resource/images/index.tsx @@ -74,79 +74,78 @@ export const ResourceImagesPage = () => { return ( <> - - -
- setCategoryIds(keys)} /> +
+
+ setCategoryIds(keys)} + /> +
+
+
+ 图片 / 全部图片
- - -
-
- 图片 / 全部图片 -
- + + + { + resetImageList(); + }} + > + + + + {imageList.length === 0 && ( - { - resetImageList(); - }} - > + - - - {imageList.length === 0 && ( - - - - )} + )} - {imageList.map((item) => ( - -
- - removeResource(item.id)} - okText="确定" - cancelText="取消" - > -
- - ))} - - {imageList.length > 0 && ( - - { - setPage(currentPage); - setSize(currentSize); - }} - defaultCurrent={page} - total={total} - pageSize={size} + {imageList.map((item) => ( + +
+ - - )} - -
- -
+ removeResource(item.id)} + okText="确定" + cancelText="取消" + > +
+ + ))} + + {imageList.length > 0 && ( + + { + setPage(currentPage); + setSize(currentSize); + }} + defaultCurrent={page} + total={total} + pageSize={size} + /> + + )} + +
+
); }; diff --git a/src/pages/resource/videos/index.tsx b/src/pages/resource/videos/index.tsx index 45eb200..c8ff27f 100644 --- a/src/pages/resource/videos/index.tsx +++ b/src/pages/resource/videos/index.tsx @@ -38,18 +38,18 @@ export const ResourceVideosPage = () => { const [category_ids, setCategoryIds] = useState([]); const columns: ColumnsType = [ - { - title: "封面", - dataIndex: "id", - render: (id: string) => ( - - ), - }, + // { + // title: "封面", + // dataIndex: "id", + // render: (id: string) => ( + // + // ), + // }, { title: "视频名称", dataIndex: "name", @@ -158,37 +158,36 @@ export const ResourceVideosPage = () => { return ( <> - - -
- setCategoryIds(keys)} /> +
+
+ setCategoryIds(keys)} + /> +
+
+
+ 视频 / 后端课程
- - -
-
- 视频 / 后端课程 -
-
- { - resetVideoList(); - }} - > -
-
- record.id} - /> - +
+ { + resetVideoList(); + }} + >
- - +
+
record.id} + /> + + + ); };