Merge pull request !4 from 白书科技/fix/0904
This commit is contained in:
白书科技 2023-09-04 09:10:05 +00:00 committed by Gitee
commit c7977f2956
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 160 additions and 2 deletions

View File

@ -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,
});
}

View File

@ -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<PropInterface> = ({
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<PropInterface> = ({
dep_ids,
values.category_ids,
[],
[]
[],
values.published_at
)
.then((res: any) => {
message.success("保存成功!");
@ -384,6 +391,25 @@ export const CourseUpdate: React.FC<PropInterface> = ({
maxLength={200}
/>
</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>
</div>
</Drawer>

View File

@ -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 = () => {
</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">
LDAPcn=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) => {