Merge branch 'fix/1101' into fix/1108

This commit is contained in:
unknown 2023-11-08 16:18:48 +08:00
commit f7fe5e35f4
4 changed files with 37 additions and 15 deletions

View File

@ -234,7 +234,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
const arr = [...chapters]; const arr = [...chapters];
if (arr[index].id) { if (arr[index].id) {
courseChapter courseChapter
.updateCourseChapter(id, Number(arr[index].id), value, arr.length) .updateCourseChapter(id, Number(arr[index].id), value, index + 1)
.then((res: any) => { .then((res: any) => {
console.log("ok"); console.log("ok");
getDetail(); getDetail();

View File

@ -96,23 +96,35 @@ export const TreeHours = (props: PropInterface) => {
// Find dragObject // Find dragObject
let dragObj: DataNode; let dragObj: DataNode;
let dragLength = (info.dragNode as any).props.pos.split("-").length;
let dropLength = (info.node as any).props.pos.split("-").length;
if (!info.dropToGap) {
// Drop on the content
if (
(dropPosition == 0 && dropPos.length == 3) ||
(dropPosition == 0 && dropPos.length == 2 && dragLength == 2)
) {
} else {
loop(data, dragKey, (item, index, arr) => { loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1); arr.splice(index, 1);
dragObj = item; dragObj = item;
}); });
if (!info.dropToGap) {
// Drop on the content
loop(data, dropKey, (item) => { loop(data, dropKey, (item) => {
item.children = item.children || []; item.children = item.children || [];
// where to insert 示例添加到头部,可以是随意位置 // where to insert 示例添加到头部,可以是随意位置
item.children.unshift(dragObj); item.children.unshift(dragObj);
}); });
}
} else if ( } else if (
((info.node as any).props.children || []).length > 0 && // Has children ((info.node as any).props.children || []).length > 0 && // Has children
(info.node as any).props.expanded && // Is expanded (info.node as any).props.expanded && // Is expanded
dropPosition === 1 // On the bottom gap dropPosition === 1 // On the bottom gap
) { ) {
loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1);
dragObj = item;
});
loop(data, dropKey, (item) => { loop(data, dropKey, (item) => {
item.children = item.children || []; item.children = item.children || [];
// where to insert 示例添加到头部,可以是随意位置 // where to insert 示例添加到头部,可以是随意位置
@ -121,6 +133,16 @@ export const TreeHours = (props: PropInterface) => {
// item to the tail of the children // item to the tail of the children
}); });
} else { } else {
if (
(dragLength == 3 && dropLength == 2) ||
(dragLength == 2 && dropLength == 3)
) {
return;
}
loop(data, dragKey, (item, index, arr) => {
arr.splice(index, 1);
dragObj = item;
});
let ar: DataNode[] = []; let ar: DataNode[] = [];
let i: number; let i: number;
loop(data, dropKey, (_item, index, arr) => { loop(data, dropKey, (_item, index, arr) => {

View File

@ -149,12 +149,12 @@ export const SystemAdministratorCreate: React.FC<PropInterface> = ({
<Form.Item <Form.Item
label="邮箱" label="邮箱"
name="email" name="email"
rules={[{ required: true, message: "请输入员邮箱!" }]} rules={[{ required: true, message: "请输入管理员邮箱!" }]}
> >
<Input <Input
allowClear allowClear
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入员邮箱" placeholder="请输入管理员邮箱"
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item

View File

@ -111,7 +111,7 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
<> <>
{open ? ( {open ? (
<Modal <Modal
title="编辑管理员" title="编辑管理员"
centered centered
forceRender forceRender
open={true} open={true}
@ -168,12 +168,12 @@ export const SystemAdministratorUpdate: React.FC<PropInterface> = ({
<Form.Item <Form.Item
label="邮箱" label="邮箱"
name="email" name="email"
rules={[{ required: true, message: "请输入员邮箱!" }]} rules={[{ required: true, message: "请输入管理员邮箱!" }]}
> >
<Input <Input
allowClear allowClear
style={{ width: 200 }} style={{ width: 200 }}
placeholder="请输入员邮箱" placeholder="请输入管理员邮箱"
/> />
</Form.Item> </Form.Item>
<Form.Item label="密码" name="password"> <Form.Item label="密码" name="password">