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
899bf803
Commit
899bf803
authored
Jun 15, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Plain Diff
fix:解决合并分类树拖拽接口替换、隐藏0的冲突
parents
fbef7abc
56b67270
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
606 additions
and
749 deletions
+606
-749
src/data-source/aidTool/request-apis.ts
+23
-23
src/domains/aid-tool-domain/AidToolService.ts
+26
-26
src/modules/knowledge-base/components/Classification.jsx
+42
-52
src/modules/knowledge-base/modal/AddCourse.jsx
+2
-2
src/modules/plan-manage/components/PlanList.jsx
+1
-1
src/modules/teach-tool/components/CourseCategoryManage.jsx
+243
-220
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
+65
-87
src/modules/teach-tool/examination-manager/UserData.tsx
+1
-1
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+202
-336
src/modules/teach-tool/paper-manage/modal/PreviewPaperModal.jsx
+1
-1
No files found.
src/data-source/aidTool/request-apis.ts
View file @
899bf803
...
...
@@ -2,89 +2,89 @@
* @Author: yuananting
* @Date: 2021-03-03 15:13:12
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-0
5-25 10:07:03
* @LastEditTime: 2021-0
6-15 11:53:12
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
Service
from
'@/common/js/service'
import
Service
from
'@/common/js/service'
;
export
function
queryExternalCategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/externalHades/queryCategoryTree'
,
params
)
return
Service
.
Hades
(
'public/externalHades/queryCategoryTree'
,
params
)
;
}
export
function
queryCategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryCategoryTree'
,
params
)
return
Service
.
Hades
(
'public/hades/queryCategoryTree'
,
params
)
;
}
export
function
addCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/addCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/addCategory'
,
params
)
;
}
export
function
delCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/delCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/delCategory'
,
params
)
;
}
export
function
editCategory
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editCategory'
,
params
)
return
Service
.
Hades
(
'public/hades/editCategory'
,
params
)
;
}
export
function
edit
CategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/
editCategoryTree'
,
params
)
export
function
move
CategoryTree
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/
moveCategory'
,
params
);
}
export
function
queryQuestionPageList
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryQuestionPageList'
,
params
)
return
Service
.
Hades
(
'public/hades/queryQuestionPageList'
,
params
)
;
}
export
function
addQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/addQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/addQuestion'
,
params
)
;
}
export
function
deleteQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/deleteQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/deleteQuestion'
,
params
)
;
}
export
function
queryQuestionDetails
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryQuestionDetails'
,
params
)
return
Service
.
Hades
(
'public/hades/queryQuestionDetails'
,
params
)
;
}
export
function
editQuestion
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editQuestion'
,
params
)
return
Service
.
Hades
(
'public/hades/editQuestion'
,
params
)
;
}
export
function
batchImport
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/batchImport'
,
params
)
return
Service
.
Hades
(
'public/hades/batchImport'
,
params
)
;
}
export
function
createPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/createPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/createPaper'
,
params
)
;
}
export
function
queryPaperPageList
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryPaperPageList'
,
params
)
return
Service
.
Hades
(
'public/hades/queryPaperPageList'
,
params
)
;
}
export
function
deletePaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/deletePaper'
,
params
)
return
Service
.
Hades
(
'public/hades/deletePaper'
,
params
)
;
}
export
function
queryPaperDetail
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/queryPaperDetail'
,
params
)
return
Service
.
Hades
(
'public/hades/queryPaperDetail'
,
params
)
;
}
export
function
viewPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/viewPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/viewPaper'
,
params
)
;
}
export
function
editPaper
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/editPaper'
,
params
)
return
Service
.
Hades
(
'public/hades/editPaper'
,
params
)
;
}
export
function
batchQueryQuestionDetails
(
params
:
object
)
{
return
Service
.
Hades
(
'public/hades/batchQueryQuestionDetails'
,
params
)
return
Service
.
Hades
(
'public/hades/batchQueryQuestionDetails'
,
params
)
;
}
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 @
899bf803
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-03-11 11:34:37
* @LastEditors: fusanqiasng
* @LastEditTime: 2021-0
5-24 23:44:39
* @LastEditTime: 2021-0
6-15 11:25:18
* @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -12,7 +12,7 @@ import {
addCategory
,
delCategory
,
editCategory
,
edit
CategoryTree
,
move
CategoryTree
,
addQuestion
,
queryQuestionPageList
,
deleteQuestion
,
...
...
@@ -26,8 +26,8 @@ import {
viewPaper
,
editPaper
,
batchQueryQuestionDetails
,
queryQuestionPageListWithContent
}
from
'@/data-source/aidTool/request-apis'
queryQuestionPageListWithContent
,
}
from
'@/data-source/aidTool/request-apis'
;
export
default
class
AidToolService
{
/**
* 查询运营端分类书
...
...
@@ -35,101 +35,101 @@ export default class AidToolService {
* @returns
*/
static
queryExternalCategoryTree
(
parmas
:
any
)
{
return
queryExternalCategoryTree
(
parmas
)
return
queryExternalCategoryTree
(
parmas
)
;
}
// 获取题目分类树
static
queryCategoryTree
(
params
:
any
)
{
return
queryCategoryTree
(
params
)
return
queryCategoryTree
(
params
)
;
}
// 新增题目分类
static
addCategory
(
params
:
any
)
{
return
addCategory
(
params
)
return
addCategory
(
params
)
;
}
// 删除分类
static
delCategory
(
params
:
any
)
{
return
delCategory
(
params
)
return
delCategory
(
params
)
;
}
// 编辑分类
static
editCategory
(
params
:
any
)
{
return
editCategory
(
params
)
return
editCategory
(
params
)
;
}
//
编辑分类树(拖拽)
static
edit
CategoryTree
(
params
:
any
)
{
return
editCategoryTree
(
params
)
//
拖拽移动分类树
static
move
CategoryTree
(
params
:
any
)
{
return
moveCategoryTree
(
params
);
}
// 查询题目列表
static
queryQuestionPageList
(
params
:
any
)
{
return
queryQuestionPageList
(
params
)
return
queryQuestionPageList
(
params
)
;
}
// 添加题目
static
addQuestion
(
params
:
any
)
{
return
addQuestion
(
params
)
return
addQuestion
(
params
)
;
}
// 删除题目
static
deleteQuestion
(
params
:
any
)
{
return
deleteQuestion
(
params
)
return
deleteQuestion
(
params
)
;
}
// 预览题目
static
queryQuestionDetails
(
params
:
any
)
{
return
queryQuestionDetails
(
params
)
return
queryQuestionDetails
(
params
)
;
}
// 编辑题目
static
editQuestion
(
params
:
any
)
{
return
editQuestion
(
params
)
return
editQuestion
(
params
)
;
}
// 批量导入
static
batchImport
(
params
:
any
)
{
return
batchImport
(
params
)
return
batchImport
(
params
)
;
}
// 创建试卷
static
createPaper
(
params
:
any
)
{
return
createPaper
(
params
)
return
createPaper
(
params
)
;
}
// 查询试卷列表
static
queryPaperPageList
(
params
:
any
)
{
return
queryPaperPageList
(
params
)
return
queryPaperPageList
(
params
)
;
}
// 删除试卷
static
deletePaper
(
params
:
any
)
{
return
deletePaper
(
params
)
return
deletePaper
(
params
)
;
}
// 编辑前查询试卷信息
static
queryPaperDetail
(
params
:
any
)
{
return
queryPaperDetail
(
params
)
return
queryPaperDetail
(
params
)
;
}
// 预览试卷
static
viewPaper
(
params
:
any
)
{
return
viewPaper
(
params
)
return
viewPaper
(
params
)
;
}
// 编辑试卷
static
editPaper
(
params
:
any
)
{
return
editPaper
(
params
)
return
editPaper
(
params
)
;
}
// 操作试卷-预览查询多题目信息
static
batchQueryQuestionDetails
(
params
:
any
)
{
return
batchQueryQuestionDetails
(
params
)
return
batchQueryQuestionDetails
(
params
)
;
}
// 操作试卷-选择题目列表带题目详情
static
queryQuestionPageListWithContent
(
params
:
any
)
{
return
queryQuestionPageListWithContent
(
params
)
return
queryQuestionPageListWithContent
(
params
)
;
}
}
src/modules/knowledge-base/components/Classification.jsx
View file @
899bf803
...
...
@@ -2,17 +2,17 @@
* @Description:
* @Author: zangsuyun
* @Date: 2021-03-19 18:05:23
* @LastEditors:
wufan
* @LastEditTime: 2021-0
5-30 16:48:46
* @LastEditors:
fusanqiasng
* @LastEditTime: 2021-0
6-15 11:20:24
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
Component
}
from
"react"
;
import
{
Input
,
Button
,
Tree
}
from
"antd"
;
import
"./Classification.less"
;
import
User
from
"@/common/js/user"
;
import
KnowledgeAPI
from
"@/data-source/knowledge/request-api"
;
import
Bus
from
"@/core/bus"
;
import
React
,
{
Component
}
from
'react'
;
import
{
Input
,
Button
,
Tree
}
from
'antd'
;
import
'./Classification.less'
;
import
User
from
'@/common/js/user'
;
import
KnowledgeAPI
from
'@/data-source/knowledge/request-api'
;
import
Bus
from
'@/core/bus'
;
const
{
Search
}
=
Input
;
const
{
DirectoryTree
}
=
Tree
;
...
...
@@ -21,7 +21,7 @@ class Classification extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
selectedKeys
:
props
.
selectedKeys
?
[
props
.
selectedKeys
]
:
[
"0"
],
selectedKeys
:
props
.
selectedKeys
?
[
props
.
selectedKeys
]
:
[
'0'
],
searchValue
:
null
,
NewEditQuestionBankCategory
:
null
,
//新增或编辑分类模态框
ImportCourseCategory
:
null
,
// 引用课程分类模态框
...
...
@@ -32,11 +32,11 @@ class Classification extends Component {
componentDidMount
()
{
this
.
queryCategoryTree
();
Bus
.
bind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
Bus
.
bind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
;
}
componentWillUnmount
()
{
Bus
.
unbind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
Bus
.
unbind
(
'knowledgeCategoryTree'
,
this
.
queryCategoryTree
)
;
}
shouldComponentUpdate
=
(
nextProps
,
nextState
)
=>
{
...
...
@@ -79,7 +79,7 @@ class Classification extends Component {
};
KnowledgeAPI
.
getCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
let
str
=
"未分类"
;
let
str
=
'未分类'
;
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
});
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
...
...
@@ -93,8 +93,8 @@ class Classification extends Component {
this
.
setState
({
expandedKeys
:
nodeId
});
}
else
{
const
defaultNode
=
{
id
:
"0"
,
categoryName
:
"未分类"
,
id
:
'0'
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
};
categoryList
.
unshift
(
defaultNode
);
...
...
@@ -110,8 +110,8 @@ class Classification extends Component {
}
else
{
this
.
setState
({
autoExpandParent
:
false
});
const
defaultNode
=
{
id
:
"0"
,
categoryName
:
"未分类"
,
id
:
'0'
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
};
categoryList
.
unshift
(
defaultNode
);
...
...
@@ -140,39 +140,35 @@ class Classification extends Component {
item
.
title
=
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
<
span
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
)
:
(
<
span
style=
{
{
opacity
:
0.5
}
}
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
);
item
.
icon
=
item
.
categoryName
===
"未分类"
?
(
item
.
categoryName
===
'未分类'
?
(
<
img
style=
{
{
width
:
"24px"
,
height
:
"24px"
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
"https://image.xiaomaiketang.com/xm/defaultCategory.png"
alt=
""
src=
'https://image.xiaomaiketang.com/xm/defaultCategory.png'
alt=
''
/>
)
:
(
<
img
style=
{
{
width
:
"24px"
,
height
:
"24px"
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
"https://image.xiaomaiketang.com/xm/hasCategory.png"
alt=
""
src=
'https://image.xiaomaiketang.com/xm/hasCategory.png'
alt=
''
/>
);
if
(
item
.
sonCategoryList
)
{
...
...
@@ -186,36 +182,30 @@ class Classification extends Component {
};
render
()
{
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
}
=
this
.
state
;
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
}
=
this
.
state
;
return
(
<
div
className=
"question-bank-sider"
>
<
div
className=
"sider-title"
>
知识分类
</
div
>
<
div
className=
'question-bank-sider'
>
<
div
className=
'sider-title'
>
知识分类
</
div
>
<
Search
className=
"sider-search"
placeholder=
"搜索名称分类"
className=
'sider-search'
placeholder=
'搜索名称分类'
onSearch=
{
(
value
)
=>
{
this
.
queryCategoryTree
(
value
);
}
}
enterButton=
{
<
span
className=
"icon iconfont"
>

</
span
>
}
style=
{
{
width
:
230
}
}
enterButton=
{
<
span
className=
'icon iconfont'
>

</
span
>
}
style=
{
{
width
:
230
}
}
/>
<
div
className=
"sider-btn"
>
<
div
className=
'sider-btn'
>
<
Button
onClick=
{
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
"/course-category-manage?from=knowledge"
,
pathname
:
'/course-category-manage?from=knowledge'
,
});
}
}
>
}
}
>
分类管理
</
Button
>
</
div
>
<
div
className=
"sider-tree"
>
<
div
className=
'sider-tree'
>
<
DirectoryTree
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
...
...
src/modules/knowledge-base/modal/AddCourse.jsx
View file @
899bf803
...
...
@@ -2,8 +2,8 @@
* @Description:
* @Author: zangsuyun
* @Date: 2021-03-13 09:54:26
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-06-
07 18:28:31
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-06-
15 17:19:12
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
src/modules/plan-manage/components/PlanList.jsx
View file @
899bf803
...
...
@@ -317,7 +317,7 @@ function PlanList(props) {
scroll=
{
{
x
:
1400
}
}
className=
'plan-list-table'
renderEmpty=
{
{
description
:
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
还没有试卷
</
span
>
description
:
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
暂无数据
</
span
>
}
}
/>
<
div
className=
'box-footer'
>
...
...
src/modules/teach-tool/components/CourseCategoryManage.jsx
View file @
899bf803
/*
* @Author: yuananting
* @Date: 2021-02-23 18:28:50
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-06-
02 14:25:06
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-06-
15 15:31:40
* @Description: 助学工具-课程分类
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
Component
}
from
'react'
import
Breadcrumbs
from
'@/components/Breadcrumbs'
import
'./CourseCategoryManage.less'
import
OpearteCourseCategoryModal
from
'../modal/OpearteCourseCategoryModal'
import
AidToolService
from
'@/domains/aid-tool-domain/AidToolService'
import
User
from
'@/common/js/user'
import
{
Tree
,
Input
,
Space
,
Button
,
Menu
,
Dropdown
,
message
,
Modal
}
from
'antd'
import
ShowTips
from
'@/components/ShowTips'
const
{
DirectoryTree
}
=
Tree
const
{
Search
}
=
Input
const
{
confirm
}
=
Modal
import
React
,
{
Component
}
from
'react'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
'./CourseCategoryManage.less'
;
import
OpearteCourseCategoryModal
from
'../modal/OpearteCourseCategoryModal'
;
import
AidToolService
from
'@/domains/aid-tool-domain/AidToolService'
;
import
User
from
'@/common/js/user'
;
import
{
Tree
,
Input
,
Space
,
Button
,
Menu
,
Dropdown
,
message
,
Modal
}
from
'antd'
;
import
ShowTips
from
'@/components/ShowTips'
;
const
{
DirectoryTree
}
=
Tree
;
const
{
Search
}
=
Input
;
const
{
confirm
}
=
Modal
;
class
CourseCategoryManage
extends
Component
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
;
this
.
state
=
{
operateCourseCategoryModal
:
null
,
//新增或编辑分类模态框
treeData
:
[],
originTreeData
:
[],
treeMap
:
{},
selectedKeys
:
[
'null'
],
autoExpandParent
:
true
}
autoExpandParent
:
true
,
}
;
}
componentDidMount
()
{
this
.
queryCategoryTree
(
'init'
)
this
.
queryCategoryTree
(
'init'
)
;
}
getWholeTree
=
()
=>
{
...
...
@@ -40,112 +40,112 @@ class CourseCategoryManage extends Component {
count
:
false
,
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
()
}
tenantId
:
User
.
getStoreId
()
,
}
;
AidToolService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[]
}
=
res
.
result
const
{
categoryList
=
[]
}
=
res
.
result
;
this
.
setState
({
originTreeData
:
categoryList
},
()
=>
{
let
map
=
{}
let
topItem
=
[]
let
map
=
{}
;
let
topItem
=
[]
;
categoryList
.
forEach
((
item
)
=>
{
topItem
.
push
(
item
)
})
topItem
.
push
(
item
)
;
})
;
this
.
setState
({
treeMap
:
Object
.
assign
(
this
.
getTreeMap
(
categoryList
,
map
),
{
0
:
{
sonCategoryList
:
topItem
}
})
})
})
})
}
sonCategoryList
:
topItem
,
}
,
})
,
})
;
})
;
})
;
}
;
// 查询分类树
queryCategoryTree
=
(
operateType
,
categoryName
)
=>
{
this
.
getWholeTree
()
this
.
setState
({
categoryName
})
this
.
getWholeTree
()
;
this
.
setState
({
categoryName
})
;
let
query
=
{
bizType
:
'QUESTION'
,
count
:
false
,
source
:
0
,
categoryName
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
()
}
tenantId
:
User
.
getStoreId
()
,
}
;
AidToolService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[]
}
=
res
.
result
let
str
=
'未分类'
const
{
categoryList
=
[]
}
=
res
.
result
;
let
str
=
'未分类'
;
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
})
this
.
setState
({
autoExpandParent
:
true
})
;
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
})
let
nodeId
=
[]
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
,
})
;
let
nodeId
=
[]
;
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
)
})
this
.
setState
({
expandedKeys
:
nodeId
})
nodeId
.
push
(
item
)
;
})
;
this
.
setState
({
expandedKeys
:
nodeId
})
;
}
else
{
const
defaultNode
=
{
id
:
'null'
,
categoryName
:
'未分类'
,
categoryCount
:
0
,
parentId
:
'0'
,
categoryLevel
:
0
}
categoryList
.
unshift
(
defaultNode
)
categoryLevel
:
0
,
}
;
categoryList
.
unshift
(
defaultNode
)
;
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
})
let
nodeId
=
[]
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
,
})
;
let
nodeId
=
[]
;
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
)
})
nodeId
.
push
(
item
)
;
})
;
if
(
operateType
===
'init'
)
{
this
.
setState
({
expandedKeys
:
nodeId
})
this
.
setState
({
expandedKeys
:
nodeId
})
;
}
}
}
else
{
this
.
setState
({
autoExpandParent
:
false
})
this
.
setState
({
autoExpandParent
:
false
})
;
const
defaultNode
=
{
id
:
'null'
,
categoryName
:
'未分类'
,
categoryCount
:
0
,
parentId
:
'0'
,
categoryLevel
:
0
}
categoryList
.
unshift
(
defaultNode
)
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
})
categoryLevel
:
0
,
}
;
categoryList
.
unshift
(
defaultNode
)
;
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
)
})
;
if
(
operateType
===
'init'
)
{
this
.
setState
({
expandedKeys
:
[]
})
this
.
setState
({
expandedKeys
:
[]
})
;
}
}
})
}
})
;
}
;
// 树节点渲染-内容处理
renderTreeNodes
=
(
data
,
value
)
=>
{
let
newTreeData
=
data
.
map
((
item
)
=>
{
item
.
title
=
item
.
categoryName
item
.
key
=
item
.
id
item
.
title
=
item
.
categoryName
;
item
.
key
=
item
.
id
;
item
.
title
=
(
<
div
style=
{
{
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
className=
'node-title-div'
onMouseOver=
{
(
e
)
=>
{
let
mouseNodeOpts
=
e
.
currentTarget
.
getElementsByTagName
(
'div'
)[
0
]
let
mouseNodeOpts
=
e
.
currentTarget
.
getElementsByTagName
(
'div'
)[
0
]
;
if
(
mouseNodeOpts
)
{
mouseNodeOpts
.
style
.
visibility
=
'visible'
mouseNodeOpts
.
style
.
visibility
=
'visible'
;
}
}
}
onMouseOut=
{
(
e
)
=>
{
let
mouseNodeOpts
=
e
.
currentTarget
.
getElementsByTagName
(
'div'
)[
0
]
let
mouseNodeOpts
=
e
.
currentTarget
.
getElementsByTagName
(
'div'
)[
0
]
;
if
(
mouseNodeOpts
)
{
mouseNodeOpts
.
style
.
visibility
=
'hidden'
mouseNodeOpts
.
style
.
visibility
=
'hidden'
;
}
}
}
>
<
span
>
{
item
.
categoryName
}
</
span
>
...
...
@@ -158,9 +158,9 @@ class CourseCategoryManage extends Component {
(
item
.
categoryLevel
===
0
&&
originTreeData
.
length
>=
29
)
||
(
item
.
categoryLevel
>
0
&&
this
.
getRelatedNodes
(
item
.
parentId
).
length
>=
30
)
)
{
return
message
.
info
(
'最多只能添加30个分类'
)
return
message
.
info
(
'最多只能添加30个分类'
)
;
}
this
.
newEditCourseCategory
(
'newEqualLevelCategory'
,
'equal'
,
'new'
,
item
)
this
.
newEditCourseCategory
(
'newEqualLevelCategory'
,
'equal'
,
'new'
,
item
)
;
}
}
>
<
span
className=
'icon iconfont'
style=
{
{
color
:
'#BFBFBF'
}
}
>

{
' '
}
...
...
@@ -171,10 +171,10 @@ class CourseCategoryManage extends Component {
<
span
onClick=
{
()
=>
{
if
(
this
.
getRelatedNodes
(
item
.
id
)
&&
this
.
getRelatedNodes
(
item
.
id
).
length
>=
30
)
{
message
.
info
(
'最多只能添加30个子分类'
)
return
message
.
info
(
'最多只能添加30个子分类'
)
;
return
;
}
this
.
newEditCourseCategory
(
'newChildLevelCategory'
,
'child'
,
'new'
,
item
)
this
.
newEditCourseCategory
(
'newChildLevelCategory'
,
'child'
,
'new'
,
item
)
;
}
}
>
<
span
className=
'icon iconfont'
style=
{
{
color
:
'#BFBFBF'
}
}
>

{
' '
}
...
...
@@ -193,14 +193,14 @@ class CourseCategoryManage extends Component {
</
Space
>
)
}
</
div
>
)
)
;
item
.
icon
=
item
.
categoryName
===
'未分类'
?
(
<
img
style=
{
{
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
'https://image.xiaomaiketang.com/xm/defaultCategory.png'
alt=
''
...
...
@@ -210,54 +210,54 @@ class CourseCategoryManage extends Component {
style=
{
{
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
'https://image.xiaomaiketang.com/xm/hasCategory.png'
alt=
''
/>
)
)
;
if
(
item
.
sonCategoryList
)
{
item
.
children
=
this
.
renderTreeNodes
(
item
.
sonCategoryList
,
value
)
item
.
children
=
this
.
renderTreeNodes
(
item
.
sonCategoryList
,
value
)
;
}
return
item
})
return
newTreeData
}
return
item
;
})
;
return
newTreeData
;
}
;
// 树结构平铺
getTreeMap
=
(
data
,
map
)
=>
{
data
.
forEach
((
item
)
=>
{
map
[
item
.
id
]
=
item
map
[
item
.
id
]
=
item
;
if
(
item
.
sonCategoryList
&&
item
.
sonCategoryList
.
length
>
0
)
{
this
.
getTreeMap
(
item
.
sonCategoryList
,
map
)
this
.
getTreeMap
(
item
.
sonCategoryList
,
map
)
;
}
})
})
;
return
map
}
return
map
;
}
;
// 新增或编辑分类
newEditCourseCategory
=
(
categoryType
,
addLevelType
,
type
,
node
)
=>
{
let
title
=
''
let
label
=
''
let
title
=
''
;
let
label
=
''
;
switch
(
categoryType
)
{
case
'newEqualLevelCategory'
:
title
=
'新增分类'
label
=
'分类名称'
break
title
=
'新增分类'
;
label
=
'分类名称'
;
break
;
case
'newChildLevelCategory'
:
title
=
'新增子分类'
label
=
'子分类名称'
break
title
=
'新增子分类'
;
label
=
'子分类名称'
;
break
;
case
'editEqualLevelCategory'
:
title
=
'编辑分类'
label
=
'分类名称'
break
title
=
'编辑分类'
;
label
=
'分类名称'
;
break
;
case
'editChildLevelCategory'
:
title
=
'编辑子分类'
label
=
'子分类名称'
break
title
=
'编辑子分类'
;
label
=
'子分类名称'
;
break
;
}
const
m
=
(
<
OpearteCourseCategoryModal
...
...
@@ -267,15 +267,15 @@ class CourseCategoryManage extends Component {
title=
{
title
}
label=
{
label
}
close=
{
()
=>
{
this
.
queryCategoryTree
(
'remain'
,
this
.
state
.
categoryName
)
this
.
queryCategoryTree
(
'remain'
,
this
.
state
.
categoryName
)
;
this
.
setState
({
operateCourseCategoryModal
:
null
})
operateCourseCategoryModal
:
null
,
})
;
}
}
/>
)
this
.
setState
({
operateCourseCategoryModal
:
m
})
}
)
;
this
.
setState
({
operateCourseCategoryModal
:
m
})
;
}
;
// 删除分类
delCategory
=
(
item
)
=>
{
...
...
@@ -291,17 +291,17 @@ class CourseCategoryManage extends Component {
categoryId
:
item
.
id
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
()
}
userId
:
User
.
getStoreUserId
()
,
}
;
AidToolService
.
delCategory
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
message
.
success
(
'删除分类成功'
)
this
.
queryCategoryTree
(
'remain'
,
this
.
state
.
categoryName
)
message
.
success
(
'删除分类成功'
)
;
this
.
queryCategoryTree
(
'remain'
,
this
.
state
.
categoryName
)
;
}
})
}
})
}
})
;
}
,
})
;
}
;
// 更多操作-【重命名 删除】
initDropMenu
=
(
item
)
=>
{
...
...
@@ -310,8 +310,8 @@ class CourseCategoryManage extends Component {
<
Menu
.
Item
key=
'0'
>
<
span
onClick=
{
()
=>
{
let
categoryType
=
item
.
categoryLevel
===
0
?
'editEqualLevelCategory'
:
'editChildLevelCategory'
this
.
newEditCourseCategory
(
categoryType
,
'equal'
,
'edit'
,
item
)
let
categoryType
=
item
.
categoryLevel
===
0
?
'editEqualLevelCategory'
:
'editChildLevelCategory'
;
this
.
newEditCourseCategory
(
categoryType
,
'equal'
,
'edit'
,
item
)
;
}
}
>
重命名
</
span
>
...
...
@@ -319,49 +319,47 @@ class CourseCategoryManage extends Component {
<
Menu
.
Item
key=
'1'
>
<
span
onClick=
{
()
=>
{
this
.
delCategory
(
item
)
this
.
delCategory
(
item
)
;
}
}
>
删除
</
span
>
</
Menu
.
Item
>
</
Menu
>
)
}
)
;
}
;
// 获取相关节点
getRelatedNodes
=
(
parentId
)
=>
{
return
this
.
state
.
treeMap
[
parentId
]
?
this
.
state
.
treeMap
[
parentId
].
sonCategoryList
:
[]
}
return
this
.
state
.
treeMap
[
parentId
]
?
this
.
state
.
treeMap
[
parentId
].
sonCategoryList
:
[]
;
}
;
// 获取拖拽目标父节点层级
getParentDragNodesLevel
=
(
dragNode
)
=>
{
if
(
!
dragNode
)
{
return
[]
return
[]
;
}
let
dragNodes
=
[]
dragNodes
.
push
(
dragNode
.
id
)
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
}
return
dragNodes
;
}
;
// 获取拖拽节点层级
getDragNodesLevel
=
(
dragNode
)
=>
{
let
dragNodes
=
[]
let
dragNodes
=
[]
;
if
(
dragNode
.
sonCategoryList
&&
dragNode
.
sonCategoryList
.
length
>
0
)
{
dragNode
.
sonCategoryList
.
forEach
((
item
)
=>
{
dragNodes
.
push
(
item
.
categoryLevel
)
dragNodes
.
push
(
item
.
categoryLevel
)
;
if
(
item
.
sonCategoryList
&&
item
.
sonCategoryList
.
length
>
0
)
{
dragNodes
=
dragNodes
.
concat
(
this
.
getDragNodesLevel
(
item
))
dragNodes
=
dragNodes
.
concat
(
this
.
getDragNodesLevel
(
item
))
;
}
})
})
;
}
return
[...
new
Set
(
dragNodes
)]
}
return
[...
new
Set
(
dragNodes
)]
;
}
;
// 拖拽
onDrop
=
(
info
)
=>
{
...
...
@@ -370,148 +368,173 @@ class CourseCategoryManage extends Component {
// 不允许其他节点拖拽到未分类之前
if
(
this
.
state
.
categoryName
||
(
info
.
node
.
categoryName
===
"未分类"
&&
info
.
dropPosition
===
0
)
||
(
info
.
node
.
categoryName
===
"未分类"
&&
info
.
dropToGap
&&
info
.
dropPosition
===
-
1
)
(
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
.
dragNode
.
categoryName
===
'未分类'
&&
info
.
dragNode
.
categoryLevel
===
0
)
return
message
.
info
(
'“未分类”为默认分类暂不支持移动'
);
let
targetParentId
=
info
.
dropToGap
?
info
.
node
.
parentId
:
info
.
node
.
id
let
relatedNodes
=
this
.
getRelatedNodes
(
targetParentId
)
let
targetParentId
=
info
.
dropToGap
?
info
.
node
.
parentId
:
info
.
node
.
id
;
let
relatedNodes
=
this
.
getRelatedNodes
(
targetParentId
)
;
if
(
!
((
info
.
dropToGap
&&
info
.
node
.
parentId
===
info
.
dragNode
.
parentId
)
||
(
!
info
.
dropToGap
&&
info
.
node
.
id
===
info
.
dragNode
.
parentId
)))
{
if
(
this
.
state
.
treeMap
[
targetParentId
].
categoryLevel
==
=
4
)
{
return
message
.
info
(
'最多支持5级分类'
)
if
(
this
.
state
.
treeMap
[
targetParentId
].
categoryLevel
>
=
4
)
{
return
message
.
info
(
'最多支持5级分类'
)
;
}
else
{
let
nodesArr
=
this
.
getDragNodesLevel
(
this
.
state
.
treeMap
[
info
.
dragNode
.
id
])
let
parentArr
=
this
.
getParentDragNodesLevel
(
this
.
state
.
treeMap
[
targetParentId
])
let
nodesArr
=
this
.
getDragNodesLevel
(
this
.
state
.
treeMap
[
info
.
dragNode
.
id
])
;
let
parentArr
=
this
.
getParentDragNodesLevel
(
this
.
state
.
treeMap
[
targetParentId
])
;
if
(
nodesArr
.
length
+
parentArr
.
length
>
4
)
{
return
message
.
info
(
"最多支持5级分类"
);
return
message
.
info
(
'最多支持5级分类'
);
}
}
if
(
relatedNodes
&&
relatedNodes
.
length
>=
30
)
{
return
message
.
info
(
'最多只能添加30个分类'
)
return
message
.
info
(
'最多只能添加30个分类'
)
;
}
}
const
dropKey
=
info
.
node
.
key
const
dragKey
=
info
.
dragNode
.
key
const
dropPos
=
info
.
node
.
pos
.
split
(
'-'
)
const
dropPosition
=
info
.
dropPosition
-
Number
(
dropPos
[
dropPos
.
length
-
1
])
const
dropKey
=
info
.
node
.
key
;
const
dragKey
=
info
.
dragNode
.
key
;
const
dropPos
=
info
.
node
.
pos
.
split
(
'-'
)
;
const
dropPosition
=
info
.
dropPosition
-
Number
(
dropPos
[
dropPos
.
length
-
1
])
;
const
loop
=
(
data
,
key
,
callback
)
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
(
data
[
i
].
key
===
key
)
{
return
callback
(
data
[
i
],
i
,
data
)
return
callback
(
data
[
i
],
i
,
data
)
;
}
if
(
data
[
i
].
sonCategoryList
)
{
loop
(
data
[
i
].
sonCategoryList
,
key
,
callback
)
loop
(
data
[
i
].
sonCategoryList
,
key
,
callback
)
;
}
}
}
const
data
=
[...
this
.
state
.
treeData
]
}
;
const
data
=
[...
this
.
state
.
treeData
]
;
let
getSuf
=
function
(
name
,
originCategoryName
,
sufIndex
)
{
if
(
relatedNodes
&&
relatedNodes
.
length
>
0
)
{
let
sameNameNodes
=
[]
let
sameNameNodes
=
[]
;
relatedNodes
.
forEach
((
item
)
=>
{
if
(
item
.
id
===
info
.
dragNode
.
id
)
return
true
if
(
item
.
id
===
info
.
dragNode
.
id
)
return
true
;
if
(
item
.
categoryName
===
name
)
{
sameNameNodes
.
push
(
item
)
sameNameNodes
.
push
(
item
)
;
}
})
})
;
if
(
sameNameNodes
.
length
>
0
)
{
sufIndex
++
return
getSuf
(
originCategoryName
+
`(
${
sufIndex
}
)`
,
originCategoryName
,
sufIndex
)
sufIndex
++
;
return
getSuf
(
originCategoryName
+
`(
${
sufIndex
}
)`
,
originCategoryName
,
sufIndex
)
;
}
}
return
sufIndex
}
return
sufIndex
;
}
;
let
dragObj
let
dragObj
;
loop
(
data
,
dragKey
,
(
item
,
index
,
arr
)
=>
{
arr
.
splice
(
index
,
1
)
item
.
parentId
=
targetParentId
arr
.
splice
(
index
,
1
)
;
item
.
parentId
=
targetParentId
;
if
(
item
.
originCategoryName
)
{
item
.
categoryName
=
item
.
originCategoryName
item
.
categoryName
=
item
.
originCategoryName
;
}
else
{
item
.
originCategoryName
=
item
.
categoryName
item
.
originCategoryName
=
item
.
categoryName
;
}
info
.
dragNode
.
categoryName
=
item
.
originCategoryName
let
sufIndex
=
getSuf
(
info
.
dragNode
.
categoryName
,
item
.
originCategoryName
,
0
)
item
.
categoryName
=
item
.
categoryName
+
(
sufIndex
?
`(
${
sufIndex
}
)`
:
''
)
item
.
categoryName
=
item
.
originCategoryName
+
(
sufIndex
?
`(
${
sufIndex
}
)`
:
''
)
dragObj
=
item
})
info
.
dragNode
.
categoryName
=
item
.
originCategoryName
;
let
sufIndex
=
getSuf
(
info
.
dragNode
.
categoryName
,
item
.
originCategoryName
,
0
)
;
item
.
categoryName
=
item
.
categoryName
+
(
sufIndex
?
`(
${
sufIndex
}
)`
:
''
)
;
item
.
categoryName
=
item
.
originCategoryName
+
(
sufIndex
?
`(
${
sufIndex
}
)`
:
''
)
;
dragObj
=
item
;
})
;
if
(
!
info
.
dropToGap
)
{
loop
(
data
,
dropKey
,
(
item
)
=>
{
item
.
sonCategoryList
=
item
.
sonCategoryList
||
[]
item
.
sonCategoryList
.
unshift
(
dragObj
)
})
item
.
sonCategoryList
=
item
.
sonCategoryList
||
[]
;
item
.
sonCategoryList
.
unshift
(
dragObj
)
;
})
;
}
else
if
((
info
.
node
.
props
.
sonCategoryList
||
[]).
length
>
0
&&
info
.
node
.
props
.
expanded
&&
dropPosition
===
1
)
{
loop
(
data
,
dropKey
,
(
item
)
=>
{
item
.
sonCategoryList
=
item
.
children
||
[]
item
.
sonCategoryList
.
unshift
(
dragObj
)
})
item
.
sonCategoryList
=
item
.
children
||
[]
;
item
.
sonCategoryList
.
unshift
(
dragObj
)
;
})
;
}
else
{
let
ar
let
i
let
ar
;
let
i
;
loop
(
data
,
dropKey
,
(
item
,
index
,
arr
)
=>
{
ar
=
arr
i
=
index
})
ar
=
arr
;
i
=
index
;
})
;
if
(
dropPosition
===
-
1
)
{
ar
.
splice
(
i
,
0
,
dragObj
)
ar
.
splice
(
i
,
0
,
dragObj
)
;
}
else
{
ar
.
splice
(
i
+
1
,
0
,
dragObj
)
ar
.
splice
(
i
+
1
,
0
,
dragObj
)
;
}
}
data
.
shift
()
let
newTreeData
=
this
.
renderTreeNodes
(
this
.
handleLoop
(
data
,
0
))
this
.
setState
({
treeData
:
newTreeData
})
data
.
shift
();
let
newTreeData
=
this
.
renderTreeNodes
(
this
.
handleLoop
(
data
,
0
));
this
.
setState
({
treeData
:
newTreeData
});
let
firstParentNode
=
{
categoryCount
:
0
,
categoryLevel
:
0
,
categoryName
:
''
,
id
:
0
,
parentId
:
0
,
parentName
:
''
,
rootId
:
0
,
sonCategoryList
:
[...
newTreeData
],
sort
:
0
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
};
let
movedCategory
=
this
.
movedNodeFind
(
newTreeData
,
info
.
dragNode
.
id
);
let
parentCategory
=
movedCategory
.
parentId
===
'0'
?
firstParentNode
:
this
.
movedNodeFind
(
newTreeData
,
targetParentId
);
let
params
=
{
categoryList
:
newTreeData
,
movedCategory
,
parentCategory
,
source
:
0
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
()
userId
:
User
.
getStoreUserId
(),
};
AidToolService
.
moveCategoryTree
(
params
).
then
((
res
)
=>
{
this
.
queryCategoryTree
(
'remain'
);
});
};
// 获取移动节点信息
movedNodeFind
(
categoryList
,
movedId
)
{
for
(
const
item
of
categoryList
)
{
if
(
item
.
id
===
movedId
)
return
item
;
if
(
item
.
sonCategoryList
&&
item
.
sonCategoryList
.
length
>
0
)
{
const
node
=
this
.
movedNodeFind
(
item
.
sonCategoryList
,
movedId
);
if
(
node
)
return
node
;
}
}
AidToolService
.
editCategoryTree
(
params
).
then
((
res
)
=>
{
this
.
queryCategoryTree
(
'remain'
)
})
return
null
;
}
handleLoop
=
(
data
,
level
)
=>
{
data
.
map
((
item
,
index
)
=>
{
item
.
sort
=
index
item
.
categoryLevel
=
level
item
.
sort
=
index
;
item
.
categoryLevel
=
level
;
if
(
item
.
sonCategoryList
)
{
item
.
children
=
this
.
handleLoop
(
item
.
sonCategoryList
,
level
+
1
)
item
.
sonCategoryList
=
this
.
handleLoop
(
item
.
sonCategoryList
,
level
+
1
)
item
.
children
=
this
.
handleLoop
(
item
.
sonCategoryList
,
level
+
1
)
;
item
.
sonCategoryList
=
this
.
handleLoop
(
item
.
sonCategoryList
,
level
+
1
)
;
}
return
item
})
return
data
}
return
item
;
})
;
return
data
;
}
;
// 树状展开事件
onExpand
=
(
expandedKeys
)
=>
{
this
.
setState
({
expandedKeys
})
}
this
.
setState
({
expandedKeys
})
;
}
;
// 树状选中事件
onSelect
=
(
selectedKeys
)
=>
{
this
.
setState
({
selectedKeys
})
}
this
.
setState
({
selectedKeys
})
;
}
;
render
()
{
const
{
treeData
,
originTreeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
operateCourseCategoryModal
}
=
this
.
state
const
{
treeData
,
originTreeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
operateCourseCategoryModal
}
=
this
.
state
;
return
(
<
div
className=
'page course-category-manage'
>
{
[
'aid'
,
'knowledge'
].
includes
(
getParameterByName
(
'from'
))
?
(
...
...
@@ -534,10 +557,10 @@ class CourseCategoryManage extends Component {
type=
'primary'
onClick=
{
()
=>
{
if
(
originTreeData
.
length
>=
29
)
{
message
.
info
(
'最多只能添加30个分类'
)
return
message
.
info
(
'最多只能添加30个分类'
)
;
return
;
}
this
.
newEditCourseCategory
(
'newEqualLevelCategory'
,
'equal'
,
'new'
)
this
.
newEditCourseCategory
(
'newEqualLevelCategory'
,
'equal'
,
'new'
)
;
}
}
>
新增一级分类
</
Button
>
...
...
@@ -559,8 +582,8 @@ class CourseCategoryManage extends Component {
</
div
>
{
operateCourseCategoryModal
}
</
div
>
)
)
;
}
}
export
default
CourseCategoryManage
export
default
CourseCategoryManage
;
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
View file @
899bf803
/*
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-0
4-13 13:55:37
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-0
6-15 11:20:48
* @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
Component
}
from
"react"
;
import
{
Input
,
Button
,
Tree
}
from
"antd"
;
import
"./CourseCategorySiderTree.less"
;
import
User
from
"@/common/js/user"
;
import
AidToolService
from
"@/domains/aid-tool-domain/AidToolService"
;
import
Bus
from
"@/core/bus"
;
import
React
,
{
Component
}
from
'react'
;
import
{
Input
,
Button
,
Tree
}
from
'antd'
;
import
'./CourseCategorySiderTree.less'
;
import
User
from
'@/common/js/user'
;
import
AidToolService
from
'@/domains/aid-tool-domain/AidToolService'
;
import
Bus
from
'@/core/bus'
;
const
{
Search
}
=
Input
;
const
{
DirectoryTree
}
=
Tree
;
...
...
@@ -20,31 +20,25 @@ class CourseCategorySiderTree extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
selectedKeys
:
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
props
.
fromModule
)
?
[
getParameterByName
(
"categoryId"
)
||
"null"
]
:
[
"null"
],
selectedKeys
:
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
props
.
fromModule
)
?
[
getParameterByName
(
'categoryId'
)
||
'null'
]
:
[
'null'
],
treeData
:
props
.
treeData
||
[],
autoExpandParent
:
false
,
};
}
componentDidMount
()
{
this
.
queryCategoryTree
(
"init"
);
Bus
.
bind
(
"queryCategoryTree"
,
this
.
queryCategoryTree
);
this
.
queryCategoryTree
(
'init'
);
Bus
.
bind
(
'queryCategoryTree'
,
this
.
queryCategoryTree
);
}
componentWillUnmount
()
{
Bus
.
unbind
(
"queryCategoryTree"
,
this
.
queryCategoryTree
);
Bus
.
unbind
(
'queryCategoryTree'
,
this
.
queryCategoryTree
);
}
// 查询分类树
queryCategoryTree
=
(
type
=
"init"
,
categoryName
)
=>
{
queryCategoryTree
=
(
type
=
'init'
,
categoryName
)
=>
{
let
query
=
{
bizType
:
[
"QUESTION_INDEX"
,
"QUESTION_MODAL"
].
includes
(
this
.
props
.
fromModule
)
?
"QUESTION"
:
"PAPER"
,
bizType
:
[
'QUESTION_INDEX'
,
'QUESTION_MODAL'
].
includes
(
this
.
props
.
fromModule
)
?
'QUESTION'
:
'PAPER'
,
categoryName
,
count
:
true
,
source
:
0
,
...
...
@@ -53,7 +47,7 @@ class CourseCategorySiderTree extends Component {
};
AidToolService
.
queryCategoryTree
(
query
).
then
((
res
)
=>
{
const
{
categoryList
=
[],
noCategoryCnt
=
0
}
=
res
.
result
;
let
str
=
"未分类"
;
let
str
=
'未分类'
;
if
(
categoryName
)
{
this
.
setState
({
autoExpandParent
:
true
});
if
(
str
.
indexOf
(
categoryName
)
<
0
)
{
...
...
@@ -64,15 +58,15 @@ class CourseCategorySiderTree extends Component {
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
);
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
nodeId
});
}
}
else
{
const
defaultNode
=
{
id
:
"null"
,
categoryName
:
"未分类"
,
id
:
'null'
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
parentId
:
"0"
,
parentId
:
'0'
,
categoryLevel
:
0
,
};
categoryList
.
unshift
(
defaultNode
);
...
...
@@ -83,24 +77,24 @@ class CourseCategorySiderTree extends Component {
Object
.
keys
(
this
.
state
.
treeMap
).
forEach
((
item
)
=>
{
nodeId
.
push
(
item
);
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
nodeId
});
}
}
}
else
{
this
.
setState
({
autoExpandParent
:
false
});
const
defaultNode
=
{
id
:
"null"
,
categoryName
:
"未分类"
,
id
:
'null'
,
categoryName
:
'未分类'
,
categoryCount
:
noCategoryCnt
,
parentId
:
"0"
,
parentId
:
'0'
,
categoryLevel
:
0
,
};
categoryList
.
unshift
(
defaultNode
);
this
.
setState
({
treeData
:
this
.
renderTreeNodes
(
categoryList
,
categoryName
),
});
if
(
type
===
"init"
)
{
if
(
type
===
'init'
)
{
this
.
setState
({
expandedKeys
:
[]
});
}
}
...
...
@@ -126,12 +120,12 @@ class CourseCategorySiderTree extends Component {
// 树状选中事件
onSelect
=
(
selectedKeys
)
=>
{
this
.
setState
({
selectedKeys
},
()
=>
{
if
(
this
.
props
.
fromModule
===
"QUESTION_INDEX"
)
{
Bus
.
trigger
(
"queryQuestionPageList"
,
selectedKeys
[
0
]);
}
else
if
(
this
.
props
.
fromModule
===
"QUESTION_MODAL"
)
{
Bus
.
trigger
(
"queryQuestionPageListWithContent"
,
selectedKeys
[
0
]);
if
(
this
.
props
.
fromModule
===
'QUESTION_INDEX'
)
{
Bus
.
trigger
(
'queryQuestionPageList'
,
selectedKeys
[
0
]);
}
else
if
(
this
.
props
.
fromModule
===
'QUESTION_MODAL'
)
{
Bus
.
trigger
(
'queryQuestionPageListWithContent'
,
selectedKeys
[
0
]);
}
else
{
Bus
.
trigger
(
"queryPaperPageList"
,
selectedKeys
[
0
],
0
);
Bus
.
trigger
(
'queryPaperPageList'
,
selectedKeys
[
0
],
0
);
}
});
};
...
...
@@ -144,39 +138,35 @@ class CourseCategorySiderTree extends Component {
item
.
title
=
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
(
<
span
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
)
:
(
<
span
style=
{
{
opacity
:
0.5
}
}
>
{
item
.
categoryName
}
(
{
item
.
categoryCount
}
)
{
item
.
categoryName
}
{
item
.
categoryCount
>
0
&&
<
span
>
(
{
item
.
categoryCount
}
)
</
span
>
}
</
span
>
);
item
.
icon
=
item
.
categoryName
===
"未分类"
?
(
item
.
categoryName
===
'未分类'
?
(
<
img
style=
{
{
width
:
"24px"
,
height
:
"24px"
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
"https://image.xiaomaiketang.com/xm/defaultCategory.png"
alt=
""
src=
'https://image.xiaomaiketang.com/xm/defaultCategory.png'
alt=
''
/>
)
:
(
<
img
style=
{
{
width
:
"24px"
,
height
:
"24px"
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
width
:
'24px'
,
height
:
'24px'
,
opacity
:
!
value
||
(
value
&&
item
.
categoryName
.
indexOf
(
value
)
>
-
1
)
?
1
:
0.5
,
}
}
src=
"https://image.xiaomaiketang.com/xm/hasCategory.png"
alt=
""
src=
'https://image.xiaomaiketang.com/xm/hasCategory.png'
alt=
''
/>
);
if
(
item
.
sonCategoryList
)
{
...
...
@@ -190,46 +180,34 @@ class CourseCategorySiderTree extends Component {
};
render
()
{
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
,
}
=
this
.
state
;
const
{
treeData
,
expandedKeys
,
selectedKeys
,
autoExpandParent
}
=
this
.
state
;
return
(
<
div
className=
"category-tree-sider"
>
{
[
"QUESTION_INDEX"
,
"PAPER_INDEX"
].
includes
(
this
.
props
.
fromModule
)
&&
(
<
div
className=
"sider-title"
>
{
this
.
props
.
fromModule
===
"QUESTION_INDEX"
?
"题目分类"
:
"试卷分类"
}
</
div
>
<
div
className=
'category-tree-sider'
>
{
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
this
.
props
.
fromModule
)
&&
(
<
div
className=
'sider-title'
>
{
this
.
props
.
fromModule
===
'QUESTION_INDEX'
?
'题目分类'
:
'试卷分类'
}
</
div
>
)
}
<
Search
className=
"sider-search"
placeholder=
"搜索名称分类"
className=
'sider-search'
placeholder=
'搜索名称分类'
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
)
&&
User
.
getUserRole
()
!==
"CloudLecturer"
&&
this
.
props
.
type
!==
"modal-select"
&&
(
<
div
className=
"sider-btn"
>
<
Button
onClick=
{
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
"/course-category-manage?from=aid"
,
});
}
}
>
分类管理
</
Button
>
</
div
>
)
}
<
div
className=
"sider-tree"
>
{
[
'QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
this
.
props
.
fromModule
)
&&
User
.
getUserRole
()
!==
'CloudLecturer'
&&
this
.
props
.
type
!==
'modal-select'
&&
(
<
div
className=
'sider-btn'
>
<
Button
onClick=
{
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
'/course-category-manage?from=aid'
,
});
}
}
>
分类管理
</
Button
>
</
div
>
)
}
<
div
className=
'sider-tree'
>
<
DirectoryTree
expandedKeys=
{
expandedKeys
}
autoExpandParent=
{
autoExpandParent
}
...
...
src/modules/teach-tool/examination-manager/UserData.tsx
View file @
899bf803
...
...
@@ -184,7 +184,7 @@ function DataAnalysic(props: any) {
onClick=
{
()
=>
{
checkAnswerDetail
(
record
);
}
}
>
答题详情
答题详情
</
div
>
</
When
>
<
Otherwise
>
-
</
Otherwise
>
...
...
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
899bf803
/*
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-06-1
0 11:13:36
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-06-1
5 17:20:48
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import
React
,
{
Component
}
from
"react"
;
import
{
Form
,
Button
,
Input
,
Table
,
InputNumber
,
ConfigProvider
,
Empty
,
Tooltip
,
message
,
Modal
,
Spin
,
Space
,
Radio
,
}
from
"antd"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
{
XMTable
}
from
"@/components"
;
import
ShowTips
from
"@/components/ShowTips"
;
import
Breadcrumbs
from
"@/components/Breadcrumbs"
;
import
"./OperatePaper.less"
;
import
SelectQuestionModal
from
"./modal/SelectQuestionModal"
;
import
PaperPreviewModal
from
"./modal/PreviewPaperModal"
;
import
User
from
"@/common/js/user"
;
import
AidToolService
from
"@/domains/aid-tool-domain/AidToolService"
;
import
Bus
from
"@/core/bus"
;
import
{
Route
,
withRouter
}
from
"react-router-dom"
;
import
React
,
{
Component
}
from
'react'
;
import
{
Form
,
Button
,
Input
,
Table
,
InputNumber
,
ConfigProvider
,
Empty
,
Tooltip
,
message
,
Modal
,
Spin
,
Space
,
Radio
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
XMTable
}
from
'@/components'
;
import
ShowTips
from
'@/components/ShowTips'
;
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
'./OperatePaper.less'
;
import
SelectQuestionModal
from
'./modal/SelectQuestionModal'
;
import
PaperPreviewModal
from
'./modal/PreviewPaperModal'
;
import
User
from
'@/common/js/user'
;
import
AidToolService
from
'@/domains/aid-tool-domain/AidToolService'
;
import
Bus
from
'@/core/bus'
;
import
_
from
'underscore'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
*
as
paperEmpty
from
'../../lottie/paperEmpty/data.json'
;
import
AddExam
from
"@/modules/teach-tool/examination-manager/AddExam"
;
import
_
from
"underscore"
;
import
AddExam
from
'@/modules/teach-tool/examination-manager/AddExam'
;
const
questionTypeEnum
=
{
SINGLE_CHOICE
:
"单选题"
,
MULTI_CHOICE
:
"多选题"
,
JUDGE
:
"判断题"
,
GAP_FILLING
:
"填空题"
,
INDEFINITE_CHOICE
:
"不定项选择题"
,
SINGLE_CHOICE
:
'单选题'
,
MULTI_CHOICE
:
'多选题'
,
JUDGE
:
'判断题'
,
GAP_FILLING
:
'填空题'
,
INDEFINITE_CHOICE
:
'不定项选择题'
,
};
class
OperatePaper
extends
Component
{
formRef
=
React
.
createRef
();
...
...
@@ -50,7 +36,7 @@ class OperatePaper extends Component {
super
(
props
);
this
.
state
=
{
formData
:
{
categoryId
:
getParameterByName
(
"categoryId"
),
// 分类ID
categoryId
:
getParameterByName
(
'categoryId'
),
// 分类ID
singleChoiceCnt
:
0
,
// 单选题数量
multiChoiceCnt
:
0
,
// 多选题数量
judgeCnt
:
0
,
// 判断题数量
...
...
@@ -73,36 +59,30 @@ class OperatePaper extends Component {
},
selectQuestionModal
:
null
,
paperPreviewModal
:
null
,
quickSortModalVisible
:
false
,
// 快捷排序弹窗显隐
quickSortModalVisible
:
false
,
// 快捷排序弹窗显隐
selectQuestionList
:
[],
currentOperate
:
""
,
currentNav
:
""
,
currentOperate
:
''
,
currentNav
:
''
,
currentCategoryPapers
:
[],
loading
:
false
,
check
:
false
,
sorterMethod
:
"addOrder"
,
sorterBy
:
[
"SINGLE_CHOICE"
,
"MULTI_CHOICE"
,
"JUDGE"
,
"GAP_FILLING"
,
"INDEFINITE_CHOICE"
,
],
sorterMethod
:
'addOrder'
,
sorterBy
:
[
'SINGLE_CHOICE'
,
'MULTI_CHOICE'
,
'JUDGE'
,
'GAP_FILLING'
,
'INDEFINITE_CHOICE'
],
sorterTypeList
:
[
{
typeKey
:
"SINGLE_CHOICE"
,
typeKey
:
'SINGLE_CHOICE'
,
},
{
typeKey
:
"MULTI_CHOICE"
,
typeKey
:
'MULTI_CHOICE'
,
},
{
typeKey
:
"JUDGE"
,
typeKey
:
'JUDGE'
,
},
{
typeKey
:
"GAP_FILLING"
,
typeKey
:
'GAP_FILLING'
,
},
{
typeKey
:
"INDEFINITE_CHOICE"
,
typeKey
:
'INDEFINITE_CHOICE'
,
},
],
};
...
...
@@ -110,30 +90,26 @@ class OperatePaper extends Component {
componentDidMount
()
{
this
.
queryCurrentCategoryPapers
();
switch
(
getParameterByName
(
"type"
))
{
case
"new"
:
this
.
setState
({
currentOperate
:
"new"
,
currentNav
:
"新建试卷"
});
switch
(
getParameterByName
(
'type'
))
{
case
'new'
:
this
.
setState
({
currentOperate
:
'new'
,
currentNav
:
'新建试卷'
});
break
;
case
"edit"
:
this
.
setState
({
currentOperate
:
"edit"
,
currentNav
:
"编辑试卷"
},
()
=>
this
.
queryPaperDetail
()
);
case
'edit'
:
this
.
setState
({
currentOperate
:
'edit'
,
currentNav
:
'编辑试卷'
},
()
=>
this
.
queryPaperDetail
());
break
;
case
"copy"
:
this
.
setState
({
currentOperate
:
"copy"
,
currentNav
:
"复制试卷"
},
()
=>
this
.
queryPaperDetail
()
);
case
'copy'
:
this
.
setState
({
currentOperate
:
'copy'
,
currentNav
:
'复制试卷'
},
()
=>
this
.
queryPaperDetail
());
break
;
}
}
// 获取当前分类下的所有试卷
queryCurrentCategoryPapers
=
()
=>
{
const
categoryId
=
getParameterByName
(
"categoryId"
);
const
categoryId
=
getParameterByName
(
'categoryId'
);
let
params
=
{
current
:
1
,
size
:
9999
,
categoryId
:
categoryId
===
"null"
?
null
:
categoryId
,
categoryId
:
categoryId
===
'null'
?
null
:
categoryId
,
paperName
:
null
,
// 试卷名称
source
:
0
,
tenantId
:
User
.
getStoreId
(),
...
...
@@ -150,7 +126,7 @@ class OperatePaper extends Component {
this
.
setState
({
loading
:
true
});
const
{
currentOperate
}
=
this
.
state
;
let
query
=
{
paperId
:
getParameterByName
(
"paperId"
),
paperId
:
getParameterByName
(
'paperId'
),
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
...
...
@@ -163,9 +139,8 @@ class OperatePaper extends Component {
selectQuestionList
:
questionList
,
formData
:
{
...
result
,
paperId
:
getParameterByName
(
"paperId"
),
paperName
:
currentOperate
===
"copy"
?
paperName
+
"(复制)"
:
paperName
,
paperId
:
getParameterByName
(
'paperId'
),
paperName
:
currentOperate
===
'copy'
?
paperName
+
'(复制)'
:
paperName
,
},
loading
:
false
,
},
...
...
@@ -188,26 +163,11 @@ class OperatePaper extends Component {
const
_selectQuestionList
=
[...
list
];
// 各类型题目汇总
const
singleQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
"SINGLE_CHOICE"
);
const
multiQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
"MULTI_CHOICE"
);
const
judgeQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
"JUDGE"
);
const
gapQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
"GAP_FILLING"
);
const
indefiniteQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
"INDEFINITE_CHOICE"
);
const
singleQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
'SINGLE_CHOICE'
);
const
multiQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
'MULTI_CHOICE'
);
const
judgeQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
'JUDGE'
);
const
gapQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
'GAP_FILLING'
);
const
indefiniteQuestion
=
_
.
filter
(
_selectQuestionList
,
(
item
)
=>
item
.
questionType
===
'INDEFINITE_CHOICE'
);
// 各类型题目总分值
const
singleChoiceScore
=
singleQuestion
.
reduce
((
prev
,
cur
)
=>
{
...
...
@@ -277,9 +237,7 @@ class OperatePaper extends Component {
const
selectQuestionList
=
[...
this
.
state
.
selectQuestionList
];
const
item
=
selectQuestionList
.
splice
(
index
+
moveLength
,
1
);
selectQuestionList
.
splice
(
index
,
0
,
item
[
0
]);
this
.
setState
({
selectQuestionList
},
()
=>
this
.
setFormData
(
this
.
state
.
selectQuestionList
)
);
this
.
setState
({
selectQuestionList
},
()
=>
this
.
setFormData
(
this
.
state
.
selectQuestionList
));
};
// 移除已选题目
...
...
@@ -287,9 +245,7 @@ class OperatePaper extends Component {
const
{
selectQuestionList
}
=
this
.
state
;
this
.
setState
(
{
selectQuestionList
:
[...
selectQuestionList
].
filter
(
(
item
)
=>
item
.
questionId
!==
delQuestionId
),
selectQuestionList
:
[...
selectQuestionList
].
filter
((
item
)
=>
item
.
questionId
!==
delQuestionId
),
},
()
=>
this
.
setFormData
(
this
.
state
.
selectQuestionList
)
);
...
...
@@ -303,15 +259,12 @@ class OperatePaper extends Component {
if
(
result
!=
null
)
{
return
result
;
}
if
([
"new"
,
"copy"
].
includes
(
currentOperate
))
{
if
([
'new'
,
'copy'
].
includes
(
currentOperate
))
{
if
(
item
.
paperName
===
paperName
)
{
result
=
item
;
}
}
else
if
(
currentOperate
===
"edit"
)
{
if
(
item
.
paperName
===
paperName
&&
item
.
paperId
!==
getParameterByName
(
"paperId"
)
)
{
}
else
if
(
currentOperate
===
'edit'
)
{
if
(
item
.
paperName
===
paperName
&&
item
.
paperId
!==
getParameterByName
(
'paperId'
))
{
result
=
item
;
}
}
...
...
@@ -321,15 +274,15 @@ class OperatePaper extends Component {
validatePaperName
=
(
paperName
)
=>
{
if
(
this
.
state
.
check
&&
!
paperName
)
{
return
"请输入试卷名称"
;
return
'请输入试卷名称'
;
}
if
(
this
.
checkExist
(
paperName
))
{
return
"该试卷名称已存在"
;
return
'该试卷名称已存在'
;
}
if
(
paperName
&&
paperName
.
length
>
40
)
{
return
"试卷名称最多40字"
;
return
'试卷名称最多40字'
;
}
};
...
...
@@ -337,19 +290,14 @@ class OperatePaper extends Component {
savePaper
=
(
saveType
)
=>
{
this
.
setState
({
check
:
true
});
const
{
selectQuestionList
,
formData
,
currentOperate
}
=
this
.
state
;
const
categoryId
=
getParameterByName
(
"categoryId"
);
const
categoryId
=
getParameterByName
(
'categoryId'
);
const
{
match
}
=
this
.
props
;
let
questionList
=
[];
if
(
!
formData
.
passRate
||
!
formData
.
paperName
||
this
.
checkExist
(
formData
.
paperName
)
||
(
formData
.
paperName
&&
formData
.
paperName
.
length
>
40
)
)
{
if
(
!
formData
.
passRate
||
!
formData
.
paperName
||
this
.
checkExist
(
formData
.
paperName
)
||
(
formData
.
paperName
&&
formData
.
paperName
.
length
>
40
))
{
return
;
}
if
(
selectQuestionList
.
length
===
0
)
{
return
message
.
warning
(
"请选择题目"
);
return
message
.
warning
(
'请选择题目'
);
}
selectQuestionList
.
forEach
((
item
,
index
)
=>
{
...
...
@@ -370,29 +318,23 @@ class OperatePaper extends Component {
},
},
()
=>
{
if
([
"new"
,
"copy"
].
includes
(
currentOperate
))
{
if
([
'new'
,
'copy'
].
includes
(
currentOperate
))
{
AidToolService
.
createPaper
(
this
.
state
.
formData
)
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
saveType
===
"saveToAddExam"
)
{
if
(
saveType
===
'saveToAddExam'
)
{
this
.
setState
({
formData
:
{
...
formData
,
paperId
:
res
.
result
}
},
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
`
${
match
.
url
}
/exam-operate-page`
,
});
})
})
;
}
else
{
message
.
success
(
currentOperate
===
"new"
?
"新建成功"
:
"复制成功"
);
message
.
success
(
currentOperate
===
'new'
?
'新建成功'
:
'复制成功'
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryPaperPageList"
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
}
}
})
...
...
@@ -400,34 +342,26 @@ class OperatePaper extends Component {
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryPaperPageList"
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
});
}
else
if
(
currentOperate
===
"edit"
)
{
}
else
if
(
currentOperate
===
'edit'
)
{
AidToolService
.
editPaper
({
...
this
.
state
.
formData
,
paperId
:
getParameterByName
(
"paperId"
),
paperId
:
getParameterByName
(
'paperId'
),
})
.
then
((
res
)
=>
{
if
(
res
.
success
)
{
if
(
saveType
===
"saveToAddExam"
)
{
if
(
saveType
===
'saveToAddExam'
)
{
window
.
RCHistory
.
push
({
pathname
:
`
${
match
.
url
}
/exam-operate-page`
,
});
}
else
{
message
.
success
(
"编辑成功"
);
message
.
success
(
'编辑成功'
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryPaperPageList"
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
}
}
})
...
...
@@ -435,11 +369,7 @@ class OperatePaper extends Component {
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryPaperPageList"
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
});
}
}
...
...
@@ -451,7 +381,7 @@ class OperatePaper extends Component {
const
{
selectQuestionList
,
formData
}
=
this
.
state
;
const
m
=
(
<
PaperPreviewModal
previewPage=
"paper-operate"
previewPage=
'paper-operate'
paperInfo=
{
{
...
formData
,
questionList
:
selectQuestionList
}
}
close=
{
()
=>
{
this
.
setState
({
...
...
@@ -466,21 +396,17 @@ class OperatePaper extends Component {
// 取消/返回
handleGoBack
=
()
=>
{
Modal
.
confirm
({
title
:
"确定要返回吗?"
,
content
:
"返回后,本次编辑的内容将不被保存"
,
okText
:
"确认返回"
,
cancelText
:
"留在本页"
,
icon
:
(
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
title
:
'确定要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
'categoryId'
)}
`
,
});
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
"queryPaperPageList"
,
getParameterByName
(
"categoryId"
),
0
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryPaperPageList'
,
getParameterByName
(
'categoryId'
),
0
);
},
});
};
...
...
@@ -490,39 +416,39 @@ class OperatePaper extends Component {
const
{
selectQuestionList
}
=
this
.
state
;
const
columns
=
[
{
title
:
"序号"
,
dataIndex
:
"index"
,
key
:
"index"
,
width
:
"10%"
,
title
:
'序号'
,
dataIndex
:
'index'
,
key
:
'index'
,
width
:
'10%'
,
render
:
(
val
,
record
,
index
)
=>
{
return
<
span
>
{
index
+
1
}
</
span
>;
},
},
{
title
:
"题型"
,
dataIndex
:
"questionType"
,
key
:
"questionType"
,
width
:
"12%"
,
title
:
'题型'
,
dataIndex
:
'questionType'
,
key
:
'questionType'
,
width
:
'12%'
,
filters
:
[
{
text
:
"单选题"
,
value
:
"SINGLE_CHOICE"
,
text
:
'单选题'
,
value
:
'SINGLE_CHOICE'
,
},
{
text
:
"多选题"
,
value
:
"MULTI_CHOICE"
,
text
:
'多选题'
,
value
:
'MULTI_CHOICE'
,
},
{
text
:
"判断题"
,
value
:
"JUDGE"
,
text
:
'判断题'
,
value
:
'JUDGE'
,
},
{
text
:
"填空题"
,
value
:
"GAP_FILLING"
,
text
:
'填空题'
,
value
:
'GAP_FILLING'
,
},
{
text
:
"不定项选择题"
,
value
:
"INDEFINITE_CHOICE"
,
text
:
'不定项选择题'
,
value
:
'INDEFINITE_CHOICE'
,
},
],
filterMultiple
:
true
,
...
...
@@ -530,26 +456,23 @@ class OperatePaper extends Component {
render
:
(
val
)
=>
questionTypeEnum
[
val
],
},
{
title
:
"题目"
,
dataIndex
:
"questionStem"
,
key
:
"questionStem"
,
title
:
'题目'
,
dataIndex
:
'questionStem'
,
key
:
'questionStem'
,
ellipsis
:
{
showTitle
:
false
,
},
render
:
(
val
)
=>
{
var
handleVal
=
val
;
handleVal
=
handleVal
.
replace
(
/<
(?!
img|input
)
.*
?
>/g
,
""
);
handleVal
=
handleVal
.
replace
(
/<
\s?
input
[^
>
]
*>/gi
,
"_、"
);
handleVal
=
handleVal
.
replace
(
/
\&
nbsp
\;
/gi
,
" "
);
handleVal
=
handleVal
.
replace
(
/<
(?!
img|input
)
.*
?
>/g
,
''
);
handleVal
=
handleVal
.
replace
(
/<
\s?
input
[^
>
]
*>/gi
,
'_、'
);
handleVal
=
handleVal
.
replace
(
/
\&
nbsp
\;
/gi
,
' '
);
return
(
<
Tooltip
overlayClassName=
"aid-tool-list"
title=
{
<
div
style=
{
{
maxWidth
:
700
,
width
:
"auto"
}
}
>
{
handleVal
}
</
div
>
}
placement=
"topLeft"
overlayStyle=
{
{
maxWidth
:
700
}
}
>
overlayClassName=
'aid-tool-list'
title=
{
<
div
style=
{
{
maxWidth
:
700
,
width
:
'auto'
}
}
>
{
handleVal
}
</
div
>
}
placement=
'topLeft'
overlayStyle=
{
{
maxWidth
:
700
}
}
>
{
handleVal
}
</
Tooltip
>
);
...
...
@@ -558,22 +481,23 @@ class OperatePaper extends Component {
{
title
:
(
<
span
>
分值
{
" "
}
<
Tooltip
title=
"多选题和填空题的漏选/半对得分不能高于题目本身分值"
>
分值
{
' '
}
<
Tooltip
title=
'多选题和填空题的漏选/半对得分不能高于题目本身分值'
>
<
span
className=
"icon iconfont"
className=
'icon iconfont'
style=
{
{
color
:
"#BFBFBF"
,
fontSize
:
14
,
fontWeight
:
"400"
}
}
>
color
:
'#BFBFBF'
,
fontSize
:
14
,
fontWeight
:
'400'
,
}
}
>

</
span
>
</
Tooltip
>
</
span
>
),
dataIndex
:
"score"
,
key
:
"score"
,
width
:
"12%"
,
dataIndex
:
'score'
,
key
:
'score'
,
width
:
'12%'
,
render
:
(
val
,
record
,
index
)
=>
{
return
(
<
InputNumber
...
...
@@ -584,11 +508,7 @@ class OperatePaper extends Component {
const
_selectQuestionList
=
[...
selectQuestionList
];
this
.
setState
(
{
selectQuestionList
:
_selectQuestionList
.
map
((
item
)
=>
item
.
questionId
===
record
.
questionId
?
{
...
item
,
score
:
value
}
:
item
),
selectQuestionList
:
_selectQuestionList
.
map
((
item
)
=>
(
item
.
questionId
===
record
.
questionId
?
{
...
item
,
score
:
value
}
:
item
)),
},
()
=>
this
.
setFormData
(
this
.
state
.
selectQuestionList
)
);
...
...
@@ -598,20 +518,14 @@ class OperatePaper extends Component {
},
},
{
dataIndex
:
"portionScore"
,
key
:
"portionScore"
,
width
:
"18%"
,
dataIndex
:
'portionScore'
,
key
:
'portionScore'
,
width
:
'18%'
,
render
:
(
val
,
record
,
index
)
=>
{
return
(
[
"MULTI_CHOICE"
,
"GAP_FILLING"
,
"INDEFINITE_CHOICE"
].
includes
(
record
.
questionType
)
&&
(
[
'MULTI_CHOICE'
,
'GAP_FILLING'
,
'INDEFINITE_CHOICE'
].
includes
(
record
.
questionType
)
&&
(
<
div
>
{
record
.
questionType
===
"GAP_FILLING"
?
(
<
span
>
半对得
</
span
>
)
:
(
<
span
>
漏选得
</
span
>
)
}{
" "
}
{
record
.
questionType
===
'GAP_FILLING'
?
<
span
>
半对得
</
span
>
:
<
span
>
漏选得
</
span
>
}{
' '
}
<
InputNumber
min=
{
0
}
max=
{
record
.
score
-
1
}
...
...
@@ -621,9 +535,7 @@ class OperatePaper extends Component {
this
.
setState
(
{
selectQuestionList
:
_selectQuestionList
.
map
((
item
)
=>
item
.
questionId
===
record
.
questionId
?
{
...
item
,
portionScore
:
value
}
:
item
item
.
questionId
===
record
.
questionId
?
{
...
item
,
portionScore
:
value
}
:
item
),
},
()
=>
this
.
setFormData
(
this
.
state
.
selectQuestionList
)
...
...
@@ -636,43 +548,34 @@ class OperatePaper extends Component {
},
},
{
title
:
"操作"
,
dataIndex
:
"operate"
,
key
:
"operate"
,
width
:
"16%"
,
title
:
'操作'
,
dataIndex
:
'operate'
,
key
:
'operate'
,
width
:
'16%'
,
render
:
(
val
,
record
,
index
)
=>
{
return
(
<
div
className=
"record-operate"
>
<
div
className=
'record-operate'
>
<
div
className=
{
index
>
0
?
"record-operate__item"
:
"record-operate__ban"
}
className=
{
index
>
0
?
'record-operate__item'
:
'record-operate__ban'
}
onClick=
{
()
=>
{
this
.
handleMoveItem
(
index
,
-
1
);
}
}
>
}
}
>
上移
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
span
className=
'record-operate__item split'
>
|
</
span
>
<
div
className=
{
index
<
selectQuestionList
.
length
-
1
?
"record-operate__item"
:
"record-operate__ban"
}
className=
{
index
<
selectQuestionList
.
length
-
1
?
'record-operate__item'
:
'record-operate__ban'
}
onClick=
{
()
=>
{
this
.
handleMoveItem
(
index
,
1
);
}
}
>
}
}
>
下移
</
div
>
<
span
className=
"record-operate__item split"
>
|
</
span
>
<
span
className=
'record-operate__item split'
>
|
</
span
>
<
div
className=
"record-operate__item"
className=
'record-operate__item'
onClick=
{
()
=>
{
this
.
handleDelItem
(
record
.
questionId
);
}
}
>
}
}
>
移除
</
div
>
</
div
>
...
...
@@ -688,7 +591,7 @@ class OperatePaper extends Component {
const
sorterTypeList
=
[...
this
.
state
.
sorterTypeList
];
const
item
=
sorterTypeList
.
splice
(
index
+
moveLength
,
1
);
sorterTypeList
.
splice
(
index
,
0
,
item
[
0
]);
const
sorterBy
=
_
.
pluck
(
sorterTypeList
,
"typeKey"
);
const
sorterBy
=
_
.
pluck
(
sorterTypeList
,
'typeKey'
);
this
.
setState
({
sorterTypeList
,
sorterBy
});
};
...
...
@@ -696,13 +599,9 @@ class OperatePaper extends Component {
quickSorter
=
(
list
,
sorterMethod
,
sorterBy
)
=>
{
this
.
setState
({
selectQuestionList
:
sorterMethod
===
"addOrder"
sorterMethod
===
'addOrder'
?
list
.
sort
((
a
,
b
)
=>
a
.
sorterIndex
-
b
.
sorterIndex
)
:
list
.
sort
(
(
a
,
b
)
=>
sorterBy
.
indexOf
(
a
.
questionTypeEnum
||
a
.
questionType
)
-
sorterBy
.
indexOf
(
b
.
questionTypeEnum
||
b
.
questionType
)
),
:
list
.
sort
((
a
,
b
)
=>
sorterBy
.
indexOf
(
a
.
questionTypeEnum
||
a
.
questionType
)
-
sorterBy
.
indexOf
(
b
.
questionTypeEnum
||
b
.
questionType
)),
});
};
...
...
@@ -738,75 +637,70 @@ class OperatePaper extends Component {
totalScore
,
}
=
formData
;
const
{
match
}
=
this
.
props
;
const
selectQuestionList
=
[...
this
.
state
.
selectQuestionList
];
const
questionTypeEnum
=
{
SINGLE_CHOICE
:
"【单选题】"
,
MULTI_CHOICE
:
"【多选题】"
,
JUDGE
:
"【判断题】"
,
GAP_FILLING
:
"【填空题】"
,
INDEFINITE_CHOICE
:
"【不定项选择题】"
,
SINGLE_CHOICE
:
'【单选题】'
,
MULTI_CHOICE
:
'【多选题】'
,
JUDGE
:
'【判断题】'
,
GAP_FILLING
:
'【填空题】'
,
INDEFINITE_CHOICE
:
'【不定项选择题】'
,
};
const
typeColumns
=
[
{
title
:
"题型"
,
dataIndex
:
"typeKey"
,
key
:
"typeKey"
,
render
:
(
text
,
record
,
index
)
=>
<
span
style=
{
{
color
:
'#333333'
}
}
>
{
questionTypeEnum
[
text
]
}
</
span
>,
title
:
'题型'
,
dataIndex
:
'typeKey'
,
key
:
'typeKey'
,
render
:
(
text
,
record
,
index
)
=>
<
span
style=
{
{
color
:
'#333333'
}
}
>
{
questionTypeEnum
[
text
]
}
</
span
>,
},
{
title
:
"操作"
,
key
:
"action"
,
title
:
'操作'
,
key
:
'action'
,
align
:
'right'
,
render
:
(
text
,
record
,
index
)
=>
(
<
Space
size=
"middle"
>
<
Space
size=
'middle'
>
<
span
style=
{
{
color
:
index
>
0
?
'#2966FF'
:
'#CCCCCC'
,
cursor
:
'pointer'
}
}
style=
{
{
color
:
index
>
0
?
'#2966FF'
:
'#CCCCCC'
,
cursor
:
'pointer'
}
}
onClick=
{
()
=>
{
index
>
0
&&
this
.
handleMoveTypeSorter
(
index
,
-
1
);
}
}
>
}
}
>
上移
</
span
>
<
span
style=
{
{
color
:
'#BFBFBF'
}
}
>
|
</
span
>
<
span
style=
{
{
color
:
'#BFBFBF'
}
}
>
|
</
span
>
<
span
style=
{
{
color
:
index
<
4
?
'#2966FF'
:
'#CCCCCC'
,
cursor
:
'pointer'
}
}
style=
{
{
color
:
index
<
4
?
'#2966FF'
:
'#CCCCCC'
,
cursor
:
'pointer'
}
}
onClick=
{
()
=>
{
index
<
4
&&
this
.
handleMoveTypeSorter
(
index
,
1
);
}
}
>
}
}
>
下移
</
span
>
</
Space
>
),
},
];
return
(
<
div
>
<
div
className=
"page operate-paper-page"
>
<
div
className=
'page operate-paper-page'
>
<
Breadcrumbs
navList=
{
currentNav
}
goBack=
{
()
=>
this
.
handleGoBack
()
}
/>
<
Spin
spinning=
{
loading
}
>
<
div
className=
"box"
>
<
div
className=
"show-tips"
>
<
ShowTips
message=
"请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利"
/>
<
div
className=
'box'
>
<
div
className=
'show-tips'
>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
</
div
>
<
Form
ref=
{
this
.
formRef
}
style=
{
{
marginTop
:
24
,
marginBottom
:
'85px'
}
}
>
<
Form
.
Item
name=
"paperName"
label=
"试卷名称:"
name=
'paperName'
label=
'试卷名称:'
required
validateStatus=
{
this
.
validatePaperName
(
paperName
)
?
"error"
:
""
}
help=
{
this
.
validatePaperName
(
paperName
)
}
>
validateStatus=
{
this
.
validatePaperName
(
paperName
)
?
'error'
:
''
}
help=
{
this
.
validatePaperName
(
paperName
)
}
>
<
Input
value=
{
paperName
}
autoComplete=
"off"
autoComplete=
'off'
maxLength=
{
40
}
style=
{
{
width
:
300
}
}
placeholder=
"请输入试卷名称(40字以内)"
placeholder=
'请输入试卷名称(40字以内)'
onChange=
{
(
e
)
=>
{
this
.
setState
({
formData
:
{
...
...
@@ -819,12 +713,11 @@ class OperatePaper extends Component {
</
Form
.
Item
>
<
Form
.
Item
name=
"passRate"
label=
"及格线:"
name=
'passRate'
label=
'及格线:'
required
validateStatus=
{
check
&&
!
passRate
?
"error"
:
""
}
help=
{
check
&&
!
passRate
&&
"请输入及格线"
}
>
validateStatus=
{
check
&&
!
passRate
?
'error'
:
''
}
help=
{
check
&&
!
passRate
&&
'请输入及格线'
}
>
<
div
>
<
InputNumber
min=
{
1
}
...
...
@@ -841,9 +734,9 @@ class OperatePaper extends Component {
()
=>
this
.
setFormData
(
selectQuestionList
)
);
}
}
/>
{
" "
}
/>
{
' '
}
%
<
span
className=
"score-info"
>
<
span
className=
'score-info'
>
总分(
{
Number
(
totalScore
)
||
0
}
)*及格线(
{
Number
(
passRate
)
||
0
}
%)=及格分数(
...
...
@@ -851,67 +744,50 @@ class OperatePaper extends Component {
</
span
>
</
div
>
</
Form
.
Item
>
<
Space
size=
{
8
}
>
<
Button
className=
"choose-btn"
type=
"primary"
icon=
{
<
PlusOutlined
/>
}
onClick=
{
this
.
chooseQuestion
}
>
<
Button
className=
'choose-btn'
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
onClick=
{
this
.
chooseQuestion
}
>
自选题目
</
Button
>
<
Button
className=
"choose-btn"
className=
'choose-btn'
onClick=
{
()
=>
{
this
.
setState
({
quickSortModalVisible
:
true
,
});
}
}
>
}
}
>
快捷排序
</
Button
>
</
Space
>
{
questionCnt
>
0
&&
(
<
div
className=
"paper-info-tip"
style=
{
{
margin
:
"0 auto 12px"
}
}
>
<
div
className=
'paper-info-tip'
style=
{
{
margin
:
'0 auto 12px'
}
}
>
总计
<
span
>
{
totalScore
}
</
span
>
分,共
<
span
>
{
questionCnt
}
</
span
>
题。
{
" "
}
{
singleChoiceCnt
>
0
&&
`单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`
}
{
multiChoiceCnt
>
0
&&
`多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`
}
题。
{
singleChoiceCnt
>
0
&&
`单选题${singleChoiceCnt}题,共${singleChoiceScore}分;`
}
{
multiChoiceCnt
>
0
&&
`多选题${multiChoiceCnt}题,共${multiChoiceScore}分;`
}
{
judgeCnt
>
0
&&
`判断题${judgeCnt}题,共${judgeScore}分,`
}
{
gapFillingCnt
>
0
&&
`填空题${gapFillingCnt}题,共${gapFillingScore}分,`
}
{
indefiniteChoiceCnt
>
0
&&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`
}
{
gapFillingCnt
>
0
&&
`填空题${gapFillingCnt}题,共${gapFillingScore}分,`
}
{
indefiniteChoiceCnt
>
0
&&
`不定项选择题${indefiniteChoiceCnt}题,共${indefiniteChoiceScore}分`
}
</
div
>
)
}
<
XMTable
className=
"table-style"
className=
'table-style'
scroll=
{
{
y
:
350
}
}
columns=
{
this
.
parseColumns
()
}
dataSource=
{
selectQuestionList
}
pagination=
{
false
}
renderEmpty=
{
{
image
:
paperEmpty
,
description
:
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
请在左上角添加题目
</
span
>
description
:
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
请在左上角添加题目
</
span
>
,
}
}
/>
</
Form
>
</
div
>
<
div
className=
"footer"
>
<
div
className=
'footer'
>
<
Button
onClick=
{
this
.
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
this
.
previewPaper
}
>
预览
</
Button
>
<
Button
onClick=
{
()
=>
this
.
savePaper
(
"saveToAddExam"
)
}
>
保存并组织考试
</
Button
>
<
Button
type=
"primary"
onClick=
{
()
=>
this
.
savePaper
()
}
>
<
Button
onClick=
{
()
=>
this
.
savePaper
(
'saveToAddExam'
)
}
>
保存并组织考试
</
Button
>
<
Button
type=
'primary'
onClick=
{
()
=>
this
.
savePaper
()
}
>
保存
</
Button
>
</
div
>
...
...
@@ -920,8 +796,8 @@ class OperatePaper extends Component {
{
paperPreviewModal
}
<
Modal
maskClosable=
{
false
}
className=
"type-order-modal"
title=
"快捷排序"
className=
'type-order-modal'
title=
'快捷排序'
width=
{
560
}
visible=
{
quickSortModalVisible
}
onOk=
{
()
=>
{
...
...
@@ -934,27 +810,26 @@ class OperatePaper extends Component {
}
}
onCancel=
{
()
=>
{
this
.
setState
({
quickSortModalVisible
:
false
});
}
}
>
}
}
>
<
Radio
.
Group
onChange=
{
(
e
)
=>
this
.
setState
({
sorterMethod
:
e
.
target
.
value
,
})
}
value=
{
sorterMethod
}
>
<
Radio
value=
{
"addOrder"
}
>
按添加顺序排序
</
Radio
>
<
Radio
value=
{
"typeOrder"
}
>
按题型排序
</
Radio
>
value=
{
sorterMethod
}
>
<
Radio
value=
{
'addOrder'
}
>
按添加顺序排序
</
Radio
>
<
Radio
value=
{
'typeOrder'
}
>
按题型排序
</
Radio
>
</
Radio
.
Group
>
{
sorterMethod
===
"typeOrder"
&&
(
{
sorterMethod
===
'typeOrder'
&&
(
<
Table
className=
"type-order-table"
style=
{
{
marginTop
:
'24px'
}
}
className=
'type-order-table'
style=
{
{
marginTop
:
'24px'
}
}
showHeader=
{
false
}
columns=
{
typeColumns
}
dataSource=
{
sorterTypeList
}
pagination=
{
false
}
bordered=
{
false
}
/>
)
}
</
Modal
>
...
...
@@ -962,16 +837,7 @@ class OperatePaper extends Component {
<
Route
path=
{
`${match.url}/exam-operate-page`
}
render=
{
()
=>
{
return
(
<
AddExam
paperInfo=
{
formData
}
type=
{
currentOperate
===
"edit"
?
"editPaperToAddExam"
:
"newPaperToAddExam"
}
/>
);
return
<
AddExam
paperInfo=
{
formData
}
type=
{
currentOperate
===
'edit'
?
'editPaperToAddExam'
:
'newPaperToAddExam'
}
/>;
}
}
/>
</
div
>
...
...
src/modules/teach-tool/paper-manage/modal/PreviewPaperModal.jsx
View file @
899bf803
...
...
@@ -277,7 +277,7 @@ class PreviewPaperModal extends Component {
/>
</
div
>
}
description=
{
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
}
}
>
暂无内容
</
span
>
}
description=
{
<
span
style=
{
{
display
:
'block'
,
paddingBottom
:
24
,
marginTop
:
50
}
}
>
暂无内容
</
span
>
}
></
Empty
>
);
};
...
...
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