From a8432cece76b3d686dcb2a8d1c5ccb116c38deb8 Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Sat, 7 Oct 2023 17:48:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/system/adminroles/compenents/create.tsx | 15 +++++++++++++++ src/pages/system/adminroles/compenents/update.tsx | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/pages/system/adminroles/compenents/create.tsx b/src/pages/system/adminroles/compenents/create.tsx index 1193a50..32e8dbf 100644 --- a/src/pages/system/adminroles/compenents/create.tsx +++ b/src/pages/system/adminroles/compenents/create.tsx @@ -77,6 +77,16 @@ export const SystemAdminrolesCreate: React.FC = ({ value: "线上课-n", children: [], }, + { + title: "分类管理", + value: "分类管理-n", + children: [], + }, + { + title: "资源管理", + value: "资源管理-n", + children: [], + }, { title: "资源分类", value: "资源分类-n", @@ -97,6 +107,11 @@ export const SystemAdminrolesCreate: React.FC = ({ value: "其它-n", children: [], }, + { + title: "其它权限", + value: "其它权限-n", + children: [], + }, ]; let actions = res.data.perm_action.action; let permissions = res.data.perm_action.data; diff --git a/src/pages/system/adminroles/compenents/update.tsx b/src/pages/system/adminroles/compenents/update.tsx index a2c4327..18846a8 100644 --- a/src/pages/system/adminroles/compenents/update.tsx +++ b/src/pages/system/adminroles/compenents/update.tsx @@ -91,6 +91,16 @@ export const SystemAdminrolesUpdate: React.FC = ({ value: "线上课-n", children: [], }, + { + title: "分类管理", + value: "分类管理-n", + children: [], + }, + { + title: "资源管理", + value: "资源管理-n", + children: [], + }, { title: "资源分类", value: "资源分类-n", @@ -111,6 +121,11 @@ export const SystemAdminrolesUpdate: React.FC = ({ value: "其它-n", children: [], }, + { + title: "其它权限", + value: "其它权限-n", + children: [], + }, ]; let actions = res.data.perm_action.action; let permissions = res.data.perm_action.data; From e0bd169069d17311c1974b835cb82d19fd6c1dfd Mon Sep 17 00:00:00 2001 From: unknown <18119604035@163.com> Date: Tue, 31 Oct 2023 15:46:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E8=AF=BE=E8=AF=BE?= =?UTF-8?q?=E6=97=B6=E6=8B=96=E5=8A=A8=E4=B8=BA=E7=88=B6=E5=AD=90=E7=BA=A7?= =?UTF-8?q?=E6=97=B6=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/compenents/hours.tsx | 41 +++++++++++++++++++++------ 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/pages/course/compenents/hours.tsx b/src/pages/course/compenents/hours.tsx index 8765df8..e9f0e53 100644 --- a/src/pages/course/compenents/hours.tsx +++ b/src/pages/course/compenents/hours.tsx @@ -65,6 +65,7 @@ export const TreeHours = (props: PropInterface) => { } props.onRemoveItem(id); }; + const onDrop: TreeProps["onDrop"] = (info) => { const dropKey = info.node.key; const dragKey = info.dragNode.key; @@ -96,23 +97,35 @@ export const TreeHours = (props: PropInterface) => { // Find dragObject let dragObj: DataNode; - loop(data, dragKey, (item, index, arr) => { - arr.splice(index, 1); - dragObj = item; - }); + 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 - loop(data, dropKey, (item) => { - item.children = item.children || []; - // where to insert 示例添加到头部,可以是随意位置 - item.children.unshift(dragObj); - }); + if ( + (dropPosition == 0 && dropPos.length == 3) || + (dropPosition == 0 && dropPos.length == 2 && dragLength == 2) + ) { + } else { + loop(data, dragKey, (item, index, arr) => { + arr.splice(index, 1); + dragObj = item; + }); + loop(data, dropKey, (item) => { + item.children = item.children || []; + // where to insert 示例添加到头部,可以是随意位置 + item.children.unshift(dragObj); + }); + } } else if ( ((info.node as any).props.children || []).length > 0 && // Has children (info.node as any).props.expanded && // Is expanded dropPosition === 1 // On the bottom gap ) { + loop(data, dragKey, (item, index, arr) => { + arr.splice(index, 1); + dragObj = item; + }); loop(data, dropKey, (item) => { item.children = item.children || []; // where to insert 示例添加到头部,可以是随意位置 @@ -121,6 +134,16 @@ export const TreeHours = (props: PropInterface) => { // item to the tail of the children }); } 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 i: number; loop(data, dropKey, (_item, index, arr) => {