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
61ab356d
Commit
61ab356d
authored
Jun 17, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refactor/yuananting/20210615/category-tree-related' into gray
parents
0edce662
d082113c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
156 additions
and
188 deletions
+156
-188
src/data-source/aidTool/request-apis.ts
+23
-23
src/domains/aid-tool-domain/AidToolService.ts
+26
-26
src/modules/course-manage/graphics-course/AddGraphicsCourse.jsx
+0
-0
src/modules/knowledge-base/components/Classification.jsx
+42
-52
src/modules/teach-tool/components/CourseCategoryManage.jsx
+0
-0
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
+65
-87
No files found.
src/data-source/aidTool/request-apis.ts
View file @
61ab356d
...
@@ -2,89 +2,89 @@
...
@@ -2,89 +2,89 @@
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-03-03 15:13:12
* @Date: 2021-03-03 15:13:12
* @LastEditors: fusanqiasng
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-0
5-25 10:07:03
* @LastEditTime: 2021-0
6-16 09:57:18
* @Description: 助学工具接口
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
import
Service
from
'@/common/js/service'
import
Service
from
'@/common/js/service'
;
export
function
queryExternalCategoryTree
(
params
:
object
)
{
export
function
queryExternalCategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/externalHades/queryCategoryTree'
,
params
)
return
Service
.
Hades
(
'public/externalHades/queryCategoryTree'
,
params
)
;
}
}
export
function
queryCategoryTree
(
params
:
object
)
{
export
function
queryCategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryCategoryTree'
,
params
)
return
Service
.
Hades
(
'public/hades/queryCategoryTree'
,
params
)
;
}
}
export
function
addCategory
(
params
:
object
)
{
export
function
addCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/addCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/addCategory'
,
params
)
;
}
}
export
function
delCategory
(
params
:
object
)
{
export
function
delCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/delCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/delCategory'
,
params
)
;
}
}
export
function
editCategory
(
params
:
object
)
{
export
function
editCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/editCategory'
,
params
)
;
}
}
export
function
editCategoryTree
(
params
:
object
)
{
export
function
moveCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/
editCategoryTree'
,
params
)
return
Service
.
Hades
(
'public/hades/
moveCategory'
,
params
);
}
}
export
function
queryQuestionPageList
(
params
:
object
)
{
export
function
queryQuestionPageList
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryQuestionPageList'
,
params
)
return
Service
.
Hades
(
'public/hades/queryQuestionPageList'
,
params
)
;
}
}
export
function
addQuestion
(
params
:
object
)
{
export
function
addQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/addQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/addQuestion'
,
params
)
;
}
}
export
function
deleteQuestion
(
params
:
object
)
{
export
function
deleteQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/deleteQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/deleteQuestion'
,
params
)
;
}
}
export
function
queryQuestionDetails
(
params
:
object
)
{
export
function
queryQuestionDetails
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryQuestionDetails'
,
params
)
return
Service
.
Hades
(
'public/hades/queryQuestionDetails'
,
params
)
;
}
}
export
function
editQuestion
(
params
:
object
)
{
export
function
editQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/editQuestion'
,
params
)
;
}
}
export
function
batchImport
(
params
:
object
)
{
export
function
batchImport
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/batchImport'
,
params
)
return
Service
.
Hades
(
'public/hades/batchImport'
,
params
)
;
}
}
export
function
createPaper
(
params
:
object
)
{
export
function
createPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/createPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/createPaper'
,
params
)
;
}
}
export
function
queryPaperPageList
(
params
:
object
)
{
export
function
queryPaperPageList
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryPaperPageList'
,
params
)
return
Service
.
Hades
(
'public/hades/queryPaperPageList'
,
params
)
;
}
}
export
function
deletePaper
(
params
:
object
)
{
export
function
deletePaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/deletePaper'
,
params
)
return
Service
.
Hades
(
'public/hades/deletePaper'
,
params
)
;
}
}
export
function
queryPaperDetail
(
params
:
object
)
{
export
function
queryPaperDetail
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryPaperDetail'
,
params
)
return
Service
.
Hades
(
'public/hades/queryPaperDetail'
,
params
)
;
}
}
export
function
viewPaper
(
params
:
object
)
{
export
function
viewPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/viewPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/viewPaper'
,
params
)
;
}
}
export
function
editPaper
(
params
:
object
)
{
export
function
editPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/editPaper'
,
params
)
;
}
}
export
function
batchQueryQuestionDetails
(
params
:
object
)
{
export
function
batchQueryQuestionDetails
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/batchQueryQuestionDetails'
,
params
)
return
Service
.
Hades
(
'public/hades/batchQueryQuestionDetails'
,
params
)
;
}
}
export
function
queryQuestionPageListWithContent
(
params
:
object
)
{
export
function
queryQuestionPageListWithContent
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryQuestionPageListWithContent'
,
params
)
return
Service
.
Hades
(
'public/hades/queryQuestionPageListWithContent'
,
params
)
;
}
}
src/domains/aid-tool-domain/AidToolService.ts
View file @
61ab356d
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-03-11 11:34:37
* @Date: 2021-03-11 11:34:37
* @LastEditors: fusanqiasng
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-0
5-24 23:44:39
* @LastEditTime: 2021-0
6-16 09:56:46
* @Description: 助学工具接口
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -12,7 +12,7 @@ import {
...
@@ -12,7 +12,7 @@ import {
addCategory
,
addCategory
,
delCategory
,
delCategory
,
editCategory
,
editCategory
,
editCategoryTree
,
moveCategory
,
addQuestion
,
addQuestion
,
queryQuestionPageList
,
queryQuestionPageList
,
deleteQuestion
,
deleteQuestion
,
...
@@ -26,8 +26,8 @@ import {
...
@@ -26,8 +26,8 @@ import {
viewPaper
,
viewPaper
,
editPaper
,
editPaper
,
batchQueryQuestionDetails
,
batchQueryQuestionDetails
,
queryQuestionPageListWithContent
queryQuestionPageListWithContent
,
}
from
'@/data-source/aidTool/request-apis'
}
from
'@/data-source/aidTool/request-apis'
;
export
default
class
AidToolService
{
export
default
class
AidToolService
{
/**
/**
* 查询运营端分类书
* 查询运营端分类书
...
@@ -35,101 +35,101 @@ export default class AidToolService {
...
@@ -35,101 +35,101 @@ export default class AidToolService {
* @returns
* @returns
*/
*/
static
queryExternalCategoryTree
(
parmas
:
any
)
{
static
queryExternalCategoryTree
(
parmas
:
any
)
{
return
queryExternalCategoryTree
(
parmas
)
return
queryExternalCategoryTree
(
parmas
)
;
}
}
// 获取题目分类树
// 获取题目分类树
static
queryCategoryTree
(
params
:
any
)
{
static
queryCategoryTree
(
params
:
any
)
{
return
queryCategoryTree
(
params
)
return
queryCategoryTree
(
params
)
;
}
}
// 新增题目分类
// 新增题目分类
static
addCategory
(
params
:
any
)
{
static
addCategory
(
params
:
any
)
{
return
addCategory
(
params
)
return
addCategory
(
params
)
;
}
}
// 删除分类
// 删除分类
static
delCategory
(
params
:
any
)
{
static
delCategory
(
params
:
any
)
{
return
delCategory
(
params
)
return
delCategory
(
params
)
;
}
}
// 编辑分类
// 编辑分类
static
editCategory
(
params
:
any
)
{
static
editCategory
(
params
:
any
)
{
return
editCategory
(
params
)
return
editCategory
(
params
)
;
}
}
//
编辑分类树(拖拽)
//
拖拽移动分类树
static
editCategoryTree
(
params
:
any
)
{
static
moveCategory
(
params
:
any
)
{
return
editCategoryTree
(
params
)
return
moveCategory
(
params
);
}
}
// 查询题目列表
// 查询题目列表
static
queryQuestionPageList
(
params
:
any
)
{
static
queryQuestionPageList
(
params
:
any
)
{
return
queryQuestionPageList
(
params
)
return
queryQuestionPageList
(
params
)
;
}
}
// 添加题目
// 添加题目
static
addQuestion
(
params
:
any
)
{
static
addQuestion
(
params
:
any
)
{
return
addQuestion
(
params
)
return
addQuestion
(
params
)
;
}
}
// 删除题目
// 删除题目
static
deleteQuestion
(
params
:
any
)
{
static
deleteQuestion
(
params
:
any
)
{
return
deleteQuestion
(
params
)
return
deleteQuestion
(
params
)
;
}
}
// 预览题目
// 预览题目
static
queryQuestionDetails
(
params
:
any
)
{
static
queryQuestionDetails
(
params
:
any
)
{
return
queryQuestionDetails
(
params
)
return
queryQuestionDetails
(
params
)
;
}
}
// 编辑题目
// 编辑题目
static
editQuestion
(
params
:
any
)
{
static
editQuestion
(
params
:
any
)
{
return
editQuestion
(
params
)
return
editQuestion
(
params
)
;
}
}
// 批量导入
// 批量导入
static
batchImport
(
params
:
any
)
{
static
batchImport
(
params
:
any
)
{
return
batchImport
(
params
)
return
batchImport
(
params
)
;
}
}
// 创建试卷
// 创建试卷
static
createPaper
(
params
:
any
)
{
static
createPaper
(
params
:
any
)
{
return
createPaper
(
params
)
return
createPaper
(
params
)
;
}
}
// 查询试卷列表
// 查询试卷列表
static
queryPaperPageList
(
params
:
any
)
{
static
queryPaperPageList
(
params
:
any
)
{
return
queryPaperPageList
(
params
)
return
queryPaperPageList
(
params
)
;
}
}
// 删除试卷
// 删除试卷
static
deletePaper
(
params
:
any
)
{
static
deletePaper
(
params
:
any
)
{
return
deletePaper
(
params
)
return
deletePaper
(
params
)
;
}
}
// 编辑前查询试卷信息
// 编辑前查询试卷信息
static
queryPaperDetail
(
params
:
any
)
{
static
queryPaperDetail
(
params
:
any
)
{
return
queryPaperDetail
(
params
)
return
queryPaperDetail
(
params
)
;
}
}
// 预览试卷
// 预览试卷
static
viewPaper
(
params
:
any
)
{
static
viewPaper
(
params
:
any
)
{
return
viewPaper
(
params
)
return
viewPaper
(
params
)
;
}
}
// 编辑试卷
// 编辑试卷
static
editPaper
(
params
:
any
)
{
static
editPaper
(
params
:
any
)
{
return
editPaper
(
params
)
return
editPaper
(
params
)
;
}
}
// 操作试卷-预览查询多题目信息
// 操作试卷-预览查询多题目信息
static
batchQueryQuestionDetails
(
params
:
any
)
{
static
batchQueryQuestionDetails
(
params
:
any
)
{
return
batchQueryQuestionDetails
(
params
)
return
batchQueryQuestionDetails
(
params
)
;
}
}
// 操作试卷-选择题目列表带题目详情
// 操作试卷-选择题目列表带题目详情
static
queryQuestionPageListWithContent
(
params
:
any
)
{
static
queryQuestionPageListWithContent
(
params
:
any
)
{
return
queryQuestionPageListWithContent
(
params
)
return
queryQuestionPageListWithContent
(
params
)
;
}
}
}
}
src/modules/course-manage/graphics-course/AddGraphicsCourse.jsx
View file @
61ab356d
This diff is collapsed.
Click to expand it.
src/modules/knowledge-base/components/Classification.jsx
View file @
61ab356d
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
* @Description:
* @Description:
* @Author: zangsuyun
* @Author: zangsuyun
* @Date: 2021-03-19 18:05:23
* @Date: 2021-03-19 18:05:23
* @LastEditors:
wufan
* @LastEditors:
fusanqiasng
* @LastEditTime: 2021-0
5-30 16:48:46
* @LastEditTime: 2021-0
6-15 11:20:24
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
import
React
,
{
Component
}
from
"react"
;
import
React
,
{
Component
}
from
'react'
;
import
{
Input
,
Button
,
Tree
}
from
"antd"
;
import
{
Input
,
Button
,
Tree
}
from
'antd'
;
import
"./Classification.less"
;
import
'./Classification.less'
;
import
User
from
"@/common/js/user"
;
import
User
from
'@/common/js/user'
;
import
KnowledgeAPI
from
"@/data-source/knowledge/request-api"
;
import
KnowledgeAPI
from
'@/data-source/knowledge/request-api'
;
import
Bus
from
"@/core/bus"
;
import
Bus
from
'@/core/bus'
;
const
{
Search
}
=
Input
;
const
{
Search
}
=
Input
;
const
{
DirectoryTree
}
=
Tree
;
const
{
DirectoryTree
}
=
Tree
;
...
@@ -21,7 +21,7 @@ class Classification extends Component {
...
@@ -21,7 +21,7 @@ class Classification extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
selectedKeys
:
props
.
selectedKeys
?
[
props
.
selectedKeys
]
:
[
"0"
],
selectedKeys
:
props
.
selectedKeys
?
[
props
.
selectedKeys
]
:
[
'0'
],
searchValue
:
null
,
searchValue
:
null
,
NewEditQuestionBankCategory
:
null
,
//新增或编辑分类模态框
NewEditQuestionBankCategory
:
null
,
//新增或编辑分类模态框
ImportCourseCategory
:
null
,
// 引用课程分类模态框
ImportCourseCategory
:
null
,
// 引用课程分类模态框
...
@@ -32,11 +32,11 @@ class Classification extends Component {
...
@@ -32,11 +32,11 @@ class Classification extends Component {
componentDidMount
()
{
componentDidMount
()
{
this
.
queryCategoryTree
();
this
.
queryCategoryTree
();
Bus
.
bind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
Bus
.
bind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
;
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
Bus
.
unbind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
Bus
.
unbind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
;
}
}
shouldComponentUpdate
=
(
nextProps
,
nextState
)
=>
{
shouldComponentUpdate
=
(
nextProps
,
nextState
)
=>
{
...
@@ -79,7 +79,7 @@ class Classification extends Component {
...
@@ -79,7 +79,7 @@ class Classification extends Component {
};
};
KnowledgeAPI
.
getCategoryTree
(
query
).
then
((
res
)
=>
{
KnowledgeAPI
.
getCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
let
str
=
"未分类"
;
let
str
=
'未分类'
;
if
(
categoryName
)
{
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
});
this
.
setState
({
autoExpandParent
:
true
});
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
...
@@ -93,8 +93,8 @@ class Classification extends Component {
...
@@ -93,8 +93,8 @@ class Classification extends Component {
this
.
setState
({
expandedKeys
:
nodeId
});
this
.
setState
({
expandedKeys
:
nodeId
});
}
else
{
}
else
{
const
defaultNode
=
{
const
defaultNode
=
{
id
:
"0"
,
id
:
'0'
,
categoryName
:
"未分类"
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
categoryCount
:
noCategoryCnt
,
};
};
categoryList
.
unshift
(
defaultNode
);
categoryList
.
unshift
(
defaultNode
);
...
@@ -110,8 +110,8 @@ class Classification extends Component {
...
@@ -110,8 +110,8 @@ class Classification extends Component {
}
else
{
}
else
{
this
.
setState
({
autoExpandParent
:
false
});
this
.
setState
({
autoExpandParent
:
false
});
const
defaultNode
=
{
const
defaultNode
=
{
id
:
"0"
,
id
:
'0'
,
categoryName
:
"未分类"
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
categoryCount
:
noCategoryCnt
,
};
};
categoryList
.
unshift
(
defaultNode
);
categoryList
.
unshift
(
defaultNode
);
...
@@ -140,39 +140,35 @@ class Classification extends Component {
...
@@ -140,39 +140,35 @@ class Classification extends Component {
item
.
title
=
item
.
title
=
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
<
span
>
<
span
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
</
span
>
)
:
(
)
:
(
<
span
style=
{
{
opacity
:
0.5
}
}
>
<
span
style=
{
{
opacity
:
0.5
}
}
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
</
span
>
);
);
item
.
icon
=
item
.
icon
=
item
.
categoryName
===
"未分类"
?
(
item
.
categoryName
===
'未分类'
?
(
<
img
<
img
style=
{
{
style=
{
{
width
:
"24px"
,
width
:
'24px'
,
height
:
"24px"
,
height
:
'24px'
,
opacity
:
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
}
}
src=
"https://image.xiaomaiketang.com/xm/defaultCategory.png"
src=
'https://image.xiaomaiketang.com/xm/defaultCategory.png'
alt=
""
alt=
''
/>
/>
)
:
(
)
:
(
<
img
<
img
style=
{
{
style=
{
{
width
:
"24px"
,
width
:
'24px'
,
height
:
"24px"
,
height
:
'24px'
,
opacity
:
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
}
}
src=
"https://image.xiaomaiketang.com/xm/hasCategory.png"
src=
'https://image.xiaomaiketang.com/xm/hasCategory.png'
alt=
""
alt=
''
/>
/>
);
);
if
(
item
.
sonCategoryList
)
{
if
(
item
.
sonCategoryList
)
{
...
@@ -186,36 +182,30 @@ class Classification extends Component {
...
@@ -186,36 +182,30 @@ class Classification extends Component {
};
};
render
()
{
render
()
{
const
{
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
}
=
this
.
state
;
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
}
=
this
.
state
;
return
(
return
(
<
div
className=
"question-bank-sider"
>
<
div
className=
'question-bank-sider'
>
<
div
className=
"sider-title"
>
知识分类
</
div
>
<
div
className=
'sider-title'
>
知识分类
</
div
>
<
Search
<
Search
className=
"sider-search"
className=
'sider-search'
placeholder=
"搜索名称分类"
placeholder=
'搜索名称分类'
onSearch=
{
(
value
)
=>
{
onSearch=
{
(
value
)
=>
{
this
.
queryCategoryTree
(
value
);
this
.
queryCategoryTree
(
value
);
}
}
}
}
enterButton=
{
<
span
className=
"icon iconfont"
>

</
span
>
}
enterButton=
{
<
span
className=
'icon iconfont'
>

</
span
>
}
style=
{
{
width
:
230
}
}
style=
{
{
width
:
230
}
}
/>
/>
<
div
className=
"sider-btn"
>
<
div
className=
'sider-btn'
>
<
Button
<
Button
onClick=
{
()
=>
{
onClick=
{
()
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
push
({
pathname
:
"/course-category-manage?from=knowledge"
,
pathname
:
'/course-category-manage?from=knowledge'
,
});
});
}
}
}
}
>
>
分类管理
分类管理
</
Button
>
</
Button
>
</
div
>
</
div
>
<
div
className=
"sider-tree"
>
<
div
className=
'sider-tree'
>
<
DirectoryTree
<
DirectoryTree
expandedKeys=
{
expandedKeys
}
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
autoExpandParent=
{
autoExpandParent
}
...
...
src/modules/teach-tool/components/CourseCategoryManage.jsx
View file @
61ab356d
This diff is collapsed.
Click to expand it.
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
View file @
61ab356d
/*
/*
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @Date: 2021-02-22 10:59:43
* @LastEditors:
yuananti
ng
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-0
4-13 13:55:37
* @LastEditTime: 2021-0
6-15 11:20:48
* @Description: 助学工具-侧边课程分类树
* @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
import
React
,
{
Component
}
from
"react"
;
import
React
,
{
Component
}
from
'react'
;
import
{
Input
,
Button
,
Tree
}
from
"antd"
;
import
{
Input
,
Button
,
Tree
}
from
'antd'
;
import
"./CourseCategorySiderTree.less"
;
import
'./CourseCategorySiderTree.less'
;
import
User
from
"@/common/js/user"
;
import
User
from
'@/common/js/user'
;
import
AidToolService
from
"@/domains/aid-tool-domain/AidToolService"
;
import
AidToolService
from
'@/domains/aid-tool-domain/AidToolService'
;
import
Bus
from
"@/core/bus"
;
import
Bus
from
'@/core/bus'
;
const
{
Search
}
=
Input
;
const
{
Search
}
=
Input
;
const
{
DirectoryTree
}
=
Tree
;
const
{
DirectoryTree
}
=
Tree
;
...
@@ -20,31 +20,25 @@ class CourseCategorySiderTree extends Component {
...
@@ -20,31 +20,25 @@ class CourseCategorySiderTree extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
selectedKeys
:
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
props
.
fromModule
)
selectedKeys
:
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
props
.
fromModule
)
?
[
getParameterByName
(
'categoryId'
)
||
'null'
]
:
[
'null'
],
?
[
getParameterByName
(
"categoryId"
)
||
"null"
]
:
[
"null"
],
treeData
:
props
.
treeData
||
[],
treeData
:
props
.
treeData
||
[],
autoExpandParent
:
false
,
autoExpandParent
:
false
,
};
};
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
queryCategoryTree
(
"init"
);
this
.
queryCategoryTree
(
'init'
);
Bus
.
bind
(
"queryCategoryTree"
,
this
.
queryCategoryTree
);
Bus
.
bind
(
'queryCategoryTree'
,
this
.
queryCategoryTree
);
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
Bus
.
unbind
(
"queryCategoryTree"
,
this
.
queryCategoryTree
);
Bus
.
unbind
(
'queryCategoryTree'
,
this
.
queryCategoryTree
);
}
}
// 查询分类树
// 查询分类树
queryCategoryTree
=
(
type
=
"init"
,
categoryName
)
=>
{
queryCategoryTree
=
(
type
=
'init'
,
categoryName
)
=>
{
let
query
=
{
let
query
=
{
bizType
:
[
"QUESTION_INDEX"
,
"QUESTION_MODAL"
].
includes
(
bizType
:
[
'QUESTION_INDEX'
,
'QUESTION_MODAL'
].
includes
(
this
.
props
.
fromModule
)
?
'QUESTION'
:
'PAPER'
,
this
.
props
.
fromModule
)
?
"QUESTION"
:
"PAPER"
,
categoryName
,
categoryName
,
count
:
true
,
count
:
true
,
source
:
0
,
source
:
0
,
...
@@ -53,7 +47,7 @@ class CourseCategorySiderTree extends Component {
...
@@ -53,7 +47,7 @@ class CourseCategorySiderTree extends Component {
};
};
AidToolService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
AidToolService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
let
str
=
"未分类"
;
let
str
=
'未分类'
;
if
(
categoryName
)
{
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
});
this
.
setState
({
autoExpandParent
:
true
});
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
...
@@ -64,15 +58,15 @@ class CourseCategorySiderTree extends Component {
...
@@ -64,15 +58,15 @@ class CourseCategorySiderTree extends Component {
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
);
nodeId
.
push
(
item
);
});
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
nodeId
});
this
.
setState
({
expandedKeys
:
nodeId
});
}
}
}
else
{
}
else
{
const
defaultNode
=
{
const
defaultNode
=
{
id
:
"null"
,
id
:
'null'
,
categoryName
:
"未分类"
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
categoryCount
:
noCategoryCnt
,
parentId
:
"0"
,
parentId
:
'0'
,
categoryLevel
:
0
,
categoryLevel
:
0
,
};
};
categoryList
.
unshift
(
defaultNode
);
categoryList
.
unshift
(
defaultNode
);
...
@@ -83,24 +77,24 @@ class CourseCategorySiderTree extends Component {
...
@@ -83,24 +77,24 @@ class CourseCategorySiderTree extends Component {
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
);
nodeId
.
push
(
item
);
});
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
nodeId
});
this
.
setState
({
expandedKeys
:
nodeId
});
}
}
}
}
}
else
{
}
else
{
this
.
setState
({
autoExpandParent
:
false
});
this
.
setState
({
autoExpandParent
:
false
});
const
defaultNode
=
{
const
defaultNode
=
{
id
:
"null"
,
id
:
'null'
,
categoryName
:
"未分类"
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
categoryCount
:
noCategoryCnt
,
parentId
:
"0"
,
parentId
:
'0'
,
categoryLevel
:
0
,
categoryLevel
:
0
,
};
};
categoryList
.
unshift
(
defaultNode
);
categoryList
.
unshift
(
defaultNode
);
this
.
setState
({
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
),
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
),
});
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
[]
});
this
.
setState
({
expandedKeys
:
[]
});
}
}
}
}
...
@@ -126,12 +120,12 @@ class CourseCategorySiderTree extends Component {
...
@@ -126,12 +120,12 @@ class CourseCategorySiderTree extends Component {
// 树状选中事件
// 树状选中事件
onSelect
=
(
selectedKeys
)
=>
{
onSelect
=
(
selectedKeys
)
=>
{
this
.
setState
({
selectedKeys
},
()
=>
{
this
.
setState
({
selectedKeys
},
()
=>
{
if
(
this
.
props
.
fromModule
===
"QUESTION_INDEX"
)
{
if
(
this
.
props
.
fromModule
===
'QUESTION_INDEX'
)
{
Bus
.
trigger
(
"queryQuestionPageList"
,
selectedKeys
[
0
]);
Bus
.
trigger
(
'queryQuestionPageList'
,
selectedKeys
[
0
]);
}
else
if
(
this
.
props
.
fromModule
===
"QUESTION_MODAL"
)
{
}
else
if
(
this
.
props
.
fromModule
===
'QUESTION_MODAL'
)
{
Bus
.
trigger
(
"queryQuestionPageListWithContent"
,
selectedKeys
[
0
]);
Bus
.
trigger
(
'queryQuestionPageListWithContent'
,
selectedKeys
[
0
]);
}
else
{
}
else
{
Bus
.
trigger
(
"queryPaperPageList"
,
selectedKeys
[
0
],
0
);
Bus
.
trigger
(
'queryPaperPageList'
,
selectedKeys
[
0
],
0
);
}
}
});
});
};
};
...
@@ -144,39 +138,35 @@ class CourseCategorySiderTree extends Component {
...
@@ -144,39 +138,35 @@ class CourseCategorySiderTree extends Component {
item
.
title
=
item
.
title
=
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
<
span
>
<
span
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
</
span
>
)
:
(
)
:
(
<
span
style=
{
{
opacity
:
0.5
}
}
>
<
span
style=
{
{
opacity
:
0.5
}
}
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
</
span
>
);
);
item
.
icon
=
item
.
icon
=
item
.
categoryName
===
"未分类"
?
(
item
.
categoryName
===
'未分类'
?
(
<
img
<
img
style=
{
{
style=
{
{
width
:
"24px"
,
width
:
'24px'
,
height
:
"24px"
,
height
:
'24px'
,
opacity
:
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
}
}
src=
"https://image.xiaomaiketang.com/xm/defaultCategory.png"
src=
'https://image.xiaomaiketang.com/xm/defaultCategory.png'
alt=
""
alt=
''
/>
/>
)
:
(
)
:
(
<
img
<
img
style=
{
{
style=
{
{
width
:
"24px"
,
width
:
'24px'
,
height
:
"24px"
,
height
:
'24px'
,
opacity
:
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
}
}
src=
"https://image.xiaomaiketang.com/xm/hasCategory.png"
src=
'https://image.xiaomaiketang.com/xm/hasCategory.png'
alt=
""
alt=
''
/>
/>
);
);
if
(
item
.
sonCategoryList
)
{
if
(
item
.
sonCategoryList
)
{
...
@@ -190,46 +180,34 @@ class CourseCategorySiderTree extends Component {
...
@@ -190,46 +180,34 @@ class CourseCategorySiderTree extends Component {
};
};
render
()
{
render
()
{
const
{
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
}
=
this
.
state
;
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
}
=
this
.
state
;
return
(
return
(
<
div
className=
"category-tree-sider"
>
<
div
className=
'category-tree-sider'
>
{
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
this
.
props
.
fromModule
)
&&
(
{
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
this
.
props
.
fromModule
)
&&
(
<
div
className=
"sider-title"
>
<
div
className=
'sider-title'
>
{
this
.
props
.
fromModule
===
'QUESTION_INDEX'
?
'题目分类'
:
'试卷分类'
}
</
div
>
{
this
.
props
.
fromModule
===
"QUESTION_INDEX"
?
"题目分类"
:
"试卷分类"
}
</
div
>
)
}
)
}
<
Search
<
Search
className=
"sider-search"
className=
'sider-search'
placeholder=
"搜索名称分类"
placeholder=
'搜索名称分类'
onSearch=
{
(
value
)
=>
{
onSearch=
{
(
value
)
=>
{
this
.
queryCategoryTree
(
"init"
,
value
);
this
.
queryCategoryTree
(
'init'
,
value
);
}
}
}
}
enterButton=
{
<
span
className=
"icon iconfont"
>

</
span
>
}
enterButton=
{
<
span
className=
'icon iconfont'
>

</
span
>
}
/>
/>
{
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
this
.
props
.
fromModule
)
&&
{
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
this
.
props
.
fromModule
)
&&
User
.
getUserRole
()
!==
'CloudLecturer'
&&
this
.
props
.
type
!==
'modal-select'
&&
(
User
.
getUserRole
()
!==
"CloudLecturer"
&&
<
div
className=
'sider-btn'
>
this
.
props
.
type
!==
"modal-select"
&&
(
<
Button
<
div
className=
"sider-btn"
>
onClick=
{
()
=>
{
<
Button
window
.
RCHistory
.
push
({
onClick=
{
()
=>
{
pathname
:
'/course-category-manage?from=aid'
,
window
.
RCHistory
.
push
({
});
pathname
:
"/course-category-manage?from=aid"
,
}
}
>
});
分类管理
}
}
</
Button
>
>
</
div
>
分类管理
)
}
</
Button
>
<
div
className=
'sider-tree'
>
</
div
>
)
}
<
div
className=
"sider-tree"
>
<
DirectoryTree
<
DirectoryTree
expandedKeys=
{
expandedKeys
}
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
autoExpandParent=
{
autoExpandParent
}
...
...
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