mirror of
https://github.com/PlayEdu/backend
synced 2025-06-29 02:52:31 +08:00
commit
c7977f2956
@ -66,7 +66,8 @@ export function updateCourse(
|
|||||||
depIds: number[],
|
depIds: number[],
|
||||||
categoryIds: number[],
|
categoryIds: number[],
|
||||||
chapters: number[],
|
chapters: number[],
|
||||||
hours: number[]
|
hours: number[],
|
||||||
|
publishedAt: string
|
||||||
) {
|
) {
|
||||||
return client.put(`/backend/v1/course/${id}`, {
|
return client.put(`/backend/v1/course/${id}`, {
|
||||||
title: title,
|
title: title,
|
||||||
@ -78,6 +79,7 @@ export function updateCourse(
|
|||||||
category_ids: categoryIds,
|
category_ids: categoryIds,
|
||||||
chapters: chapters,
|
chapters: chapters,
|
||||||
hours: hours,
|
hours: hours,
|
||||||
|
published_at: publishedAt,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
Drawer,
|
Drawer,
|
||||||
Form,
|
Form,
|
||||||
TreeSelect,
|
TreeSelect,
|
||||||
|
DatePicker,
|
||||||
Input,
|
Input,
|
||||||
message,
|
message,
|
||||||
Image,
|
Image,
|
||||||
@ -15,6 +16,8 @@ import styles from "./update.module.less";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { course, department } from "../../../api/index";
|
import { course, department } from "../../../api/index";
|
||||||
import { UploadImageButton } from "../../../compenents";
|
import { UploadImageButton } from "../../../compenents";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
interface PropInterface {
|
interface PropInterface {
|
||||||
id: number;
|
id: number;
|
||||||
@ -93,6 +96,9 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
type: type,
|
type: type,
|
||||||
short_desc: res.data.course.short_desc,
|
short_desc: res.data.course.short_desc,
|
||||||
hasChapter: chapterType,
|
hasChapter: chapterType,
|
||||||
|
published_at: res.data.published_at
|
||||||
|
? dayjs(res.data.published_at, "YYYY-MM-DD HH:mm:ss")
|
||||||
|
: "",
|
||||||
});
|
});
|
||||||
setType(type);
|
setType(type);
|
||||||
setThumb(res.data.course.thumb);
|
setThumb(res.data.course.thumb);
|
||||||
@ -157,7 +163,8 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
dep_ids,
|
dep_ids,
|
||||||
values.category_ids,
|
values.category_ids,
|
||||||
[],
|
[],
|
||||||
[]
|
[],
|
||||||
|
values.published_at
|
||||||
)
|
)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
message.success("保存成功!");
|
message.success("保存成功!");
|
||||||
@ -384,6 +391,25 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
maxLength={200}
|
maxLength={200}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item label="上架时间" required={true}>
|
||||||
|
<Space align="baseline" style={{ height: 32 }}>
|
||||||
|
<Form.Item
|
||||||
|
name="published_at"
|
||||||
|
rules={[{ required: true, message: "请选择上架时间!" }]}
|
||||||
|
>
|
||||||
|
<DatePicker
|
||||||
|
format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
style={{ width: 240 }}
|
||||||
|
showTime
|
||||||
|
placeholder="请选择上架时间"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<div className="helper-text ml-24">
|
||||||
|
上架时间越晚,排序越靠前
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
@ -141,6 +141,34 @@ const SystemConfigPage = () => {
|
|||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
"minio.domain": configData[i].key_value,
|
"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);
|
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"] = [
|
const items: TabsProps["items"] = [
|
||||||
{
|
{
|
||||||
key: "1",
|
key: "1",
|
||||||
@ -639,6 +675,100 @@ const SystemConfigPage = () => {
|
|||||||
</Form>
|
</Form>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "5",
|
||||||
|
label: `LDAP配置`,
|
||||||
|
children: (
|
||||||
|
<Form
|
||||||
|
form={form}
|
||||||
|
name="LDAP-basic"
|
||||||
|
labelCol={{ span: 3 }}
|
||||||
|
wrapperCol={{ span: 21 }}
|
||||||
|
style={{ width: 1000, paddingTop: 30 }}
|
||||||
|
onFinish={onFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
autoComplete="off"
|
||||||
|
>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
label="启用"
|
||||||
|
name="ldap.enabled"
|
||||||
|
valuePropName="checked"
|
||||||
|
>
|
||||||
|
<Switch onChange={onLDAPChange} />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{ marginBottom: 30 }} label="服务地址">
|
||||||
|
<Space align="baseline" style={{ height: 32 }}>
|
||||||
|
<Form.Item name="ldap.url">
|
||||||
|
<Input
|
||||||
|
style={{ width: 274 }}
|
||||||
|
allowClear
|
||||||
|
placeholder="请填写服务地址"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<div className="helper-text ml-24">
|
||||||
|
LDAP的对外服务地址。例如:ldap.example.com
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{ marginBottom: 30 }} label="用户名">
|
||||||
|
<Space align="baseline" style={{ height: 32 }}>
|
||||||
|
<Form.Item name="ldap.admin_user">
|
||||||
|
<Input
|
||||||
|
style={{ width: 274 }}
|
||||||
|
allowClear
|
||||||
|
placeholder="请填写用户名"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<div className="helper-text ml-24">
|
||||||
|
用户登录到LDAP。例子:cn=admin,dc=playedu,dc=xyz
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
name="ldap.admin_pass"
|
||||||
|
label="密码"
|
||||||
|
>
|
||||||
|
<Input style={{ width: 274 }} allowClear placeholder="请填写密码" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{ marginBottom: 30 }} label="基本DN">
|
||||||
|
<Space align="baseline" style={{ height: 32 }}>
|
||||||
|
<Form.Item name="ldap.base_dn">
|
||||||
|
<Input
|
||||||
|
style={{ width: 274 }}
|
||||||
|
allowClear
|
||||||
|
placeholder="请填写基本DN"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<div className="helper-text ml-24">从LDAP根节点搜索用户</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item style={{ marginBottom: 30 }} label="附件用户DN">
|
||||||
|
<Space align="baseline" style={{ height: 32 }}>
|
||||||
|
<Form.Item name="ldap.user_dn_prefix">
|
||||||
|
<Input
|
||||||
|
style={{ width: 274 }}
|
||||||
|
allowClear
|
||||||
|
placeholder="请填写基本DN"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<div className="helper-text ml-24">
|
||||||
|
搜索用户时,基于基础DN的搜索范围限制
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
wrapperCol={{ offset: 3, span: 21 }}
|
||||||
|
>
|
||||||
|
<Button type="primary" htmlType="submit" loading={loading}>
|
||||||
|
保存
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const onChange = (key: string) => {
|
const onChange = (key: string) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user