Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
60f24127
Commit
60f24127
authored
Mar 22, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:bug修复
parent
0504f8c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
19 deletions
+52
-19
src/modules/teach-tool/QuestionCategoryManage.jsx
+52
-18
src/modules/teach-tool/components/QuestionEditor.jsx
+0
-1
No files found.
src/modules/teach-tool/QuestionCategoryManage.jsx
View file @
60f24127
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting
* @LastEditors: yuananting
* @LastEditTime: 2021-03-22
09:42:2
8
* @LastEditTime: 2021-03-22
19:49:0
8
* @Description: 助学工具-题库-主页面分类管理
* @Description: 助学工具-题库-主页面分类管理
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -39,12 +39,12 @@ class QuestionCategoryManage extends Component {
...
@@ -39,12 +39,12 @@ class QuestionCategoryManage extends Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
queryCategoryTree
();
this
.
queryCategoryTree
(
"search"
);
}
}
// 查询分类树
// 查询分类树
queryCategoryTree
=
(
categoryName
)
=>
{
queryCategoryTree
=
(
operateType
,
categoryName
)
=>
{
this
.
setState
({
categoryName
})
this
.
setState
({
categoryName
});
let
query
=
{
let
query
=
{
source
:
0
,
source
:
0
,
categoryName
,
categoryName
,
...
@@ -79,8 +79,10 @@ class QuestionCategoryManage extends Component {
...
@@ -79,8 +79,10 @@ class QuestionCategoryManage extends Component {
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
);
nodeId
.
push
(
item
);
});
});
if
(
operateType
===
"search"
)
{
this
.
setState
({
expandedKeys
:
nodeId
});
this
.
setState
({
expandedKeys
:
nodeId
});
}
}
}
}
else
{
}
else
{
this
.
setState
({
autoExpandParent
:
false
});
this
.
setState
({
autoExpandParent
:
false
});
const
defaultNode
=
{
const
defaultNode
=
{
...
@@ -92,8 +94,10 @@ class QuestionCategoryManage extends Component {
...
@@ -92,8 +94,10 @@ class QuestionCategoryManage extends Component {
this
.
setState
({
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
result
,
categoryName
),
treeData
:
this
.
renderTreeNodes
(
result
,
categoryName
),
});
});
if
(
operateType
===
"search"
)
{
this
.
setState
({
expandedKeys
:
[]
});
this
.
setState
({
expandedKeys
:
[]
});
}
}
}
});
});
};
};
...
@@ -119,7 +123,7 @@ class QuestionCategoryManage extends Component {
...
@@ -119,7 +123,7 @@ class QuestionCategoryManage extends Component {
QuestionBankService
.
delCategory
(
params
).
then
((
res
)
=>
{
QuestionBankService
.
delCategory
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
res
.
success
)
{
message
.
success
(
"删除分类成功"
);
message
.
success
(
"删除分类成功"
);
this
.
queryCategoryTree
();
this
.
queryCategoryTree
(
"change"
);
}
}
});
});
},
},
...
@@ -157,7 +161,7 @@ class QuestionCategoryManage extends Component {
...
@@ -157,7 +161,7 @@ class QuestionCategoryManage extends Component {
title=
{
title
}
title=
{
title
}
label=
{
label
}
label=
{
label
}
close=
{
()
=>
{
close=
{
()
=>
{
this
.
queryCategoryTree
();
this
.
queryCategoryTree
(
"change"
);
this
.
setState
({
this
.
setState
({
NewEditQuestionBankCategory
:
null
,
NewEditQuestionBankCategory
:
null
,
});
});
...
@@ -202,9 +206,34 @@ class QuestionCategoryManage extends Component {
...
@@ -202,9 +206,34 @@ class QuestionCategoryManage extends Component {
:
[];
:
[];
};
};
getDragNodesLevel
=
(
dragNodesKeys
)
=>
{
let
dragNodes
=
[];
dragNodesKeys
.
forEach
((
item
)
=>
{
dragNodes
.
push
(
this
.
state
.
treeMap
[
item
].
categoryLevel
);
});
return
dragNodes
;
// this.drags.push(dragNodes.categoryLevel);
// if (dragNodes.sonCategoryList) {
// dragNodes.sonCategoryList.forEach((item) => {
// console.log("item:", item.sonCategoryList);
// if (item.sonCategoryList) {
// this.getDragNodesLevel(item.sonCategoryList);
// // drags.push(...this.getDragNodesLevel(item.sonCategoryList));
// } else {
// this.drags.push(item.categoryLevel);
// }
// });
// }
// console.log(this.drags);
// return this.drags;
};
onDrop
=
(
info
)
=>
{
onDrop
=
(
info
)
=>
{
console
.
log
(
"info"
,
info
);
if
(
this
.
state
.
categoryName
)
{
if
(
this
.
state
.
categoryName
)
{
return
return
;
}
}
// 未分类不可以拖拽
// 未分类不可以拖拽
if
(
if
(
...
@@ -221,12 +250,14 @@ class QuestionCategoryManage extends Component {
...
@@ -221,12 +250,14 @@ class QuestionCategoryManage extends Component {
return
;
return
;
let
targetParentId
=
info
.
dropToGap
?
info
.
node
.
parentId
:
info
.
node
.
id
;
let
targetParentId
=
info
.
dropToGap
?
info
.
node
.
parentId
:
info
.
node
.
id
;
if
(
this
.
state
.
treeMap
[
targetParentId
].
categoryLevel
===
4
)
{
if
(
this
.
state
.
treeMap
[
targetParentId
].
categoryLevel
===
4
)
{
return
message
.
info
(
"最多支持5级分类"
)
return
message
.
info
(
"最多支持5级分类"
);
}
else
{
// console.log(this.getDragNodesLevel(info.dragNodesKeys));
}
}
let
relatedNodes
=
this
.
getRelatedNodes
(
targetParentId
);
let
relatedNodes
=
this
.
getRelatedNodes
(
targetParentId
);
if
(
relatedNodes
&&
relatedNodes
.
length
===
30
)
{
if
(
relatedNodes
&&
relatedNodes
.
length
===
30
)
{
return
message
.
info
(
"最多只能添加30个子分类"
)
return
message
.
info
(
"最多只能添加30个子分类"
)
;
}
}
const
dropKey
=
info
.
node
.
key
;
const
dropKey
=
info
.
node
.
key
;
const
dragKey
=
info
.
dragNode
.
key
;
const
dragKey
=
info
.
dragNode
.
key
;
...
@@ -325,7 +356,7 @@ class QuestionCategoryManage extends Component {
...
@@ -325,7 +356,7 @@ class QuestionCategoryManage extends Component {
userId
:
User
.
getStoreUserId
(),
userId
:
User
.
getStoreUserId
(),
};
};
QuestionBankService
.
editCategoryTree
(
params
).
then
((
res
)
=>
{
QuestionBankService
.
editCategoryTree
(
params
).
then
((
res
)
=>
{
this
.
queryCategoryTree
();
this
.
queryCategoryTree
(
"change"
);
});
});
};
};
...
@@ -468,17 +499,17 @@ class QuestionCategoryManage extends Component {
...
@@ -468,17 +499,17 @@ class QuestionCategoryManage extends Component {
let
map
=
{};
let
map
=
{};
let
topItem
=
[]
let
topItem
=
[]
;
data
.
forEach
((
item
)
=>
{
data
.
forEach
((
item
)
=>
{
topItem
.
push
(
item
);
topItem
.
push
(
item
);
});
});
this
.
setState
({
this
.
setState
({
treeMap
:
Object
.
assign
(
this
.
getTreeMap
(
data
,
map
),
{
treeMap
:
Object
.
assign
(
this
.
getTreeMap
(
data
,
map
),
{
"0"
:
{
0
:
{
sonCategoryList
:
topItem
sonCategoryList
:
topItem
,
},
},
})
})
,
});
});
return
newTreeData
;
return
newTreeData
;
};
};
...
@@ -508,22 +539,25 @@ class QuestionCategoryManage extends Component {
...
@@ -508,22 +539,25 @@ class QuestionCategoryManage extends Component {
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
div
className=
"page question-category-manage"
>
<
div
className=
"page question-category-manage"
>
{
getParameterByName
(
'from'
)
===
"aid"
?
<
Breadcrumbs
{
getParameterByName
(
"from"
)
===
"aid"
?
(
<
Breadcrumbs
navList=
"课程分类"
navList=
"课程分类"
goBack=
{
()
=>
goBack=
{
()
=>
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
"/question-bank-index"
,
pathname
:
"/question-bank-index"
,
})
})
}
}
/>
:
/>
<
div
className=
"content-header"
>
课程分类
</
div
>
}
)
:
(
<
div
className=
"content-header"
>
课程分类
</
div
>
)
}
<
div
className=
"box"
>
<
div
className=
"box"
>
<
div
className=
"search-condition"
>
<
div
className=
"search-condition"
>
<
span
className=
"search-label"
>
搜索名称:
</
span
>
<
span
className=
"search-label"
>
搜索名称:
</
span
>
<
Search
<
Search
placeholder=
"请输入名称"
placeholder=
"请输入名称"
style=
{
{
width
:
"calc(100% - 84px)"
}
}
style=
{
{
width
:
"calc(100% - 84px)"
}
}
onSearch=
{
(
value
)
=>
this
.
queryCategoryTree
(
value
)
}
onSearch=
{
(
value
)
=>
this
.
queryCategoryTree
(
"search"
,
value
)
}
/>
/>
</
div
>
</
div
>
<
Button
<
Button
...
...
src/modules/teach-tool/components/QuestionEditor.jsx
View file @
60f24127
...
@@ -297,7 +297,6 @@ class QuestionEditor extends Component {
...
@@ -297,7 +297,6 @@ class QuestionEditor extends Component {
limitLength
=
1000
,
limitLength
=
1000
,
markKey
,
markKey
,
}
=
this
.
props
;
}
=
this
.
props
;
console
.
log
(
"visiblePlacehold"
,
visiblePlacehold
)
return
(
return
(
<
div
<
div
className=
{
`question-edtior_box question-edtior_box__${markKey}`
}
className=
{
`question-edtior_box question-edtior_box__${markKey}`
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment