mirror of
https://github.com/PlayEdu/backend
synced 2025-07-08 18:54:14 +08:00
编辑线上课增加上架时间属性
This commit is contained in:
parent
39faf98551
commit
d4c8032b2d
@ -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")
|
||||||
|
: "",
|
||||||
});
|
});
|
||||||
setType(type);
|
setType(type);
|
||||||
setThumb(res.data.course.thumb);
|
setThumb(res.data.course.thumb);
|
||||||
@ -146,6 +152,9 @@ export const CourseUpdate: React.FC<PropInterface> = ({
|
|||||||
if (type === "elective") {
|
if (type === "elective") {
|
||||||
dep_ids = values.dep_ids;
|
dep_ids = values.dep_ids;
|
||||||
}
|
}
|
||||||
|
values.published_at = moment(new Date(values.published_at)).format(
|
||||||
|
"YYYY-MM-DD HH:mm"
|
||||||
|
);
|
||||||
course
|
course
|
||||||
.updateCourse(
|
.updateCourse(
|
||||||
id,
|
id,
|
||||||
@ -157,7 +166,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 +394,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"
|
||||||
|
style={{ width: 240 }}
|
||||||
|
showTime
|
||||||
|
placeholder="请选择上架时间"
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
|
||||||
|
<div className="helper-text ml-24">
|
||||||
|
上架时间越晚,排序越靠前
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</div>
|
</div>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user