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
4603352f
Commit
4603352f
authored
Jul 01, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:区分复制试卷和编辑试卷调用的详情接口
parent
6d1ef729
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
201 additions
and
341 deletions
+201
-341
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+201
-341
No files found.
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
4603352f
/*
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-0
6-10 19:57:55
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-0
7-01 16:30:38
* @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
_
from
"underscore"
;
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
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
(
'edit'
));
break
;
case
"copy"
:
this
.
setState
({
currentOperate
:
"copy"
,
currentNav
:
"复制试卷"
},
()
=>
this
.
queryPaperDetail
()
);
case
'copy'
:
this
.
setState
({
currentOperate
:
'copy'
,
currentNav
:
'复制试卷'
},
()
=>
this
.
queryPaperDetail
(
'copy'
));
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
(),
...
...
@@ -146,14 +122,15 @@ class OperatePaper extends Component {
};
// 编辑/复制试卷时获取相应试卷详情
queryPaperDetail
=
async
()
=>
{
queryPaperDetail
=
async
(
flag
)
=>
{
this
.
setState
({
loading
:
true
});
const
{
currentOperate
}
=
this
.
state
;
let
query
=
{
paperId
:
getParameterByName
(
"paperId"
),
paperId
:
getParameterByName
(
'paperId'
),
source
:
0
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
flag
:
flag
===
'copy'
,
};
const
res
=
await
AidToolService
.
queryPaperDetail
(
query
);
const
{
result
}
=
res
;
...
...
@@ -163,9 +140,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 +164,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 +238,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 +246,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 +260,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 +275,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 +291,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 +319,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"
)
{
this
.
setState
({
formData
:{
...
formData
,
paperId
:
res
.
result
}},
()
=>
{
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 +343,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 +370,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 +382,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 +397,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 +417,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 +457,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,20 +482,17 @@ class OperatePaper extends Component {
{
title
:
(
<
span
>
分值
{
" "
}
<
Tooltip
title=
"多选题和填空题的漏选/半对得分不能高于题目本身分值"
>
<
span
className=
"icon iconfont"
style=
{
{
color
:
"#BFBFBF"
,
fontSize
:
14
,
fontWeight
:
"400"
}
}
>
分值
{
' '
}
<
Tooltip
title=
'多选题和填空题的漏选/半对得分不能高于题目本身分值'
>
<
span
className=
'icon iconfont'
style=
{
{
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
...
...
@@ -582,11 +503,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
)
);
...
...
@@ -596,20 +513,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
}
...
...
@@ -619,9 +530,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
)
...
...
@@ -634,43 +543,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
>
...
...
@@ -686,7 +586,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
});
};
...
...
@@ -694,13 +594,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
)),
});
};
...
...
@@ -739,41 +635,39 @@ class OperatePaper extends Component {
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
>
...
...
@@ -782,32 +676,26 @@ class OperatePaper extends Component {
];
return
(
<
div
>
<
div
className=
"page operate-paper-page"
>
<
Breadcrumbs
navList=
{
currentNav
}
goBack=
{
()
=>
this
.
handleGoBack
()
}
/>
<
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
}
}
>
<
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
:
{
...
...
@@ -820,12 +708,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
}
...
...
@@ -842,9 +729,9 @@ class OperatePaper extends Component {
()
=>
this
.
setFormData
(
selectQuestionList
)
);
}
}
/>
{
" "
}
/>
{
' '
}
%
<
span
className=
"score-info"
>
<
span
className=
'score-info'
>
总分(
{
Number
(
totalScore
)
||
0
}
)*及格线(
{
Number
(
passRate
)
||
0
}
%)=及格分数(
...
...
@@ -853,47 +740,33 @@ class OperatePaper extends Component {
</
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
}
...
...
@@ -901,18 +774,16 @@ class OperatePaper extends Component {
onChange=
{
this
.
sortByQuestionType
}
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
>
...
...
@@ -921,8 +792,8 @@ class OperatePaper extends Component {
{
paperPreviewModal
}
<
Modal
maskClosable=
{
false
}
className=
"type-order-modal"
title=
"快捷排序"
className=
'type-order-modal'
title=
'快捷排序'
width=
{
560
}
visible=
{
quickSortModalVisible
}
onOk=
{
()
=>
{
...
...
@@ -935,23 +806,21 @@ 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
}
...
...
@@ -964,16 +833,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
>
...
...
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