Commit 83db1f02 by maolipeng

fix:.........

parent 7ba3f190
...@@ -4,7 +4,7 @@ import "./BatchScore.less" ...@@ -4,7 +4,7 @@ import "./BatchScore.less"
import _ from "underscore"; import _ from "underscore";
interface Rule { interface Rule {
typeKey: "SINGLE_CHOICE"|"MULTI_CHOICE"| "JUDGE"|"GAP_FILLING"|"INDEFINITE_CHOICE", typeKey: "GAP_FILLING"|"INDEFINITE_CHOICE"| "JUDGE"|"MULTI_CHOICE"|"SINGLE_CHOICE",
score: number, score: number,
portionScore: number, portionScore: number,
totalQuestion: number, totalQuestion: number,
...@@ -19,7 +19,7 @@ interface BatchScoreProps { ...@@ -19,7 +19,7 @@ interface BatchScoreProps {
export default function BatchScore(props:BatchScoreProps) { export default function BatchScore(props:BatchScoreProps) {
const [rules, setRules] = useState<Rule[]>(props.rules) const [rules, setRules] = useState<Rule[]>(_.sortBy(props.rules,"typeKey"))
const [singleCount, setSingleCount] = useState<number[]>([0]) const [singleCount, setSingleCount] = useState<number[]>([0])
const [multiCount, setMultiCount] = useState<number[]>([0]) const [multiCount, setMultiCount] = useState<number[]>([0])
const [judgeCount, setJudgeCount] = useState<number[]>([0]) const [judgeCount, setJudgeCount] = useState<number[]>([0])
...@@ -81,15 +81,14 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -81,15 +81,14 @@ export default function BatchScore(props:BatchScoreProps) {
<InputNumber <InputNumber
min={1} min={1}
max={100} max={100}
defaultValue={_.find(rules,(it)=>{return it.typeKey === "SINGLE_CHOICE"})?.score} value={rules[4].score}
defaultValue={rules[4].score}
style={inputNumberStyle} style={inputNumberStyle}
onChange={(v)=> { onChange={(v)=> {
setRules(_.map(rules,(item)=>{ v = Math.round(v)
if (item.typeKey === "SINGLE_CHOICE") { let _rules = [...rules]
item.score = Number(v) rules[4].score = v
} setRules(_rules)
return item
}))
}} }}
/> />
</span> </span>
...@@ -101,30 +100,27 @@ export default function BatchScore(props:BatchScoreProps) { ...@@ -101,30 +100,27 @@ export default function BatchScore(props:BatchScoreProps) {
<InputNumber <InputNumber
min={1} min={1}
max={100} max={100}
defaultValue={_.find(rules,(it)=>{return it.typeKey === "MULTI_CHOICE"})?.score} defaultValue={rules[3].score}
value={rules[3].score}
style={inputNumberStyle} style={inputNumberStyle}
onChange={(v)=> { onChange={(v)=> {
setRules(_.map(rules,(item)=>{ v = Math.round(v)
if (item.typeKey === "MULTI_CHOICE") { let _r = [...rules]
item.score = Number(v) _r[3].score = v
} setRules(_r)
return item
}))
}} }}
/> />
分,漏选得 分,漏选得
<InputNumber <InputNumber
min={0} min={0}
max={_.find(rules,(it)=>{return it.typeKey === "MULTI_CHOICE"})?.score} max={rules[3].score}
defaultValue={0} defaultValue={0}
style={inputNumberStyle} style={inputNumberStyle}
onChange={(v)=> { onChange={(v)=> {
setRules(_.map(rules,(item)=>{ v = Math.round(v)
if (item.typeKey === "MULTI_CHOICE") { let _r = [...rules]
item.portionScore = Number(v) _r[3].portionScore = v
} setRules(_r)
return item
}))
}} }}
/> />
</span> </span>
......
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