From 86eb59622d794eeca336cf4c348e3fa3b60a0fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Wed, 22 Mar 2023 17:23:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E5=91=98=E5=88=97=E8=A1=A8=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compenents/header/index.module.less | 1 + src/pages/course/index.tsx | 8 +- src/pages/home/index.module.less | 11 ++- src/pages/member/index.tsx | 102 +++++++++++++----------- 4 files changed, 65 insertions(+), 57 deletions(-) diff --git a/src/compenents/header/index.module.less b/src/compenents/header/index.module.less index b49cff5..fe7025a 100644 --- a/src/compenents/header/index.module.less +++ b/src/compenents/header/index.module.less @@ -1,4 +1,5 @@ .app-header { + width: 100%; background-color: white !important; box-sizing: border-box; -moz-box-sizing: border-box; diff --git a/src/pages/course/index.tsx b/src/pages/course/index.tsx index cd9864c..87de746 100644 --- a/src/pages/course/index.tsx +++ b/src/pages/course/index.tsx @@ -50,7 +50,7 @@ export const CoursePage = () => { const [category_ids, setCategoryIds] = useState([]); const [title, setTitle] = useState(""); const [dep_ids, setDepIds] = useState([]); - const [selLabel, setLabel] = useState("全部课程"); + const [selLabel, setLabel] = useState("全部分类"); const [course_category_ids, setCourseCategoryIds] = useState({}); const [course_dep_ids, setCourseDepIds] = useState({}); const [categories, setCategories] = useState({}); @@ -70,7 +70,7 @@ export const CoursePage = () => {
{ setCategoryIds(keys); if (typeof title == "string") { @@ -341,7 +341,9 @@ export const CoursePage = () => { />
-
{selLabel}
+
+ 课程/{selLabel} +
{ const navigate = useNavigate(); - const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [loading, setLoading] = useState(true); const [page, setPage] = useState(1); const [size, setSize] = useState(10); @@ -33,34 +41,55 @@ export const MemberPage: React.FC = () => { const [nickname, setNickname] = useState(""); const [email, setEmail] = useState(""); - const [id_card, setIdCard] = useState(""); const [dep_ids, setDepIds] = useState([]); const [selLabel, setLabel] = useState("全部部门"); const [createVisible, setCreateVisible] = useState(false); const [updateVisible, setUpdateVisible] = useState(false); const [mid, setMid] = useState(0); + const [course_dep_ids, setCourseDepIds] = useState({}); + const [departments, setDepartments] = useState({}); const columns: ColumnsType = [ { - title: "ID", - key: "id", - dataIndex: "id", - }, - { - title: "姓名", + title: "学员姓名", dataIndex: "name", - render: (text: string) => {text}, + render: (_, record: any) => ( + <> + + {record.name} + + ), }, { - title: "邮箱", + title: "所属部门", + dataIndex: "id", + render: (id: number) => ( +
+ {course_dep_ids[id] && + course_dep_ids[id].map((item: any, index: number) => { + return ( + + {index === course_dep_ids[id].length - 1 + ? departments[item] + : departments[item] + "、"} + + ); + })} +
+ ), + }, + { + title: "登录邮箱", dataIndex: "email", }, { - title: "身份证号", - dataIndex: "id_card", - }, - { - title: "注册时间", + title: "加入时间", dataIndex: "created_at", render: (text: string) => {dateFormat(text)}, }, @@ -102,11 +131,6 @@ export const MemberPage: React.FC = () => { getData(); }, [refresh, page, size, dep_ids]); - const onSelectChange = (newSelectedRowKeys: React.Key[]) => { - console.log("selectedRowKeys changed: ", newSelectedRowKeys); - setSelectedRowKeys(newSelectedRowKeys); - }; - const getData = () => { let depIds = dep_ids.join(","); setLoading(true); @@ -114,32 +138,25 @@ export const MemberPage: React.FC = () => { .userList(page, size, { name: nickname, email: email, - id_card: id_card, + id_card: "", dep_ids: depIds, }) .then((res: any) => { setList(res.data.data); setTotal(res.data.total); setLoading(false); - setSelectedRowKeys([]); }); }; const resetData = () => { setNickname(""); setEmail(""); - setIdCard(""); setPage(1); setSize(10); setList([]); setRefresh(!refresh); }; - const rowSelection = { - selectedRowKeys, - onChange: onSelectChange, - }; - const paginationProps = { current: page, //当前页码 pageSize: size, @@ -177,7 +194,6 @@ export const MemberPage: React.FC = () => { }); }; - const hasSelected = selectedRowKeys.length > 0; return ( <>
@@ -192,7 +208,9 @@ export const MemberPage: React.FC = () => { />
-
{selLabel}
+
+ 学员/{selLabel} +
{ /> { setNickname(e.target.value); }} style={{ width: 160 }} - placeholder="请输入姓名" + placeholder="请输入姓名关键字" />
@@ -236,21 +254,10 @@ export const MemberPage: React.FC = () => { setEmail(e.target.value); }} style={{ width: 160 }} - placeholder="请输入邮箱" + placeholder="请输入邮箱账号" />
-
- 身份证号: - { - setIdCard(e.target.value); - }} - style={{ width: 160 }} - placeholder="请输入身份证号" - /> -
-
+
@@ -268,7 +275,6 @@ export const MemberPage: React.FC = () => {