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
6a970535
Commit
6a970535
authored
Jun 30, 2021
by
maolipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:////////
parent
57a0bc6a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
308 additions
and
83 deletions
+308
-83
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+87
-19
src/modules/teach-tool/paper-manage/components/BatchGrade.tsx
+0
-62
src/modules/teach-tool/paper-manage/components/BatchScore.less
+3
-2
src/modules/teach-tool/paper-manage/components/BatchScore.tsx
+218
-0
No files found.
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
6a970535
...
@@ -36,7 +36,7 @@ import _ from "underscore";
...
@@ -36,7 +36,7 @@ import _ from "underscore";
import
{
Route
,
withRouter
}
from
"react-router-dom"
;
import
{
Route
,
withRouter
}
from
"react-router-dom"
;
import
*
as
paperEmpty
from
'../../lottie/paperEmpty/data.json'
;
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"
;
import
Batch
Grade
from
"./components/BatchGrad
e"
;
import
Batch
Score
from
"./components/BatchScor
e"
;
const
questionTypeEnum
=
{
const
questionTypeEnum
=
{
SINGLE_CHOICE
:
"单选题"
,
SINGLE_CHOICE
:
"单选题"
,
...
@@ -75,7 +75,7 @@ class OperatePaper extends Component {
...
@@ -75,7 +75,7 @@ class OperatePaper extends Component {
selectQuestionModal
:
null
,
selectQuestionModal
:
null
,
paperPreviewModal
:
null
,
paperPreviewModal
:
null
,
quickSortModalVisible
:
false
,
// 快捷排序弹窗显隐
quickSortModalVisible
:
false
,
// 快捷排序弹窗显隐
batchSet
Grad
eVisible
:
false
,
//批量设置题型分数
batchSet
Scor
eVisible
:
false
,
//批量设置题型分数
selectQuestionList
:
[],
selectQuestionList
:
[],
currentOperate
:
""
,
currentOperate
:
""
,
currentNav
:
""
,
currentNav
:
""
,
...
@@ -107,35 +107,35 @@ class OperatePaper extends Component {
...
@@ -107,35 +107,35 @@ class OperatePaper extends Component {
typeKey
:
"INDEFINITE_CHOICE"
,
typeKey
:
"INDEFINITE_CHOICE"
,
},
},
],
],
grad
eRule
:
[
scor
eRule
:
[
{
{
typeKey
:
"SINGLE_CHOICE"
,
typeKey
:
"SINGLE_CHOICE"
,
grad
e
:
2
,
scor
e
:
2
,
halfGrad
e
:
1
,
portionScor
e
:
1
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
{
{
typeKey
:
"MULTI_CHOICE"
,
typeKey
:
"MULTI_CHOICE"
,
grad
e
:
2
,
scor
e
:
2
,
halfGrad
e
:
1
,
portionScor
e
:
1
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
{
{
typeKey
:
"JUDGE"
,
typeKey
:
"JUDGE"
,
grad
e
:
2
,
scor
e
:
2
,
halfGrad
e
:
1
,
portionScor
e
:
1
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
{
{
typeKey
:
"GAP_FILLING"
,
typeKey
:
"GAP_FILLING"
,
grad
e
:
2
,
scor
e
:
2
,
halfGrad
e
:
1
,
portionScor
e
:
1
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
{
{
typeKey
:
"INDEFINITE_CHOICE"
,
typeKey
:
"INDEFINITE_CHOICE"
,
grad
e
:
2
,
scor
e
:
2
,
halfGrad
e
:
1
,
portionScor
e
:
1
,
totalQuestion
:
0
,
totalQuestion
:
0
,
},
},
]
]
...
@@ -264,6 +264,29 @@ class OperatePaper extends Component {
...
@@ -264,6 +264,29 @@ class OperatePaper extends Component {
},
0
);
},
0
);
const
passScore
=
Math
.
round
(
totalScore
*
formData
.
passRate
*
0.01
);
const
passScore
=
Math
.
round
(
totalScore
*
formData
.
passRate
*
0.01
);
let
_scorerule
=
_
.
map
(
this
.
state
.
scoreRule
,(
item
)
=>
{
switch
(
item
.
typeKey
)
{
case
"SINGLE_CHOICE"
:
item
.
totalQuestion
=
singleQuestion
.
length
;
break
;
case
"MULTI_CHOICE"
:
item
.
totalQuestion
=
multiQuestion
.
length
;
break
;
case
"JUDGE"
:
item
.
totalQuestion
=
judgeQuestion
.
length
;
break
;
case
"GAP_FILLING"
:
item
.
totalQuestion
=
gapQuestion
.
length
;
break
;
case
"INDEFINITE_CHOICE"
:
item
.
totalQuestion
=
indefiniteQuestion
.
length
;
break
;
default
:
item
.
totalQuestion
=
0
break
;
}
return
item
})
this
.
setState
({
this
.
setState
({
formData
:
{
formData
:
{
...
formData
,
...
formData
,
...
@@ -281,6 +304,7 @@ class OperatePaper extends Component {
...
@@ -281,6 +304,7 @@ class OperatePaper extends Component {
questionCnt
:
_selectQuestionList
.
length
,
questionCnt
:
_selectQuestionList
.
length
,
totalScore
,
totalScore
,
},
},
scoreRule
:
_scorerule
,
});
});
};
};
...
@@ -291,9 +315,11 @@ class OperatePaper extends Component {
...
@@ -291,9 +315,11 @@ class OperatePaper extends Component {
<
SelectQuestionModal
<
SelectQuestionModal
getSelectedQuestion=
{
selectQuestionList
}
getSelectedQuestion=
{
selectQuestionList
}
setSelectedQuestion=
{
(
list
)
=>
{
setSelectedQuestion=
{
(
list
)
=>
{
//按分数规则给每一题重新设置分数(只对新增题目有效)
let
_list
=
this
.
setScoreByRule
(
list
)
this
.
setState
({
selectQuestionModal
:
null
},
()
=>
{
this
.
setState
({
selectQuestionModal
:
null
},
()
=>
{
this
.
setFormData
(
list
);
this
.
setFormData
(
_
list
);
this
.
quickSorter
(
list
,
sorterMethod
,
sorterBy
);
this
.
quickSorter
(
_
list
,
sorterMethod
,
sorterBy
);
});
});
}
}
}
}
close=
{
()
=>
{
close=
{
()
=>
{
...
@@ -306,6 +332,25 @@ class OperatePaper extends Component {
...
@@ -306,6 +332,25 @@ class OperatePaper extends Component {
this
.
setState
({
selectQuestionModal
:
m
});
this
.
setState
({
selectQuestionModal
:
m
});
};
};
setScoreByRule
=
(
list
)
=>
{
//按批量设置分数规则给每一题重新设置分数(只对新增题目有效)
return
_
.
map
(
list
,
(
item
)
=>
{
let
exist
=
_
.
find
(
this
.
state
.
selectQuestionList
,
(
q
)
=>
{
return
q
.
questionId
===
item
.
questionId
})
if
(
exist
)
{
return
item
}
let
rule
=
_
.
find
(
this
.
state
.
scoreRule
,(
g
)
=>
{
return
g
.
typeKey
===
item
.
questionType
})
if
(
rule
)
{
item
.
score
=
rule
.
score
item
.
portionScore
=
rule
.
portionScore
}
return
item
})
}
// 移动已选题目
// 移动已选题目
handleMoveItem
=
(
index
,
moveLength
)
=>
{
handleMoveItem
=
(
index
,
moveLength
)
=>
{
const
selectQuestionList
=
[...
this
.
state
.
selectQuestionList
];
const
selectQuestionList
=
[...
this
.
state
.
selectQuestionList
];
...
@@ -715,6 +760,25 @@ class OperatePaper extends Component {
...
@@ -715,6 +760,25 @@ class OperatePaper extends Component {
return
columns
;
return
columns
;
};
};
//
onBatchScoreOK
=
(
rules
)
=>
{
this
.
setState
({
batchSetScoreVisible
:
false
,
scoreRule
:
rules
},()
=>
{
let
questionList
=
_
.
map
(
this
.
state
.
selectQuestionList
,(
item
)
=>
{
let
rule
=
_
.
find
(
this
.
state
.
scoreRule
,(
s
)
=>
{
return
s
.
typeKey
===
item
.
questionType
})
if
(
rule
)
{
item
.
score
=
rule
.
score
item
.
portionScore
=
rule
.
portionScore
}
return
item
})
this
.
setState
({
selectQuestionList
:
questionList
})
})
}
// 上下移题型
// 上下移题型
handleMoveTypeSorter
=
(
index
,
moveLength
)
=>
{
handleMoveTypeSorter
=
(
index
,
moveLength
)
=>
{
const
sorterTypeList
=
[...
this
.
state
.
sorterTypeList
];
const
sorterTypeList
=
[...
this
.
state
.
sorterTypeList
];
...
@@ -909,7 +973,7 @@ class OperatePaper extends Component {
...
@@ -909,7 +973,7 @@ class OperatePaper extends Component {
className=
"choose-btn"
className=
"choose-btn"
onClick=
{
()
=>
{
onClick=
{
()
=>
{
this
.
setState
({
this
.
setState
({
batchSet
Grad
eVisible
:
true
,
batchSet
Scor
eVisible
:
true
,
});
});
}
}
}
}
>
>
...
@@ -1004,9 +1068,13 @@ class OperatePaper extends Component {
...
@@ -1004,9 +1068,13 @@ class OperatePaper extends Component {
/>
/>
)
}
)
}
</
Modal
>
</
Modal
>
<
BatchGrade
{
/* 批量设置分数规则 */
}
visible=
{
this
.
state
.
batchSetGradeVisible
}
<
BatchScore
onClose=
{
()
=>
this
.
setState
({
batchSetGradeVisible
:
false
})
}
/>
visible=
{
this
.
state
.
batchSetScoreVisible
}
onOK=
{
this
.
onBatchScoreOK
}
onCancel=
{
()
=>
this
.
setState
({
batchSetScoreVisible
:
false
})
}
rules=
{
this
.
state
.
scoreRule
}
/>
</
div
>
</
div
>
<
Route
<
Route
path=
{
`${match.url}/exam-operate-page`
}
path=
{
`${match.url}/exam-operate-page`
}
...
...
src/modules/teach-tool/paper-manage/components/BatchGrade.tsx
deleted
100644 → 0
View file @
57a0bc6a
import
React
,
{
useState
}
from
"react"
;
import
{
Modal
,
Button
,
InputNumber
}
from
'antd'
;
import
"./BatchGrade.less"
interface
BatchGradeProps
{
visible
:
boolean
,
onClose
:
()
=>
void
,
}
export
default
function
BatchGrade
(
props
:
BatchGradeProps
)
{
if
(
!
props
.
visible
)
{
return
(
""
)
}
function
onOk
()
{
}
function
onCancel
()
{
props
.
onClose
()
}
const
inputNumberStyle
=
{
width
:
"57px"
,
margin
:
"0 8px"
}
return
(
<
Modal
className=
"batchgrade"
title=
"批量设置分数"
onCancel=
{
onCancel
}
onOk=
{
onOk
}
visible=
{
props
.
visible
}
maskClosable=
{
false
}
width=
{
660
}
>
<
div
className=
"content"
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【单选题】
</
span
>
<
span
className=
"grade"
>
每题
<
InputNumber
defaultValue=
{
2
}
style=
{
inputNumberStyle
}
/>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【多选题】
</
span
>
<
span
className=
"grade"
>
每题
<
InputNumber
style=
{
inputNumberStyle
}
/>
分,漏选得
<
InputNumber
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
/>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【不定项选择题】
</
span
>
<
span
className=
"grade"
>
每题
<
InputNumber
style=
{
inputNumberStyle
}
/>
分,漏选得
<
InputNumber
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
/>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【判断题】
</
span
>
<
span
className=
"grade"
>
每题
<
InputNumber
style=
{
inputNumberStyle
}
/>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【填空题】
</
span
>
<
span
className=
"grade"
>
每题
<
InputNumber
style=
{
inputNumberStyle
}
/>
分,半对得
<
InputNumber
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
/>
分
</
span
>
</
div
>
</
div
>
</
Modal
>
)
}
\ No newline at end of file
src/modules/teach-tool/paper-manage/components/Batch
Grad
e.less
→
src/modules/teach-tool/paper-manage/components/Batch
Scor
e.less
View file @
6a970535
.batch
grad
e {
.batch
scor
e {
.content {
.content {
.item {
.item {
display: flex;
display: flex;
...
@@ -13,9 +13,10 @@
...
@@ -13,9 +13,10 @@
.type {
.type {
width: 112px;
width: 112px;
}
}
.
grad
e {
.
scor
e {
margin-left: 8px;
margin-left: 8px;
margin-right: 29px;
margin-right: 29px;
width: 258px;
}
}
}
}
.item:not(:last-of-type) {
.item:not(:last-of-type) {
...
...
src/modules/teach-tool/paper-manage/components/BatchScore.tsx
0 → 100644
View file @
6a970535
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Modal
,
Button
,
InputNumber
}
from
'antd'
;
import
"./BatchScore.less"
import
_
from
"underscore"
;
interface
Rule
{
typeKey
:
"SINGLE_CHOICE"
|
"MULTI_CHOICE"
|
"JUDGE"
|
"GAP_FILLING"
|
"INDEFINITE_CHOICE"
,
score
:
number
,
portionScore
:
number
,
totalQuestion
:
number
,
}
interface
BatchScoreProps
{
visible
:
boolean
,
rules
:
Rule
[],
onOK
:
(
rules
:
Rule
[])
=>
void
,
onCancel
:
()
=>
void
,
}
export
default
function
BatchScore
(
props
:
BatchScoreProps
)
{
const
[
rules
,
setRules
]
=
useState
<
Rule
[]
>
(
props
.
rules
)
const
[
singleCount
,
setSingleCount
]
=
useState
<
number
[]
>
([
0
])
const
[
multiCount
,
setMultiCount
]
=
useState
<
number
[]
>
([
0
])
const
[
judgeCount
,
setJudgeCount
]
=
useState
<
number
[]
>
([
0
])
const
[
gapCount
,
setgapCount
]
=
useState
<
number
[]
>
([
0
])
const
[
indefiniteCount
,
setIndefiniteCount
]
=
useState
<
number
[]
>
([
0
])
useEffect
(()
=>
{
_
.
map
(
props
.
rules
,(
item
)
=>
{
switch
(
item
.
typeKey
)
{
case
"SINGLE_CHOICE"
:
setSingleCount
([
item
.
totalQuestion
,
item
.
totalQuestion
*
item
.
score
])
break
;
case
"MULTI_CHOICE"
:
setMultiCount
([
item
.
totalQuestion
,
item
.
totalQuestion
*
item
.
score
])
break
;
case
"JUDGE"
:
setJudgeCount
([
item
.
totalQuestion
,
item
.
totalQuestion
*
item
.
score
])
break
;
case
"GAP_FILLING"
:
setgapCount
([
item
.
totalQuestion
,
item
.
totalQuestion
*
item
.
score
])
break
;
case
"INDEFINITE_CHOICE"
:
setIndefiniteCount
([
item
.
totalQuestion
,
item
.
totalQuestion
*
item
.
score
])
break
;
default
:
break
;
}
})
console
.
log
(
"KKKKKKKKKKKKKKK"
)
},[
rules
])
if
(
!
props
.
visible
)
{
return
(
""
)
}
function
onOk
()
{
props
.
onOK
(
rules
)
}
function
onCancel
()
{
props
.
onCancel
()
}
const
inputNumberStyle
=
{
width
:
"57px"
,
margin
:
"0 8px"
}
return
(
<
Modal
className=
"batchscore"
title=
"批量设置分数"
onCancel=
{
onCancel
}
onOk=
{
onOk
}
visible=
{
props
.
visible
}
maskClosable=
{
false
}
width=
{
660
}
>
<
div
className=
"content"
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【单选题】
</
span
>
<
span
className=
"score"
>
每题
<
InputNumber
min=
{
1
}
defaultValue=
{
_
.
find
(
rules
,(
it
)
=>
{
return
it
.
typeKey
===
"SINGLE_CHOICE"
})?.
score
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"SINGLE_CHOICE"
)
{
item
.
score
=
Number
(
v
)
}
return
item
}))
}
}
/>
分
</
span
>
<
span
className=
"total"
>
共
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
singleCount
[
0
]
}
</
span
>
题,合计
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
singleCount
[
1
]
}
</
span
>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【多选题】
</
span
>
<
span
className=
"score"
>
每题
<
InputNumber
min=
{
1
}
defaultValue=
{
_
.
find
(
rules
,(
it
)
=>
{
return
it
.
typeKey
===
"MULTI_CHOICE"
})?.
score
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"MULTI_CHOICE"
)
{
item
.
score
=
Number
(
v
)
}
return
item
}))
}
}
/>
分,漏选得
<
InputNumber
min=
{
0
}
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"MULTI_CHOICE"
)
{
item
.
portionScore
=
Number
(
v
)
}
return
item
}))
}
}
/>
分
</
span
>
<
span
className=
"total"
>
共
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
multiCount
[
0
]
}
</
span
>
题,合计
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
multiCount
[
1
]
}
</
span
>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【不定项选择题】
</
span
>
<
span
className=
"score"
>
每题
<
InputNumber
min=
{
1
}
defaultValue=
{
_
.
find
(
rules
,(
it
)
=>
{
return
it
.
typeKey
===
"INDEFINITE_CHOICE"
})?.
score
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"INDEFINITE_CHOICE"
)
{
item
.
score
=
Number
(
v
)
}
return
item
}))
}
}
/>
分,漏选得
<
InputNumber
min=
{
0
}
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"INDEFINITE_CHOICE"
)
{
item
.
portionScore
=
Number
(
v
)
}
return
item
}))
}
}
/>
分
</
span
>
<
span
className=
"total"
>
共
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
judgeCount
[
0
]
}
</
span
>
题,合计
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
judgeCount
[
1
]
}
</
span
>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【判断题】
</
span
>
<
span
className=
"score"
>
每题
<
InputNumber
min=
{
1
}
defaultValue=
{
_
.
find
(
rules
,(
it
)
=>
{
return
it
.
typeKey
===
"JUDGE"
})?.
score
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"JUDGE"
)
{
item
.
score
=
Number
(
v
)
}
return
item
}))
}
}
/>
分
</
span
>
<
span
className=
"total"
>
共
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
indefiniteCount
[
0
]
}
</
span
>
题,合计
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
indefiniteCount
[
1
]
}
</
span
>
分
</
span
>
</
div
>
<
div
className=
"item"
>
<
span
className=
"type"
>
【填空题】
</
span
>
<
span
className=
"score"
>
每题
<
InputNumber
min=
{
1
}
defaultValue=
{
_
.
find
(
rules
,(
it
)
=>
{
return
it
.
typeKey
===
"GAP_FILLING"
})?.
score
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"GAP_FILLING"
)
{
item
.
score
=
Number
(
v
)
}
return
item
}))
}
}
/>
分,半对得
<
InputNumber
min=
{
0
}
defaultValue=
{
1
}
style=
{
inputNumberStyle
}
onChange=
{
(
v
)
=>
{
setRules
(
_
.
map
(
rules
,(
item
)
=>
{
if
(
item
.
typeKey
===
"GAP_FILLING"
)
{
item
.
portionScore
=
Number
(
v
)
}
return
item
}))
}
}
/>
分
</
span
>
<
span
className=
"total"
>
共
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
gapCount
[
0
]
}
</
span
>
题,合计
<
span
style=
{
{
color
:
"#2966FF"
}
}
>
{
gapCount
[
1
]
}
</
span
>
分
</
span
>
</
div
>
</
div
>
</
Modal
>
)
}
\ No newline at end of file
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