Commit 0b0dddf3 by yuananting

fix:解决合并冲突

parents 605c3df2 19120af7
/*
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-05-21 17:57:59
* @LastEditors: yuananting
* @LastEditTime: 2021-06-02 14:29:04
* @Description: 助学工具-课程分类
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
......@@ -153,9 +153,7 @@ class CourseCategoryManage extends Component {
<Space className='title-opts' size={16}>
<span
onClick={() => {
let nodesCount = 0
const { originTreeData } = this.state
console.log('orororo', originTreeData)
const { originTreeData } = this.state;
if (
(item.categoryLevel === 0 && originTreeData.length >= 29) ||
(item.categoryLevel > 0 && this.getRelatedNodes(item.parentId).length >= 30)
......@@ -343,8 +341,10 @@ class CourseCategoryManage extends Component {
let dragNodes = []
dragNodes.push(dragNode.id)
if (dragNode.parentId != 0) {
dragNodes = dragNodes.concat(this.getParentDragNodesLevel(this.state.treeMap[dragNode.parentId]))
if (dragNode.parentId !== "0") {
dragNodes = dragNodes.concat(
this.getParentDragNodesLevel(this.state.treeMap[dragNode.parentId])
);
}
return dragNodes
}
......@@ -365,14 +365,24 @@ class CourseCategoryManage extends Component {
// 拖拽
onDrop = (info) => {
if (this.state.categoryName) {
return
// 带搜索时的分类树不允许拖拽
// 不允许其他节点拖拽到未分类中
// 不允许其他节点拖拽到未分类之前
if (
this.state.categoryName ||
(info.node.categoryName === "未分类" && info.dropPosition === 0) ||
(info.node.categoryName === "未分类" &&
info.dropToGap &&
info.dropPosition === -1)
) {
return;
}
// 未分类不可以拖拽
if (info.dragNode.categoryName === '未分类' && info.dragNode.categoryLevel === 0) return message.info('未分类”为默认分类暂不支持移动')
// 不允许其他节点拖拽到未分类之前
if (info.node.categoryName === '未分类' && info.dropToGap && info.dropPosition === -1) return
if (
info.dragNode.categoryName === "未分类" &&
info.dragNode.categoryLevel === 0
)
return message.info("“未分类”为默认分类暂不支持移动");
let targetParentId = info.dropToGap ? info.node.parentId : info.node.id
let relatedNodes = this.getRelatedNodes(targetParentId)
......@@ -383,8 +393,7 @@ class CourseCategoryManage extends Component {
let nodesArr = this.getDragNodesLevel(this.state.treeMap[info.dragNode.id])
let parentArr = this.getParentDragNodesLevel(this.state.treeMap[targetParentId])
if (nodesArr.length + parentArr.length > 4) {
console.log(nodesArr.length, parentArr.length)
return message.info('最多支持5级分类')
return message.info("最多支持5级分类");
}
}
if (relatedNodes && relatedNodes.length >= 30) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment