线上课编辑页面上架时间优化

This commit is contained in:
unknown 2023-09-06 09:42:06 +08:00
parent 780e73c029
commit fc9682c31d
3 changed files with 15 additions and 14 deletions

View File

@ -695,7 +695,7 @@ export const CourseCreate: React.FC<PropInterface> = ({
form.setFieldsValue({ thumb: url });
}}
></UploadImageButton>
<span className="helper-text ml-16">
<span className="helper-text ml-8">
推荐尺寸:400x300px
</span>
</div>

View File

@ -96,8 +96,8 @@ 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")
published_at: res.data.course.published_at
? dayjs(res.data.course.published_at, "YYYY-MM-DD HH:mm:ss")
: "",
});
setType(type);
@ -188,6 +188,10 @@ export const CourseUpdate: React.FC<PropInterface> = ({
setType(e.target.value);
};
const disabledDate = (current: any) => {
return current && current >= moment().add(0, "days"); // 选择时间要大于等于当前天。若今天不能被选择,去掉等号即可。
};
return (
<>
{open ? (
@ -388,7 +392,7 @@ export const CourseUpdate: React.FC<PropInterface> = ({
form.setFieldsValue({ thumb: url });
}}
></UploadImageButton>
<span className="helper-text ml-16">
<span className="helper-text ml-8">
推荐尺寸:400x300px
</span>
</div>
@ -403,22 +407,19 @@ export const CourseUpdate: React.FC<PropInterface> = ({
maxLength={200}
/>
</Form.Item>
<Form.Item label="上架时间" required={true}>
<Form.Item label="上架时间">
<Space align="baseline" style={{ height: 32 }}>
<Form.Item
name="published_at"
rules={[{ required: true, message: "请选择上架时间!" }]}
>
<Form.Item name="published_at">
<DatePicker
disabledDate={disabledDate}
format="YYYY-MM-DD HH:mm:ss"
style={{ width: 240 }}
showTime
placeholder="请选择上架时间"
/>
</Form.Item>
<div className="helper-text ml-24">
<div className="helper-text">
</div>
</Space>
</Form.Item>

View File

@ -200,8 +200,8 @@ const CoursePage = () => {
),
},
{
title: "创建时间",
dataIndex: "created_at",
title: "上架时间",
dataIndex: "published_at",
render: (text: string) => <span>{dateFormat(text)}</span>,
},
{