Commit d1475467 by maolipeng

feat:批量设置分数

parent 6a970535
...@@ -776,7 +776,34 @@ class OperatePaper extends Component { ...@@ -776,7 +776,34 @@ class OperatePaper extends Component {
} }
return item return item
}) })
this.setState({selectQuestionList:questionList}) // 各类型题目总分值
const { formData, scoreRule } = this.state
const {singleChoiceCnt, multiChoiceCnt, judgeCnt, gapFillingCnt, indefiniteChoiceCnt} = formData
const singleChoiceScore = singleChoiceCnt*scoreRule.find((item)=> {return item.typeKey === "SINGLE_CHOICE"}).score
const multiChoiceScore = multiChoiceCnt*scoreRule.find((item)=> {return item.typeKey === "MULTI_CHOICE"}).score
const judgeScore = judgeCnt*scoreRule.find((item)=> {return item.typeKey === "JUDGE"}).score
const gapFillingScore = gapFillingCnt*scoreRule.find((item)=> {return item.typeKey === "GAP_FILLING"}).score
const indefiniteChoiceScore = indefiniteChoiceCnt*scoreRule.find((item)=> {return item.typeKey === "INDEFINITE_CHOICE"}).score
const totalScore = questionList.reduce((prev, cur) => {
return prev + Number(cur.score) || 0;
}, 0);
const passScore = Math.round(totalScore * formData.passRate * 0.01);
debugger
this.setState({
selectQuestionList:questionList,
formData: {
...formData,
singleChoiceScore,
multiChoiceScore,
judgeScore,
gapFillingScore,
indefiniteChoiceScore,
totalScore,
passScore,
}
})
}) })
} }
// 上下移题型 // 上下移题型
......
...@@ -28,6 +28,7 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -28,6 +28,7 @@ export default function BatchScore(props:BatchScoreProps) {
useEffect(()=> { useEffect(()=> {
_.map(props.rules,(item)=> { _.map(props.rules,(item)=> {
//更新分数统计
switch(item.typeKey) { switch(item.typeKey) {
case "SINGLE_CHOICE": case "SINGLE_CHOICE":
setSingleCount([item.totalQuestion,item.totalQuestion*item.score]) setSingleCount([item.totalQuestion,item.totalQuestion*item.score])
...@@ -48,8 +49,7 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -48,8 +49,7 @@ export default function BatchScore(props:BatchScoreProps) {
break; break;
} }
}) })
console.log("KKKKKKKKKKKKKKK") },[props.rules,rules])
},[rules])
if (!props.visible) { if (!props.visible) {
return ("") return ("")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment