mirror of
https://github.com/PlayEdu/backend
synced 2025-06-29 12:55:14 +08:00
编辑线上课增加上架时间属性
This commit is contained in:
parent
39faf98551
commit
d4c8032b2d
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
: "",
|
||||
});
|
||||
setType(type);
|
||||
setThumb(res.data.course.thumb);
|
||||
@ -146,6 +152,9 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
||||
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<PropInterface> = ({
|
||||
dep_ids,
|
||||
values.category_ids,
|
||||
[],
|
||||
[]
|
||||
[],
|
||||
values.published_at
|
||||
)
|
||||
.then((res: any) => {
|
||||
message.success("保存成功!");
|
||||
@ -384,6 +394,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"
|
||||
style={{ width: 240 }}
|
||||
showTime
|
||||
placeholder="请选择上架时间"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
<div className="helper-text ml-24">
|
||||
上架时间越晚,排序越靠前
|
||||
</div>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</div>
|
||||
</Drawer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user