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
0e51ade3
Commit
0e51ade3
authored
Jul 13, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Plain Diff
fix:解决周优化考试引用试卷名称的合并冲突
parents
394dc6d5
6e337d86
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
553 additions
and
553 deletions
+553
-553
src/common/js/axios.ts
+6
-2
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
+3
-3
src/modules/teach-tool/examination-manager/AddExam.tsx
+514
-497
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+21
-36
src/modules/teach-tool/paper-manage/components/PaperList.jsx
+4
-4
src/modules/teach-tool/question-manage/OperateQuestion.jsx
+5
-11
No files found.
src/common/js/axios.ts
View file @
0e51ade3
/*
/*
* @Author: 吴文洁
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:31
* @Date: 2020-08-31 09:34:31
* @LastEditors:
Please set LastEditors
* @LastEditors:
yuananting
* @LastEditTime: 2021-0
6-24 19:34:21
* @LastEditTime: 2021-0
7-12 17:40:26
* @Description:
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -115,6 +115,10 @@ class Axios {
...
@@ -115,6 +115,10 @@ class Axios {
window
.
RCHistory
.
replace
(
'/login'
);
window
.
RCHistory
.
replace
(
'/login'
);
return
Promise
.
reject
();
return
Promise
.
reject
();
break
;
break
;
case
504
:
message
.
error
(
'网络状况不稳定,如果出现数据异常,请刷新页面'
);
Promise
.
reject
();
break
;
default
:
default
:
message
.
error
(
error
.
message
);
message
.
error
(
error
.
message
);
break
;
break
;
...
...
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
View file @
0e51ade3
/*
/*
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @Date: 2021-02-22 10:59:43
* @LastEditors:
fusanqias
ng
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-0
6-15 11:20:48
* @LastEditTime: 2021-0
7-13 11:54:21
* @Description: 助学工具-侧边课程分类树
* @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -20,7 +20,7 @@ class CourseCategorySiderTree extends Component {
...
@@ -20,7 +20,7 @@ class CourseCategorySiderTree extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
selectedKeys
:
[
'
QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
props
.
fromModule
)
?
[
getParameterByName
(
'categoryId'
)
||
'null'
]
:
[
'
null'
],
selectedKeys
:
[
'null'
],
treeData
:
props
.
treeData
||
[],
treeData
:
props
.
treeData
||
[],
autoExpandParent
:
false
,
autoExpandParent
:
false
,
};
};
...
...
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
0e51ade3
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
;
import
React
,
{
useState
,
useRef
,
useEffect
,
useContext
}
from
'react'
import
Breadcrumbs
from
'@/components/Breadcrumbs'
;
import
Breadcrumbs
from
"@/components/Breadcrumbs"
;
import
{
Form
,
Alert
,
Input
,
Button
,
InputNumber
,
DatePicker
,
Switch
,
Radio
,
message
,
Modal
,
Tooltip
}
from
'antd'
;
import
{
Form
,
Alert
,
Input
,
Button
,
InputNumber
,
DatePicker
,
Switch
,
Radio
,
message
,
Modal
,
Tooltip
}
from
'antd'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
{
Route
,
withRouter
}
from
'react-router-dom'
;
import
User
from
'@/common/js/user'
;
import
User
from
"@/common/js/user"
;
import
moment
from
'moment'
;
import
moment
from
'moment'
import
Service
from
'@/common/js/service'
;
import
Service
from
"@/common/js/service"
;
import
_
from
'underscore'
;
import
_
from
'underscore'
import
GraphicsEditor
from
'../../course-manage/components/GraphicsEditor'
;
import
GraphicsEditor
from
'../../course-manage/components/GraphicsEditor'
;
import
SelectPaperModal
from
'./SelectPaperModal'
;
import
SelectPaperModal
from
'./SelectPaperModal'
import
PreviewModal
from
'./PreviewModal'
;
import
PreviewModal
from
'./PreviewModal'
import
ShowTips
from
'@/components/ShowTips'
;
import
ShowTips
from
"@/components/ShowTips"
;
import
'./AddExam.less'
;
import
'./AddExam.less'
;
const
{
RangePicker
}
=
DatePicker
;
const
{
RangePicker
}
=
DatePicker
;
function
AddExam
(
props
:
any
)
{
function
AddExam
(
props
:
any
)
{
const
paperInfoInit
:
any
=
{
passScore
:
60
};
const
paperInfoInit
:
any
=
{
passScore
:
60
};
const
[
showModal
,
setShowModal
]
=
useState
(
false
);
const
[
showModal
,
setShowModal
]
=
useState
(
false
);
const
[
paperInfo
,
setPaperInfo
]
=
useState
(
paperInfoInit
);
const
[
paperInfo
,
setPaperInfo
]
=
useState
(
paperInfoInit
);
const
[
paperId
,
setPaperId
]
=
useState
(
''
);
const
[
paperId
,
setPaperId
]
=
useState
(
''
);
const
[
passRate
,
setPassRate
]
=
useState
(
60
);
//及格线
const
[
passRate
,
setPassRate
]
=
useState
(
60
);
//及格线
const
[
examStartTime
,
setStartTime
]
=
useState
(
''
);
const
[
examStartTime
,
setStartTime
]
=
useState
(
''
);
const
[
examEndTime
,
setExamEndTime
]
=
useState
(
''
);
const
[
examEndTime
,
setExamEndTime
]
=
useState
(
''
);
const
[
examName
,
setExamName
]
=
useState
(
''
);
const
[
examName
,
setExamName
]
=
useState
(
''
);
const
[
needPhone
,
setNeedPhone
]
=
useState
(
'DO_NOT_NEED_PHONE_VERIFY'
);
const
[
needPhone
,
setNeedPhone
]
=
useState
(
'DO_NOT_NEED_PHONE_VERIFY'
);
const
[
needOptionDisorder
,
setNeedOptionDisorder
]
=
useState
(
'OPTION_SORT'
);
const
[
needOptionDisorder
,
setNeedOptionDisorder
]
=
useState
(
'OPTION_SORT'
);
const
[
resultContent
,
setResultContent
]
=
useState
(
'PASS_AND_SCORE'
);
const
[
resultContent
,
setResultContent
]
=
useState
(
'PASS_AND_SCORE'
);
const
[
answerAnalysis
,
setAnswerAnalysis
]
=
useState
(
'RIGHT_OR_WRONG'
);
const
[
answerAnalysis
,
setAnswerAnalysis
]
=
useState
(
'RIGHT_OR_WRONG'
);
const
[
resultShow
,
setResultShow
]
=
useState
(
'IMMEDIATELY'
);
const
[
resultShow
,
setResultShow
]
=
useState
(
'IMMEDIATELY'
);
const
[
examDesc
,
setExamDesc
]
=
useState
(
''
);
const
[
examDesc
,
setExamDesc
]
=
useState
(
''
);
const
[
passScore
,
setPassScore
]
=
useState
(
100
);
const
[
passScore
,
setPassScore
]
=
useState
(
100
);
const
[
desclen
,
setDescLen
]
=
useState
(
0
);
const
[
desclen
,
setDescLen
]
=
useState
(
0
);
const
[
check
,
setCheck
]
=
useState
(
false
);
const
[
check
,
setCheck
]
=
useState
(
false
);
const
[
getData
,
setGetData
]
=
useState
(
false
);
const
[
getData
,
setGetData
]
=
useState
(
false
);
const
[
preview
,
setPreview
]
=
useState
(
false
);
const
[
preview
,
setPreview
]
=
useState
(
false
);
const
[
examTotal
,
setExamTotal
]
=
useState
(
0
);
const
[
examTotal
,
setExamTotal
]
=
useState
(
0
);
const
request
=
useRef
(
false
);
const
[
examList
,
setExamList
]
=
useState
([]);
const
{
match
}
=
props
;
const
request
=
useRef
(
false
);
const
{
match
}
=
props
;
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
useEffect
(()
=>
{
switch
(
props
.
type
)
{
useEffect
(()
=>
{
case
'copy'
:
// 考试列表-复制考试进入
queryExamList
();
case
'edit'
:
// 考试列表-编辑考试进入
switch
(
props
.
type
)
{
queryExamDetail
();
case
"copy"
:
// 考试列表-复制考试进入
break
;
case
"edit"
:
// 考试列表-编辑考试进入
case
'organizeExam'
:
// 试卷列表-组织考试进入
queryExamDetail
();
case
'newPaperToAddExam'
:
// 组卷页面-新建保存试卷并组织考试
break
;
case
'editPaperToAddExam'
:
// 组卷页面-编辑保存试卷并组织考试
case
"organizeExam"
:
// 试卷列表-组织考试进入
setGetData
(
true
);
case
"newPaperToAddExam"
:
// 组卷页面-新建保存试卷并组织考试
setPaperInfo
(
props
.
paperInfo
);
case
"editPaperToAddExam"
:
// 组卷页面-编辑保存试卷并组织考试
break
;
setGetData
(
true
);
}
setPaperInfo
(
props
.
paperInfo
);
},
[]);
setExamName
(
props
.
paperInfo
?.
paperName
)
break
;
useEffect
(()
=>
{
}
setPaperId
(
paperInfo
.
paperId
);
},
[])
setPassRate
(
paperInfo
.
passRate
);
},
[
paperInfo
.
paperId
]);
useEffect
(()
=>
{
setPaperId
(
paperInfo
.
paperId
)
useEffect
(()
=>
{
setPassRate
(
paperInfo
.
passRate
)
setPassScore
(
Math
.
round
((((
paperInfo
.
totalScore
||
0
)
*
(
passRate
||
0
))
as
any
)
/
100
));
setExamTotal
(
paperInfo
.
singleChoiceCnt
+
paperInfo
.
multiChoiceCnt
+
paperInfo
.
judgeCnt
+
paperInfo
.
gapFillingCnt
+
paperInfo
.
indefiniteChoiceCnt
||
0
);
},
[
paperInfo
.
paperId
])
},
[
paperInfo
.
paperId
,
passRate
]);
useEffect
(()
=>
{
function
disabledDate
(
current
:
any
)
{
setPassScore
(
Math
.
round
((
paperInfo
.
totalScore
||
0
)
*
(
passRate
||
0
)
as
any
/
100
))
// Can not select days before today and today
setExamTotal
(
paperInfo
.
singleChoiceCnt
+
paperInfo
.
multiChoiceCnt
+
paperInfo
.
judgeCnt
+
paperInfo
.
gapFillingCnt
+
paperInfo
.
indefiniteChoiceCnt
||
0
)
return
current
&&
current
<
moment
().
startOf
(
'day'
);
},
[
paperInfo
.
paperId
,
passRate
])
}
function
disabledDate
(
current
:
any
)
{
function
queryExamDetail
()
{
// Can not select days before today and today
Service
.
Hades
(
'public/hades/queryExamDetail'
,
{
return
current
&&
current
<
moment
().
startOf
(
'day'
);
examId
:
match
.
params
.
id
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
,
}).
then
((
res
)
=>
{
const
{
result
}
=
res
;
setPaperInfo
(
result
.
examPaper
);
setPaperId
(
result
.
examPaper
.
paperId
);
setStartTime
(
props
.
type
===
'edit'
?
result
.
examStartTime
:
''
);
setExamEndTime
(
props
.
type
===
'edit'
?
result
.
examEndTime
:
''
);
setExamName
(
props
.
type
===
'edit'
?
result
.
examName
:
`
${
result
.
examName
}
(复制)`
);
setPassRate
(
result
.
passRate
*
100
);
setNeedPhone
(
result
.
needPhone
);
setExamDesc
(
result
.
examDesc
);
setExamDuration
((
result
.
examDuration
/
60
/
1000
)
as
any
);
setAnswerAnalysis
(
result
.
answerAnalysis
);
setNeedOptionDisorder
(
result
.
needOptionDisorder
);
setPassScore
(
result
.
passScore
);
setResultContent
(
result
.
resultContent
);
setResultShow
(
result
.
resultShow
);
setGetData
(
true
);
});
}
function
handleSave
()
{
if
(
request
.
current
)
{
return
;
}
setCheck
(
true
);
const
param
=
{
paperId
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
examName
,
passRate
:
passRate
/
100
,
examStartTime
,
examEndTime
,
examDesc
,
needPhone
,
needOptionDisorder
,
resultContent
,
answerAnalysis
,
resultShow
,
examDuration
:
(
examDuration
||
0
)
*
60
*
1000
,
passScore
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
,
examId
:
''
,
};
if
(
!
param
.
examName
)
{
message
.
warning
(
'请输入考试名称'
);
return
;
}
if
(
param
.
examName
&&
param
.
examName
.
length
>
40
)
{
message
.
warning
(
'考试名称最多40字'
);
return
;
}
}
if
(
!
paperId
)
{
function
queryExamList
()
{
message
.
warning
(
'请选择试卷'
);
let
param
=
{
return
;
current
:
1
,
size
:
9999
,
order
:
'EXAM_START_TIME_DESC'
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
source
:
0
,
}
Service
.
Hades
(
'public/hades/queryExamPageList'
,
param
).
then
(
res
=>
{
console
.
log
(
res
)
const
{
result
=
{}
}
=
res
;
setExamList
(
result
.
records
)
})
}
}
if
(
!
passRate
)
{
function
queryExamDetail
()
{
message
.
warning
(
'请输入及格线'
);
Service
.
Hades
(
"public/hades/queryExamDetail"
,
{
return
;
examId
:
match
.
params
.
id
,
tenantId
:
User
.
getStoreId
(),
userId
:
User
.
getStoreUserId
(),
source
:
0
}).
then
((
res
)
=>
{
const
{
result
}
=
res
setPaperInfo
(
result
.
examPaper
)
setPaperId
(
result
.
examPaper
.
paperId
)
setStartTime
(
props
.
type
===
'edit'
?
result
.
examStartTime
:
''
)
setExamEndTime
(
props
.
type
===
'edit'
?
result
.
examEndTime
:
''
)
setExamName
(
props
.
type
===
'edit'
?
result
.
examName
:
`
${
result
.
examName
}
(复制)`
)
setPassRate
(
result
.
passRate
*
100
)
setNeedPhone
(
result
.
needPhone
)
setExamDesc
(
result
.
examDesc
)
setExamDuration
(
result
.
examDuration
/
60
/
1000
as
any
)
setAnswerAnalysis
(
result
.
answerAnalysis
)
setNeedOptionDisorder
(
result
.
needOptionDisorder
)
setPassScore
(
result
.
passScore
)
setResultContent
(
result
.
resultContent
)
setResultShow
(
result
.
resultShow
)
setGetData
(
true
)
})
}
}
if
(
!
examStartTime
||
!
examEndTime
)
{
function
handleSave
()
{
message
.
warning
(
'请选择考试起止时间'
);
if
(
request
.
current
)
{
return
;
return
}
}
if
(
Number
(
examStartTime
)
<
moment
().
valueOf
())
{
message
.
warning
(
'开始时间不能早于现在'
);
return
;
}
if
(
!
examDuration
)
{
message
.
warning
(
'请输入考试时长'
);
return
;
}
if
(
examStartTime
+
(
examDuration
as
any
)
*
60
*
1000
>
examEndTime
)
{
message
.
warning
(
'考试时长不得超过考试有效期时长'
);
return
;
}
if
(
desclen
>
1000
)
{
setCheck
(
true
);
message
.
warning
(
'内容过长,不能超过1000字'
);
const
param
=
{
return
;
}
request
.
current
=
true
;
setTimeout
(()
=>
{
request
.
current
=
false
;
},
2000
);
if
(
props
.
type
===
'edit'
)
{
param
.
examId
=
match
.
params
.
id
;
}
Service
.
Hades
(
props
.
type
===
'edit'
?
'public/hades/editExam'
:
'public/hades/createExam'
,
param
).
then
((
res
)
=>
{
message
.
success
(
props
.
type
===
'edit'
?
'编辑成功'
:
'创建成功'
);
switch
(
props
.
type
)
{
case
'organizeExam'
:
// 试卷列表-组织考试进入
case
'newPaperToAddExam'
:
// 组卷保存组织考试
case
'editPaperToAddExam'
:
window
.
RCHistory
.
push
(
'/examination-manage-index'
);
break
;
case
'add'
:
case
'edit'
:
// 考试列表-新建或编辑
case
'copy'
:
// 考试列表-新建或编辑
props
.
freshList
();
props
.
history
.
goBack
();
break
;
}
});
}
function
disabledRangeTime
(
date
:
any
,
type
:
any
)
{
if
(
moment
(
date
).
isSame
(
moment
(),
'day'
))
{
return
{
disabledHours
:
()
=>
{
const
hours
=
[];
for
(
let
i
=
0
;
i
<
moment
().
hour
();
i
++
)
{
hours
.
push
(
i
);
}
return
hours
;
},
disabledMinutes
:
()
=>
{
const
currentMinute
=
moment
().
minute
();
const
currentHour
=
moment
(
date
).
hour
();
const
minutes
=
[];
if
(
currentHour
===
moment
().
hour
())
{
for
(
let
i
=
0
;
i
<
currentMinute
;
i
++
)
{
minutes
.
push
(
i
);
}
}
return
minutes
;
},
};
}
return
{
disabledHours
:
()
=>
[],
disabledMinutes
:
()
=>
[],
disabledSeconds
:
()
=>
[],
};
}
function
handleGoBack
()
{
Modal
.
confirm
({
title
:
'确定要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
(
'/examination-manage-index'
);
},
});
}
let
title
=
''
;
switch
(
props
.
type
)
{
case
'add'
:
case
'organizeExam'
:
case
'newPaperToAddExam'
:
case
'editPaperToAddExam'
:
title
=
'新建考试'
;
break
;
case
'edit'
:
title
=
'编辑考试'
;
break
;
case
'copy'
:
title
=
'复制考试'
;
break
;
default
:
break
;
}
return
(
<
div
className=
'page examPage'
>
<
Breadcrumbs
navList=
{
title
}
goBack=
{
handleGoBack
}
/>
<
div
className=
'box'
>
<
div
className=
'show-tips'
>
<
ShowTips
message=
'请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利'
/>
</
div
>
{
' '
}
<
div
className=
'form'
>
<
div
className=
'title'
>
基本信息
</
div
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
14
}
}
layout=
'horizontal'
>
<
Form
.
Item
label=
'考试名称'
validateStatus=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
examName
.
length
>
40
&&
'考试名称最多40字'
)
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
examName
.
length
>
40
&&
'考试名称最多40字'
)
}
required
>
<
Input
placeholder=
'请输入考试名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
setExamName
(
e
.
target
.
value
);
}
}
style=
{
{
width
:
320
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'选择试卷'
validateStatus=
{
check
&&
!
paperId
?
'error'
:
''
}
help=
{
check
&&
!
paperId
&&
'请选择试卷'
}
required
>
<
Button
onClick=
{
()
=>
{
setShowModal
(
true
);
}
}
>
{
paperInfo
.
paperId
?
'重新选择'
:
'选择试卷'
}
</
Button
>
{
paperInfo
.
paperId
&&
(
<
div
className=
'paperTitle'
>
<
img
src=
'https://image.xiaomaiketang.com/xm/pY5imEhjzw.png'
alt=
''
/>
{
paperInfo
.
paperName
}
</
div
>
)
}
{
paperInfo
.
paperId
&&
(
<
div
className=
'table'
>
<
div
className=
'header'
>
<
div
className=
'item'
>
单选题
</
div
>
<
div
className=
'item'
>
多选题
</
div
>
<
div
className=
'item'
>
判断题
</
div
>
<
div
className=
'item'
>
填空题
</
div
>
<
div
className=
'item long'
>
不定项选择题
</
div
>
<
div
className=
'item'
>
合计
</
div
>
</
div
>
<
div
className=
'body-list'
>
<
div
className=
'item'
>
{
paperInfo
.
singleChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
multiChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
judgeCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
gapFillingCnt
||
0
}
题
</
div
>
<
div
className=
'item long'
>
{
paperInfo
.
indefiniteChoiceCnt
||
0
}
题
</
div
>
<
div
className=
'item'
>
{
examTotal
}
题
</
div
>
</
div
>
<
div
className=
'body-list'
>
<
div
className=
'item'
>
{
paperInfo
.
singleChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
multiChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
judgeScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
gapFillingScore
||
0
}
分
</
div
>
<
div
className=
'item long'
>
{
paperInfo
.
indefiniteChoiceScore
||
0
}
分
</
div
>
<
div
className=
'item'
>
{
paperInfo
.
totalScore
||
0
}
分
</
div
>
</
div
>
</
div
>
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
{
<
div
>
<
span
>
及格线
</
span
>
<
Tooltip
title=
'默认为选中试卷所设置的及格线,可修改'
>
<
span
className=
'icon iconfont'
style=
{
{
color
:
'#BFBFBF'
,
marginLeft
:
4
}
}
>

</
span
>
</
Tooltip
>
</
div
>
}
style=
{
{
marginTop
:
24
}
}
validateStatus=
{
check
&&
!
passRate
?
'error'
:
''
}
help=
{
check
&&
!
passRate
&&
'请输入及格线'
}
required
>
<
InputNumber
value=
{
passRate
}
min=
{
0
}
max=
{
100
}
onChange=
{
(
value
:
any
)
=>
{
setPassRate
(
parseInt
(
value
));
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
%
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
'#999'
}
}
>
{
` 总分(${paperInfo.totalScore || 0})*及格线(${passRate || 0}%)=及格分数(${passScore})`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试有效期'
validateStatus=
{
check
&&
!
examStartTime
?
'error'
:
''
}
help=
{
check
&&
!
examStartTime
&&
'请选择考试起止时间'
}
required
>
<
RangePicker
style=
{
{
width
:
320
}
}
showTime=
{
{
defaultValue
:
[
moment
().
add
(
5
,
'minutes'
),
moment
().
add
(
5
,
'minutes'
)]
}
}
ranges=
{
{
近七天
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
6
,
'day'
).
endOf
(
'day'
)],
近
1
个月
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
1
,
'month'
).
endOf
(
'day'
)],
近
3
个月
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
3
,
'month'
).
endOf
(
'day'
)],
}
}
disabledDate=
{
disabledDate
}
value=
{
[
examStartTime
?
moment
(
Number
(
examStartTime
))
:
null
,
examEndTime
?
moment
(
Number
(
examEndTime
))
:
null
]
}
disabledTime=
{
disabledRangeTime
}
format=
'YYYY/MM/DD HH:mm'
onChange=
{
(
date
:
any
)
=>
{
setStartTime
(
date
&&
date
[
0
]?.
valueOf
());
setExamEndTime
(
date
&&
date
[
1
]?.
valueOf
());
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试时长'
validateStatus=
{
check
&&
!
examDuration
?
'error'
:
''
}
help=
{
check
&&
!
examDuration
&&
'请输入考试时长'
}
required
>
<
InputNumber
value=
{
examDuration
}
max=
{
1440
}
min=
{
1
}
onChange=
{
(
value
:
any
)
=>
{
setExamDuration
(
parseInt
(
value
)
as
any
);
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
分钟
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
'#999'
}
}
>
{
` 时长不能超过1440分钟(24小时)`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试说明'
validateStatus=
{
check
&&
desclen
>
1000
?
'error'
:
''
}
help=
{
check
&&
desclen
>
1000
&&
'最多只能输入1000个字'
}
>
{
(
getData
||
props
.
type
===
'add'
)
&&
(
<
GraphicsEditor
maxLimit=
{
1000
}
isIntro=
{
true
}
detail=
{
{
content
:
examDesc
,
}
}
onChange=
{
(
val
:
any
,
len
:
any
)
=>
{
setExamDesc
(
val
);
setDescLen
(
len
);
}
}
/>
)
}
</
Form
.
Item
>
<
div
className=
'title'
style=
{
{
marginTop
:
40
}
}
>
考试设置
</
div
>
<
Form
.
Item
label=
'身份验证'
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
}
}
>
<
Switch
checked=
{
needPhone
==
'NEED_PHONE_VERIFY'
}
onChange=
{
(
val
)
=>
{
setNeedPhone
(
val
?
'NEED_PHONE_VERIFY'
:
'DO_NOT_NEED_PHONE_VERIFY'
);
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
left
:
8
,
color
:
'#999'
}
}
>
{
needPhone
==
'NEED_PHONE_VERIFY'
?
'已开启,学员需绑定手机号才可参与考试'
:
'已关闭,学员无需绑定手机号即可参与考试'
}
</
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
'选项乱序'
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
}
}
>
<
Switch
checked=
{
needOptionDisorder
==
'OPTION_RANDOM'
}
onChange=
{
(
val
)
=>
{
setNeedOptionDisorder
(
val
?
'OPTION_RANDOM'
:
'OPTION_SORT'
);
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
left
:
8
,
color
:
'#999'
}
}
>
{
needOptionDisorder
==
'OPTION_RANDOM'
?
'已开启,选项随机排序'
:
'已关闭,选项按设置顺序排序'
}
</
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
'考试结果查看'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultShow
(
e
.
target
.
value
);
}
}
value=
{
resultShow
}
>
<
Radio
value=
{
'IMMEDIATELY'
}
>
交卷后立即显示考试结果
</
Radio
>
<
Radio
value=
{
'AFTER_EXAM_END'
}
>
到达考试截止日期才显示结果
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
' 考试结果内容'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultContent
(
e
.
target
.
value
);
}
}
value=
{
resultContent
}
>
<
Radio
value=
{
'PASS_AND_SCORE'
}
>
显示考试分数和是否及格
</
Radio
>
<
Radio
value=
{
'ONLY_SCORE'
}
>
仅显示考试分数
</
Radio
>
<
Radio
value=
{
'ONLY_PASS'
}
>
仅显示是否及格
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
'答案与解析'
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setAnswerAnalysis
(
e
.
target
.
value
);
}
}
value=
{
answerAnalysis
}
>
<
Radio
value=
{
'ANALYSE_AND_RIGHT_OR_WRONG'
}
>
显示对错与解析
</
Radio
>
<
Radio
value=
{
'RIGHT_OR_WRONG'
}
>
仅显示对错
</
Radio
>
<
Radio
value=
{
'CAN_NOT_CHECK'
}
>
都不显示
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
{
showModal
&&
(
<
SelectPaperModal
onSelect=
{
(
info
:
any
)
=>
{
setPaperInfo
(
info
);
}
}
paperInfo=
{
paperInfo
}
close=
{
()
=>
{
setShowModal
(
false
);
}
}
></
SelectPaperModal
>
)
}
<
div
className=
'footer shrink-footer'
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
{
setPreview
(
true
);
}
}
>
预览
</
Button
>
<
Button
type=
'primary'
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
{
preview
&&
(
<
PreviewModal
info=
{
{
paperId
,
paperId
,
startTime
:
examStartTime
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
endTime
:
examEndTime
,
...
@@ -514,17 +138,409 @@ function AddExam(props: any) {
...
@@ -514,17 +138,409 @@ function AddExam(props: any) {
resultContent
,
resultContent
,
answerAnalysis
,
answerAnalysis
,
resultShow
,
resultShow
,
examDuration
,
examDuration
:
(
examDuration
||
0
)
*
60
*
1000
,
passScore
,
passScore
,
examTotal
,
tenantId
:
User
.
getStoreId
(),
totalScore
:
paperInfo
.
totalScore
,
userId
:
User
.
getStoreUserId
(),
}
}
source
:
0
,
onClose=
{
()
=>
{
examId
:
''
setPreview
(
false
);
}
}
}
></
PreviewModal
>
)
}
if
(
!
param
.
examName
)
{
message
.
warning
(
'请输入考试名称'
);
return
}
if
(
param
.
examName
&&
param
.
examName
.
length
>
40
)
{
message
.
warning
(
'考试名称最多40字'
);
return
}
if
(
checkExist
(
param
.
examName
))
{
message
.
warning
(
'此考试名称已存在'
);
return
}
if
(
!
paperId
)
{
message
.
warning
(
'请选择试卷'
);
return
}
if
(
!
passRate
)
{
message
.
warning
(
'请输入及格线'
);
return
}
if
(
!
examStartTime
||
!
examEndTime
)
{
message
.
warning
(
'请选择考试起止时间'
);
return
}
if
(
Number
(
examStartTime
)
<
moment
().
valueOf
())
{
message
.
warning
(
'开始时间不能早于现在'
);
return
}
if
(
!
examDuration
)
{
message
.
warning
(
'请输入考试时长'
);
return
}
if
(
examStartTime
+
(
examDuration
as
any
)
*
60
*
1000
>
examEndTime
)
{
message
.
warning
(
'考试时长不得超过考试有效期时长'
);
return
}
if
(
desclen
>
1000
)
{
message
.
warning
(
'内容过长,不能超过1000字'
);
return
}
request
.
current
=
true
;
setTimeout
(()
=>
{
request
.
current
=
false
},
2000
)
if
(
props
.
type
===
'edit'
)
{
param
.
examId
=
match
.
params
.
id
;
}
Service
.
Hades
(
props
.
type
===
'edit'
?
'public/hades/editExam'
:
"public/hades/createExam"
,
param
).
then
((
res
)
=>
{
message
.
success
(
props
.
type
===
'edit'
?
'编辑成功'
:
'创建成功'
);
switch
(
props
.
type
)
{
case
"organizeExam"
:
// 试卷列表-组织考试进入
case
"newPaperToAddExam"
:
// 组卷保存组织考试
case
"editPaperToAddExam"
:
window
.
RCHistory
.
push
(
"/examination-manage-index"
)
break
;
case
"add"
:
case
"edit"
:
// 考试列表-新建或编辑
case
"copy"
:
// 考试列表-新建或编辑
props
.
freshList
()
props
.
history
.
goBack
();
break
;
}
})
}
function
disabledRangeTime
(
date
:
any
,
type
:
any
)
{
if
(
moment
(
date
).
isSame
(
moment
(),
'day'
))
{
return
{
disabledHours
:
()
=>
{
const
hours
=
[];
for
(
let
i
=
0
;
i
<
moment
().
hour
();
i
++
)
{
hours
.
push
(
i
);
}
return
hours
;
},
disabledMinutes
:
()
=>
{
const
currentMinute
=
moment
().
minute
();
const
currentHour
=
moment
(
date
).
hour
();
const
minutes
=
[];
if
(
currentHour
===
moment
().
hour
())
{
for
(
let
i
=
0
;
i
<
currentMinute
;
i
++
)
{
minutes
.
push
(
i
);
}
}
return
minutes
;
},
};
}
return
{
disabledHours
:
()
=>
[],
disabledMinutes
:
()
=>
[],
disabledSeconds
:
()
=>
[],
};
}
function
handleGoBack
()
{
Modal
.
confirm
({
title
:
'确定要返回吗?'
,
content
:
'返回后,本次编辑的内容将不被保存'
,
okText
:
'确认返回'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
(
"/examination-manage-index"
)
}
})
}
// 校验考试名称是否存在
function
checkExist
(
examName
:
any
)
{
var
result
:
any
=
null
;
examList
.
forEach
((
item
:
any
)
=>
{
if
(
result
!=
null
)
{
return
result
;
}
if
(
props
.
type
===
'edit'
)
{
if
(
item
.
examName
===
examName
&&
item
.
examId
!==
match
.
params
.
id
)
{
result
=
item
;
}
}
else
{
if
(
item
.
examName
===
examName
)
{
result
=
item
;
}
}
});
return
result
;
};
let
title
=
''
;
switch
(
props
.
type
)
{
case
'add'
:
case
"organizeExam"
:
case
"newPaperToAddExam"
:
case
"editPaperToAddExam"
:
title
=
'新建考试'
;
break
;
case
'edit'
:
title
=
'编辑考试'
;
break
;
case
'copy'
:
title
=
'复制考试'
;
break
;
default
:
break
;
}
return
<
div
className=
"page examPage"
>
<
Breadcrumbs
navList=
{
title
}
goBack=
{
handleGoBack
}
/>
<
div
className=
"box"
>
<
div
className=
"show-tips"
>
<
ShowTips
message=
"请遵守国家相关规定,切勿上传低俗色情、暴力恐怖、谣言诈骗、侵权盗版等相关内容,小麦企学院保有依据国家规定及平台规则进行处理的权利"
/>
</
div
>
<
div
className=
"form"
>
<
div
className=
"title"
>
基本信息
</
div
>
<
Form
labelCol=
{
{
span
:
3
}
}
wrapperCol=
{
{
span
:
14
}
}
layout=
"horizontal"
>
<
Form
.
Item
label=
"考试名称"
validateStatus=
{
(
check
&&
(
!
examName
||
(
examName
.
length
>
40
||
checkExist
(
examName
))
))
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
(
examName
.
length
>
40
?
'考试名称最多40字'
:
(
checkExist
(
examName
)
&&
'此考试名称已存在'
)))
}
required
>
<
Input
placeholder=
'请输入考试名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
setExamName
(
e
.
target
.
value
)
}
}
style=
{
{
width
:
320
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"选择试卷"
validateStatus=
{
(
check
&&
!
paperId
)
?
'error'
:
''
}
help=
{
check
&&
!
paperId
&&
'请选择试卷'
}
required
>
<
Button
onClick=
{
()
=>
{
setShowModal
(
true
)
}
}
>
{
paperInfo
.
paperId
?
'重新选择'
:
'选择试卷'
}
</
Button
>
{
paperInfo
.
paperId
&&
<
div
className=
"paperTitle"
><
img
src=
"https://image.xiaomaiketang.com/xm/pY5imEhjzw.png"
alt=
""
/>
{
paperInfo
.
paperName
}
</
div
>
}
{
paperInfo
.
paperId
&&
<
div
className=
"table"
>
<
div
className=
"header"
>
<
div
className=
"item"
>
单选题
</
div
>
<
div
className=
"item"
>
多选题
</
div
>
<
div
className=
"item"
>
判断题
</
div
>
<
div
className=
"item"
>
填空题
</
div
>
<
div
className=
"item long"
>
不定项选择题
</
div
>
<
div
className=
"item"
>
合计
</
div
>
</
div
>
<
div
className=
"body-list"
>
<
div
className=
"item"
>
{
paperInfo
.
singleChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
multiChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
judgeCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
gapFillingCnt
||
0
}
题
</
div
>
<
div
className=
"item long"
>
{
paperInfo
.
indefiniteChoiceCnt
||
0
}
题
</
div
>
<
div
className=
"item"
>
{
examTotal
}
题
</
div
>
</
div
>
<
div
className=
"body-list"
>
<
div
className=
"item"
>
{
paperInfo
.
singleChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
multiChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
judgeScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
gapFillingScore
||
0
}
分
</
div
>
<
div
className=
"item long"
>
{
paperInfo
.
indefiniteChoiceScore
||
0
}
分
</
div
>
<
div
className=
"item"
>
{
paperInfo
.
totalScore
||
0
}
分
</
div
>
</
div
>
</
div
>
}
</
Form
.
Item
>
<
Form
.
Item
label=
{
<
div
>
<
span
>
及格线
</
span
>
<
Tooltip
title=
"默认为选中试卷所设置的及格线,可修改"
>
<
span
className=
"icon iconfont"
style=
{
{
color
:
'#BFBFBF'
,
marginLeft
:
4
}
}
>

</
span
>
</
Tooltip
>
</
div
>
}
style=
{
{
marginTop
:
24
}
}
validateStatus=
{
(
check
&&
!
passRate
)
?
'error'
:
''
}
help=
{
check
&&
!
passRate
&&
'请输入及格线'
}
required
>
<
InputNumber
value=
{
passRate
}
min=
{
0
}
max=
{
100
}
onChange=
{
(
value
:
any
)
=>
{
setPassRate
(
parseInt
(
value
))
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
%
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
"#999"
}
}
>
{
` 总分(${paperInfo.totalScore || 0})*及格线(${passRate || 0}%)=及格分数(${passScore})`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试有效期"
validateStatus=
{
(
check
&&
!
examStartTime
)
?
'error'
:
''
}
help=
{
check
&&
!
examStartTime
&&
'请选择考试起止时间'
}
required
>
<
RangePicker
style=
{
{
width
:
320
}
}
showTime=
{
{
defaultValue
:
[
moment
().
add
(
5
,
'minutes'
),
moment
().
add
(
5
,
'minutes'
)]
}
}
ranges=
{
{
'近七天'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
6
,
'day'
).
endOf
(
'day'
)],
'近1个月'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
1
,
'month'
).
endOf
(
'day'
)],
'近3个月'
:
[
moment
().
add
(
5
,
'minute'
),
moment
().
add
(
3
,
'month'
).
endOf
(
'day'
)],
}
}
disabledDate=
{
disabledDate
}
value=
{
[
examStartTime
?
moment
(
Number
(
examStartTime
))
:
null
,
examEndTime
?
moment
(
Number
(
examEndTime
))
:
null
]
}
disabledTime=
{
disabledRangeTime
}
format=
"YYYY/MM/DD HH:mm"
onChange=
{
(
date
:
any
)
=>
{
setStartTime
(
date
&&
date
[
0
]?.
valueOf
());
setExamEndTime
(
date
&&
date
[
1
]?.
valueOf
());
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试时长"
validateStatus=
{
(
check
&&
!
examDuration
)
?
'error'
:
''
}
help=
{
check
&&
!
examDuration
&&
'请输入考试时长'
}
required
>
<
InputNumber
value=
{
examDuration
}
max=
{
1440
}
min=
{
1
}
onChange=
{
(
value
:
any
)
=>
{
setExamDuration
(
parseInt
(
value
)
as
any
)
}
}
style=
{
{
width
:
100
}
}
/>
<
span
style=
{
{
marginLeft
:
4
}
}
>
分钟
</
span
>
<
span
style=
{
{
marginLeft
:
16
,
color
:
"#999"
}
}
>
{
` 时长不能超过1440分钟(24小时)`
}
</
span
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试说明"
validateStatus=
{
(
check
&&
(
desclen
>
1000
))
?
'error'
:
''
}
help=
{
check
&&
(
desclen
>
1000
)
&&
'最多只能输入1000个字'
}
>
{
(
getData
||
(
props
.
type
===
'add'
))
&&
<
GraphicsEditor
maxLimit=
{
1000
}
isIntro=
{
true
}
detail=
{
{
content
:
examDesc
}
}
onChange=
{
(
val
:
any
,
len
:
any
)
=>
{
setExamDesc
(
val
);
setDescLen
(
len
)
}
}
/>
}
</
Form
.
Item
>
<
div
className=
"title"
style=
{
{
marginTop
:
40
}
}
>
考试设置
</
div
>
<
Form
.
Item
label=
"身份验证"
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
,
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needPhone
==
'NEED_PHONE_VERIFY'
}
onChange=
{
(
val
)
=>
{
setNeedPhone
(
val
?
'NEED_PHONE_VERIFY'
:
'DO_NOT_NEED_PHONE_VERIFY'
)
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
"#999"
}
}
><
p
>
开启:需要绑定手机号的学员才能参加考试
</
p
>
<
p
>
关闭:微信/企业微信登陆直接参加考试
</
p
></
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
"选项乱序"
required
>
<
div
style=
{
{
display
:
'flex'
,
marginLeft
:
4
,
}
}
>
<
Switch
style=
{
{
position
:
'relative'
,
top
:
6
}
}
checked=
{
needOptionDisorder
==
'OPTION_RANDOM'
}
onChange=
{
(
val
)
=>
{
setNeedOptionDisorder
(
val
?
'OPTION_RANDOM'
:
'OPTION_SORT'
)
}
}
></
Switch
>
<
div
style=
{
{
position
:
'relative'
,
top
:
3
,
left
:
8
,
color
:
"#999"
}
}
><
p
>
开启:选择题的选项随机排序
</
p
>
<
p
>
关闭:选择题按题目原有顺序展示
</
p
></
div
>
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
"考试结果查看"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultShow
(
e
.
target
.
value
)
}
}
value=
{
resultShow
}
>
<
Radio
value=
{
'IMMEDIATELY'
}
>
交卷后立即显示考试结果
</
Radio
>
<
Radio
value=
{
'AFTER_EXAM_END'
}
>
到达考试截止日期才显示结果
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
" 考试结果内容"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setResultContent
(
e
.
target
.
value
)
}
}
value=
{
resultContent
}
>
<
Radio
value=
{
'PASS_AND_SCORE'
}
>
显示考试分数和是否及格
</
Radio
>
<
Radio
value=
{
'ONLY_SCORE'
}
>
仅显示考试分数
</
Radio
>
<
Radio
value=
{
'ONLY_PASS'
}
>
仅显示是否及格
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"答案与解析"
required
>
<
Radio
.
Group
onChange=
{
(
e
:
any
)
=>
{
setAnswerAnalysis
(
e
.
target
.
value
)
}
}
value=
{
answerAnalysis
}
>
<
Radio
value=
{
'ANALYSE_AND_RIGHT_OR_WRONG'
}
>
显示对错与解析
</
Radio
>
<
Radio
value=
{
'RIGHT_OR_WRONG'
}
>
仅显示对错
</
Radio
>
<
Radio
value=
{
'CAN_NOT_CHECK'
}
>
都不显示
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
{
showModal
&&
<
SelectPaperModal
onSelect=
{
(
info
:
any
)
=>
{
setPaperInfo
(
info
)
}
}
paperInfo=
{
paperInfo
}
close=
{
()
=>
{
setShowModal
(
false
)
}
}
></
SelectPaperModal
>
}
<
div
className=
"footer shrink-footer"
>
<
Button
onClick=
{
handleGoBack
}
>
取消
</
Button
>
<
Button
onClick=
{
()
=>
{
setPreview
(
true
)
}
}
>
预览
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleSave
}
>
保存
</
Button
>
</
div
>
{
preview
&&
<
PreviewModal
info=
{
{
paperId
,
startTime
:
examStartTime
,
endTime
:
examEndTime
,
examName
,
passRate
:
passRate
/
100
,
examStartTime
,
examEndTime
,
examDesc
,
needPhone
,
needOptionDisorder
,
resultContent
,
answerAnalysis
,
resultShow
,
examDuration
,
passScore
,
examTotal
,
totalScore
:
paperInfo
.
totalScore
}
}
onClose=
{
()
=>
{
setPreview
(
false
)
}
}
></
PreviewModal
>
}
</
div
>
</
div
>
);
}
}
export
default
withRouter
(
AddExam
);
export
default
withRouter
(
AddExam
);
\ No newline at end of file
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
0e51ade3
/*
/*
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @Date: 2021-03-27 16:15:13
* @LastEditors:
fusanqias
ng
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-07-
01 16:30:38
* @LastEditTime: 2021-07-
13 12:01:37
* @Description: 助学工具-新建/复制/编辑试卷
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -118,7 +118,7 @@ class OperatePaper extends Component {
...
@@ -118,7 +118,7 @@ class OperatePaper extends Component {
portionScore
:
0
,
portionScore
:
0
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
]
]
,
};
};
}
}
...
@@ -352,20 +352,6 @@ class OperatePaper extends Component {
...
@@ -352,20 +352,6 @@ class OperatePaper extends Component {
return
result
;
return
result
;
};
};
validatePaperName
=
(
paperName
)
=>
{
if
(
this
.
state
.
check
&&
!
paperName
)
{
return
'请输入试卷名称'
;
}
if
(
this
.
checkExist
(
paperName
))
{
return
'该试卷名称已存在'
;
}
if
(
paperName
&&
paperName
.
length
>
40
)
{
return
'试卷名称最多40字'
;
}
};
// 保存试卷
// 保存试卷
savePaper
=
(
saveType
)
=>
{
savePaper
=
(
saveType
)
=>
{
this
.
setState
({
check
:
true
});
this
.
setState
({
check
:
true
});
...
@@ -373,8 +359,17 @@ class OperatePaper extends Component {
...
@@ -373,8 +359,17 @@ class OperatePaper extends Component {
const
categoryId
=
getParameterByName
(
'categoryId'
);
const
categoryId
=
getParameterByName
(
'categoryId'
);
const
{
match
}
=
this
.
props
;
const
{
match
}
=
this
.
props
;
let
questionList
=
[];
let
questionList
=
[];
if
(
!
formData
.
passRate
||
!
formData
.
paperName
||
this
.
checkExist
(
formData
.
paperName
)
||
(
formData
.
paperName
&&
formData
.
paperName
.
length
>
40
))
{
if
(
!
formData
.
paperName
)
{
return
;
return
message
.
warning
(
'请输入试卷名称'
)
}
if
(
formData
.
paperName
.
length
>
40
)
{
return
message
.
warning
(
'试卷名称最多40字'
)
}
if
(
this
.
checkExist
(
formData
.
paperName
))
{
return
message
.
warning
(
'该试卷名称已存在'
)
}
if
(
!
formData
.
passRate
)
{
return
message
.
warning
(
'请输入及格线'
)
}
}
if
(
selectQuestionList
.
length
===
0
)
{
if
(
selectQuestionList
.
length
===
0
)
{
return
message
.
warning
(
'请选择题目'
);
return
message
.
warning
(
'请选择题目'
);
...
@@ -410,18 +405,14 @@ class OperatePaper extends Component {
...
@@ -410,18 +405,14 @@ class OperatePaper extends Component {
});
});
}
else
{
}
else
{
message
.
success
(
currentOperate
===
'new'
?
'新建成功'
:
'复制成功'
);
message
.
success
(
currentOperate
===
'new'
?
'新建成功'
:
'复制成功'
);
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
}
}
}
}
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
});
});
...
@@ -438,17 +429,13 @@ class OperatePaper extends Component {
...
@@ -438,17 +429,13 @@ class OperatePaper extends Component {
});
});
}
else
{
}
else
{
message
.
success
(
'编辑成功'
);
message
.
success
(
'编辑成功'
);
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
}
}
}
}
})
})
.
catch
((
e
)
=>
{
.
catch
((
e
)
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
});
});
}
}
...
@@ -482,9 +469,7 @@ class OperatePaper extends Component {
...
@@ -482,9 +469,7 @@ class OperatePaper extends Component {
cancelText
:
'留在本页'
,
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
()
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
'categoryId'
)}
`
,
});
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryPaperPageList'
,
getParameterByName
(
'categoryId'
),
0
);
Bus
.
trigger
(
'queryPaperPageList'
,
getParameterByName
(
'categoryId'
),
0
);
},
},
...
@@ -822,8 +807,8 @@ class OperatePaper extends Component {
...
@@ -822,8 +807,8 @@ class OperatePaper extends Component {
name=
'paperName'
name=
'paperName'
label=
'试卷名称:'
label=
'试卷名称:'
required
required
validateStatus=
{
this
.
validatePaperName
(
paperName
)
?
'error'
:
''
}
validateStatus=
{
(
check
&&
(
!
paperName
||
paperName
.
length
>
40
||
this
.
checkExist
(
paperName
))
)
?
'error'
:
''
}
help=
{
this
.
validatePaperName
(
paperName
)
}
>
help=
{
check
&&
(
!
paperName
?
'请输入试卷名称'
:
(
paperName
.
length
>
40
?
'试卷名称最多40字'
:
(
this
.
checkExist
(
paperName
)
&&
'该试卷名称已存在'
))
)
}
>
<
Input
<
Input
value=
{
paperName
}
value=
{
paperName
}
autoComplete=
'off'
autoComplete=
'off'
...
...
src/modules/teach-tool/paper-manage/components/PaperList.jsx
View file @
0e51ade3
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditors: yuananting
* @LastEditTime: 2021-0
6-03 17:13:30
* @LastEditTime: 2021-0
7-13 15:16:52
* @Description: 助学工具-题库-试卷列表数据
* @Description: 助学工具-题库-试卷列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -362,9 +362,9 @@ class PaperList extends Component {
...
@@ -362,9 +362,9 @@ class PaperList extends Component {
{
isPermiss
&&
(
{
isPermiss
&&
(
<
div
<
div
className=
"record-operate__item"
className=
"record-operate__item"
onClick=
{
()
=>
this
.
copyPaper
(
record
)
}
onClick=
{
()
=>
this
.
organizeExam
(
record
)
}
>
>
复制
组织考试
</
div
>
</
div
>
)
}
)
}
{
isPermiss
&&
(
{
isPermiss
&&
(
...
@@ -391,7 +391,7 @@ class PaperList extends Component {
...
@@ -391,7 +391,7 @@ class PaperList extends Component {
<
span
onClick=
{
()
=>
this
.
editPaper
(
item
)
}
>
编辑
</
span
>
<
span
onClick=
{
()
=>
this
.
editPaper
(
item
)
}
>
编辑
</
span
>
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"organizeExam"
>
<
Menu
.
Item
key=
"organizeExam"
>
<
span
onClick=
{
()
=>
this
.
organizeExam
(
item
)
}
>
组织考试
</
span
>
<
span
onClick=
{
()
=>
this
.
copyPaper
(
item
)
}
>
复制
</
span
>
</
Menu
.
Item
>
</
Menu
.
Item
>
<
Menu
.
Item
key=
"del"
>
<
Menu
.
Item
key=
"del"
>
<
span
onClick=
{
()
=>
this
.
confirmDeletePaper
(
item
)
}
>
删除
</
span
>
<
span
onClick=
{
()
=>
this
.
confirmDeletePaper
(
item
)
}
>
删除
</
span
>
...
...
src/modules/teach-tool/question-manage/OperateQuestion.jsx
View file @
0e51ade3
/*
/*
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-25 13:46:35
* @Date: 2021-02-25 13:46:35
* @LastEditors:
wufan
* @LastEditors:
yuananting
* @LastEditTime: 2021-0
5-24 11:32:47
* @LastEditTime: 2021-0
7-13 11:51:56
* @Description: 助学工具-题库-新建/编辑题目
* @Description: 助学工具-题库-新建/编辑题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -161,9 +161,7 @@ class OperateQuestion extends Component {
...
@@ -161,9 +161,7 @@ class OperateQuestion extends Component {
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
),
onOk
:
()
=>
{
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/question-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
});
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
"queryQuestionPageList"
,
getParameterByName
(
"categoryId"
));
Bus
.
trigger
(
"queryQuestionPageList"
,
getParameterByName
(
"categoryId"
));
},
},
...
@@ -248,9 +246,7 @@ class OperateQuestion extends Component {
...
@@ -248,9 +246,7 @@ class OperateQuestion extends Component {
this
.
handleRest
(
type
);
this
.
handleRest
(
type
);
}
}
if
(
next
===
"close"
)
{
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/question-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
}
}
...
@@ -271,9 +267,7 @@ class OperateQuestion extends Component {
...
@@ -271,9 +267,7 @@ class OperateQuestion extends Component {
this
.
handleRest
(
type
);
this
.
handleRest
(
type
);
}
}
if
(
next
===
"close"
)
{
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
window
.
RCHistory
.
goBack
();
pathname
:
`/question-manage-index?categoryId=
${
categoryId
}
`
,
});
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
}
}
...
...
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