From 39faf98551359336226929a73f640039cd9c0188 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 4 Sep 2023 16:25:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0LDAP=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/config/index.tsx | 130 ++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/src/pages/system/config/index.tsx b/src/pages/system/config/index.tsx index 024b678..bea40aa 100644 --- a/src/pages/system/config/index.tsx +++ b/src/pages/system/config/index.tsx @@ -141,6 +141,34 @@ const SystemConfigPage = () => { form.setFieldsValue({ "minio.domain": configData[i].key_value, }); + } else if (configData[i].key_name === "ldap.enabled") { + let value = 0; + if (configData[i].key_value === "1") { + value = 1; + } + form.setFieldsValue({ + "ldap.enabled": value, + }); + } else if (configData[i].key_name === "ldap.url") { + form.setFieldsValue({ + "ldap.url": configData[i].key_value, + }); + } else if (configData[i].key_name === "ldap.admin_user") { + form.setFieldsValue({ + "ldap.admin_user": configData[i].key_value, + }); + } else if (configData[i].key_name === "ldap.admin_pass") { + form.setFieldsValue({ + "ldap.admin_pass": configData[i].key_value, + }); + } else if (configData[i].key_name === "ldap.base_dn") { + form.setFieldsValue({ + "ldap.base_dn": configData[i].key_value, + }); + } else if (configData[i].key_name === "ldap.user_dn_prefix") { + form.setFieldsValue({ + "ldap.user_dn_prefix": configData[i].key_value, + }); } } }); @@ -218,6 +246,14 @@ const SystemConfigPage = () => { console.log("Failed:", errorInfo); }; + const onLDAPChange = (checked: boolean) => { + if (checked) { + form.setFieldsValue({ "ldap.enabled": 1 }); + } else { + form.setFieldsValue({ "ldap.enabled": 0 }); + } + }; + const items: TabsProps["items"] = [ { key: "1", @@ -639,6 +675,100 @@ const SystemConfigPage = () => { ), }, + { + key: "5", + label: `LDAP配置`, + children: ( +
+ + + + + + + + +
+ LDAP的对外服务地址。例如:ldap.example.com +
+
+
+ + + + + +
+ 用户登录到LDAP。例子:cn=admin,dc=playedu,dc=xyz +
+
+
+ + + + + + + + +
从LDAP根节点搜索用户
+
+
+ + + + + +
+ 搜索用户时,基于基础DN的搜索范围限制 +
+
+
+ + + +
+ ), + }, ]; const onChange = (key: string) => { From d4c8032b2db1d85147c416ea702fa917384c3316 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 4 Sep 2023 16:35:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BA=BF=E4=B8=8A?= =?UTF-8?q?=E8=AF=BE=E5=A2=9E=E5=8A=A0=E4=B8=8A=E6=9E=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/course.ts | 4 +++- src/pages/course/compenents/update.tsx | 31 +++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/api/course.ts b/src/api/course.ts index 3c55ecb..68080ba 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -66,7 +66,8 @@ export function updateCourse( depIds: number[], categoryIds: number[], chapters: number[], - hours: number[] + hours: number[], + publishedAt: string ) { return client.put(`/backend/v1/course/${id}`, { title: title, @@ -78,6 +79,7 @@ export function updateCourse( category_ids: categoryIds, chapters: chapters, hours: hours, + published_at: publishedAt, }); } diff --git a/src/pages/course/compenents/update.tsx b/src/pages/course/compenents/update.tsx index 60fce1f..37c0c90 100644 --- a/src/pages/course/compenents/update.tsx +++ b/src/pages/course/compenents/update.tsx @@ -6,6 +6,7 @@ import { Drawer, Form, TreeSelect, + DatePicker, Input, message, Image, @@ -15,6 +16,8 @@ import styles from "./update.module.less"; import { useSelector } from "react-redux"; import { course, department } from "../../../api/index"; import { UploadImageButton } from "../../../compenents"; +import dayjs from "dayjs"; +import moment from "moment"; interface PropInterface { id: number; @@ -93,6 +96,9 @@ export const CourseUpdate: React.FC = ({ type: type, short_desc: res.data.course.short_desc, hasChapter: chapterType, + published_at: res.data.published_at + ? dayjs(res.data.published_at, "YYYY-MM-DD HH:mm") + : "", }); setType(type); setThumb(res.data.course.thumb); @@ -146,6 +152,9 @@ export const CourseUpdate: React.FC = ({ if (type === "elective") { dep_ids = values.dep_ids; } + values.published_at = moment(new Date(values.published_at)).format( + "YYYY-MM-DD HH:mm" + ); course .updateCourse( id, @@ -157,7 +166,8 @@ export const CourseUpdate: React.FC = ({ dep_ids, values.category_ids, [], - [] + [], + values.published_at ) .then((res: any) => { message.success("保存成功!"); @@ -384,6 +394,25 @@ export const CourseUpdate: React.FC = ({ maxLength={200} /> + + + + + + +
+ 上架时间越晚,排序越靠前 +
+
+
From 34ab5aa28234062617bc306ba9a59525e6cc794c Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Mon, 4 Sep 2023 16:40:38 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BA=BF=E4=B8=8A?= =?UTF-8?q?=E8=AF=BE=E5=A2=9E=E5=8A=A0=E4=B8=8A=E6=9E=B6=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/compenents/update.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/course/compenents/update.tsx b/src/pages/course/compenents/update.tsx index 37c0c90..4b33f05 100644 --- a/src/pages/course/compenents/update.tsx +++ b/src/pages/course/compenents/update.tsx @@ -97,7 +97,7 @@ export const CourseUpdate: React.FC = ({ short_desc: res.data.course.short_desc, hasChapter: chapterType, published_at: res.data.published_at - ? dayjs(res.data.published_at, "YYYY-MM-DD HH:mm") + ? dayjs(res.data.published_at, "YYYY-MM-DD HH:mm:ss") : "", }); setType(type); @@ -152,9 +152,6 @@ export const CourseUpdate: React.FC = ({ if (type === "elective") { dep_ids = values.dep_ids; } - values.published_at = moment(new Date(values.published_at)).format( - "YYYY-MM-DD HH:mm" - ); course .updateCourse( id, @@ -401,7 +398,7 @@ export const CourseUpdate: React.FC = ({ rules={[{ required: true, message: "请选择上架时间!" }]} >