调整实训作业设置分数

dev_daiao
杨树林 5 years ago
parent 674922e173
commit 517ebc2eb4

@ -132,7 +132,9 @@ class Trainingjobsetting extends Component {
CalculateMax: 100,//总分值 CalculateMax: 100,//总分值
borredszf:"ml10 color-grey-9", borredszf:"ml10 color-grey-9",
borredszfl:true, borredszfl:true,
borredszfls:'' borredszfls:'',
total_scoretwo:0,
total_score:0,
} }
// console.log("获取到的值") // console.log("获取到的值")
// console.log("Trainingjobsetting") // console.log("Trainingjobsetting")
@ -302,7 +304,10 @@ class Trainingjobsetting extends Component {
proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "", proportion: result.data.shixun_evaluation === 0 ? "均分比例" : result.data.shixun_evaluation === 1 ? "经验值比例" : result.data.shixun_evaluation === 2 ? "自定义分值" : "",
publicwork: result.data.work_public, publicwork: result.data.work_public,
challenge_settings: result.data.challenge_settings, challenge_settings: result.data.challenge_settings,
code_review: result.data.code_review code_review: result.data.code_review,
total_scoretwo:result.data.total_score,
total_score:result.data.total_score,
}) })
this.props.Getdataback(result, result.data); this.props.Getdataback(result, result.data);
@ -646,6 +651,7 @@ class Trainingjobsetting extends Component {
if (this.state.completionefficiencyscore === true) { if (this.state.completionefficiencyscore === true) {
latedeductiontwos = this.state.latedeductiontwo; latedeductiontwos = this.state.latedeductiontwo;
} }
//从这里开始记得等于0的时候还要做判断
if (challenge_scoredata.length > 0) { if (challenge_scoredata.length > 0) {
var len = 0; var len = 0;
for (var k = 0; k < challenge_scoredata.length; k++) { for (var k = 0; k < challenge_scoredata.length; k++) {
@ -680,6 +686,16 @@ class Trainingjobsetting extends Component {
} }
}else{
try {
if(parseFloat(this.state.CalculateMax)!==parseFloat(0)){
this.props.showNotification(`分值之和必须等于总分值:${this.state.CalculateMax}`);
this.scrollToAnchor("zongfentimeid");
return;
}
}catch (e) {
}
} }
var url = `/homework_commons/${homeworkid}/update_settings.json`; var url = `/homework_commons/${homeworkid}/update_settings.json`;
@ -707,7 +723,9 @@ class Trainingjobsetting extends Component {
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, score_open: this.state.publicwork,
total_score:this.state.CalculateMax total_score:this.state.CalculateMax,
total_scoretwo:this.state.CalculateMax,//记录总分值点击取消的时候还原总分值
} }
} else { } else {
// //非统一配置 // //非统一配置
@ -738,7 +756,8 @@ class Trainingjobsetting extends Component {
shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0, shixun_evaluation: this.state.proportion === "均分比例" ? 0 : this.state.proportion === "经验值比例" ? 1 : this.state.proportion === "自定义分值" ? 2 : 0,
challenge_settings: array, challenge_settings: array,
score_open: this.state.publicwork, score_open: this.state.publicwork,
total_score:this.state.CalculateMax total_score:this.state.CalculateMax,
total_scoretwo:this.state.CalculateMax
} }
} }
@ -1193,8 +1212,7 @@ class Trainingjobsetting extends Component {
} }
//总比分 //总比分
Totalscorecalculation = (value) => { Totalscorecalculation = (value) => {
debugger
this.setState({ this.setState({
CalculateMax: value, CalculateMax: value,
}) })
@ -2150,6 +2168,9 @@ class Trainingjobsetting extends Component {
}) })
this.refs.targetElementTrainingjobsetting.scrollIntoView(); this.refs.targetElementTrainingjobsetting.scrollIntoView();
this.getTrainingjobsetting(false); this.getTrainingjobsetting(false);
this.setState({
CalculateMax:this.state.total_scoretwo,
})
} }
rulesCheckInfo = (rules) => { rulesCheckInfo = (rules) => {

Loading…
Cancel
Save