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..4b33f05 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:ss") + : "", }); setType(type); setThumb(res.data.course.thumb); @@ -157,7 +163,8 @@ export const CourseUpdate: React.FC = ({ dep_ids, values.category_ids, [], - [] + [], + values.published_at ) .then((res: any) => { message.success("保存成功!"); @@ -384,6 +391,25 @@ export const CourseUpdate: React.FC = ({ maxLength={200} /> + + + + + + +
+ 上架时间越晚,排序越靠前 +
+
+
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) => {