|
|
@ -58,81 +58,94 @@ class ModulationModal_exercise extends Component {
|
|
|
|
Inputsvals
|
|
|
|
Inputsvals
|
|
|
|
} = this.state;
|
|
|
|
} = this.state;
|
|
|
|
let re = /^[0-9]+.?[0-9]*$/;//判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
|
|
|
|
let re = /^[0-9]+.?[0-9]*$/;//判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
|
|
|
|
|
|
|
|
let res= /^\-[1-9][0-9]*$/; //判断字符串是负整数
|
|
|
|
if (subool === false) {
|
|
|
|
if (subool === false) {
|
|
|
|
|
|
|
|
let subools=false;
|
|
|
|
|
|
|
|
let suboolss=false;
|
|
|
|
//不是总分模式
|
|
|
|
//不是总分模式
|
|
|
|
if (Inputsval === undefined || Inputsval === null || Inputsval === "") {
|
|
|
|
if (Inputsval === undefined || Inputsval === null || Inputsval === "") {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: "",
|
|
|
|
Inputsval: "",
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: "请填写分数",
|
|
|
|
Inputsvaltest: "主观题成绩不能为空",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
subools=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断主观题
|
|
|
|
//判断主观题
|
|
|
|
|
|
|
|
if(subools===false){
|
|
|
|
|
|
|
|
var nubmer = Inputsval;
|
|
|
|
|
|
|
|
if (!re.test(nubmer)&&!res.test(nubmer)) {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
|
|
|
|
Inputsvaltype: true,
|
|
|
|
|
|
|
|
Inputsvaltest: "请输入0-100的分数",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
subools=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var nubmer = Inputsval;
|
|
|
|
|
|
|
|
if (!re.test(nubmer)) {
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
|
|
|
|
Inputsvaltype: true,
|
|
|
|
|
|
|
|
Inputsvaltest: "请输入0-100的分数",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(subools===false){
|
|
|
|
if (0 > parseFloat(Inputsval)) {
|
|
|
|
if (0 > parseFloat(Inputsval)) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: "成绩不能小于零",
|
|
|
|
Inputsvaltest: "主观题成绩不能小于零",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
subools=true;
|
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: `成绩不能大于${this.props.subjective_score}`,
|
|
|
|
Inputsvaltest: `主观题成绩不能大于主观题总分值${this.props.subjective_score}`,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
subools=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//判断客观题
|
|
|
|
//判断客观题
|
|
|
|
|
|
|
|
|
|
|
|
if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") {
|
|
|
|
if (Inputsvals === undefined || Inputsvals === null || Inputsvals === "") {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: "请填写分数",
|
|
|
|
Inputsvaltests: "客观题成绩不能为空",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
suboolss=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var nubmers = Inputsvals;
|
|
|
|
|
|
|
|
if (!re.test(nubmers)) {
|
|
|
|
if(suboolss===false){
|
|
|
|
this.setState({
|
|
|
|
var nubmers = Inputsvals;
|
|
|
|
Inputsvals: "",
|
|
|
|
if (!re.test(nubmers)&&!res.test(nubmers)) {
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
this.setState({
|
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
|
Inputsvals: "",
|
|
|
|
})
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
return;
|
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
suboolss=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(suboolss===false){
|
|
|
|
if (0 > parseFloat(Inputsvals)) {
|
|
|
|
if (0 > parseFloat(Inputsvals)) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
|
Inputsvaltests: "客观题成绩不能小于零",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
suboolss=true;
|
|
|
|
} else if (parseFloat(Inputsvals) > this.props.objective_score) {
|
|
|
|
} else if (parseFloat(Inputsvals) > this.props.objective_score) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: `成绩不能大于${this.props.objective_score}`,
|
|
|
|
Inputsvaltests: `客观题成绩不能大于客观题总分值${this.props.objective_score}`,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
suboolss=true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(subools===true ||suboolss===true){
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
debugger
|
|
|
|
debugger
|
|
|
@ -143,14 +156,14 @@ class ModulationModal_exercise extends Component {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: "",
|
|
|
|
Inputsval: "",
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: "请填写分数",
|
|
|
|
Inputsvaltest: "总成绩不能为空",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断主观题
|
|
|
|
//判断主观题
|
|
|
|
var nubmer = Inputsval;
|
|
|
|
var nubmer = Inputsval;
|
|
|
|
if (!re.test(nubmer)) {
|
|
|
|
if (!re.test(nubmer)&&!res.test(nubmer)) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
@ -164,14 +177,14 @@ class ModulationModal_exercise extends Component {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: "成绩不能小于零",
|
|
|
|
Inputsvaltest: "总成绩不能小于零",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
|
} else if (parseFloat(Inputsval) > this.props.subjective_score) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsval: Inputsval,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltype: true,
|
|
|
|
Inputsvaltest: `成绩不能大于${this.props.subjective_score}`,
|
|
|
|
Inputsvaltest: `总成绩不能大于总分值${this.props.subjective_score}`,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -181,12 +194,12 @@ class ModulationModal_exercise extends Component {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: "请填写分数",
|
|
|
|
Inputsvaltests: "总成绩不能为空",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var nubmers = Inputsvals;
|
|
|
|
var nubmers = Inputsvals;
|
|
|
|
if (!re.test(nubmers)) {
|
|
|
|
if (!re.test(nubmers)&&!res.test(nubmers)) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvals: "",
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
@ -199,14 +212,14 @@ class ModulationModal_exercise extends Component {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: "请输入0-100的分数",
|
|
|
|
Inputsvaltests: "总成绩不能小于零",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else if (parseFloat(Inputsvals) > this.props.objective_score) {
|
|
|
|
} else if (parseFloat(Inputsvals) > this.props.objective_score) {
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvals: Inputsvals,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltypes: true,
|
|
|
|
Inputsvaltests: `成绩不能大于${this.props.objective_score}`,
|
|
|
|
Inputsvaltests: `总成绩不能大于总分值${this.props.objective_score}`,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -316,7 +329,7 @@ class ModulationModal_exercise extends Component {
|
|
|
|
<div className="mexertwo" style={{
|
|
|
|
<div className="mexertwo" style={{
|
|
|
|
marginTop: "20px",
|
|
|
|
marginTop: "20px",
|
|
|
|
}}>
|
|
|
|
}}>
|
|
|
|
<p className="mexeheigth2">主观题成绩:</p>
|
|
|
|
<p className="mexeheigth2 mr10">主观题成绩:</p>
|
|
|
|
<Input
|
|
|
|
<Input
|
|
|
|
className={Inputsvaltype === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
|
className={Inputsvaltype === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
@ -335,7 +348,7 @@ class ModulationModal_exercise extends Component {
|
|
|
|
<p style={{
|
|
|
|
<p style={{
|
|
|
|
color: "#DD1717",
|
|
|
|
color: "#DD1717",
|
|
|
|
width: "77%",
|
|
|
|
width: "77%",
|
|
|
|
marginLeft: "75px",
|
|
|
|
marginLeft: "82px",
|
|
|
|
marginTop: "10px",
|
|
|
|
marginTop: "10px",
|
|
|
|
}}>{Inputsvaltest}</p>
|
|
|
|
}}>{Inputsvaltest}</p>
|
|
|
|
: ""
|
|
|
|
: ""
|
|
|
@ -362,7 +375,7 @@ class ModulationModal_exercise extends Component {
|
|
|
|
marginTop: "20px",
|
|
|
|
marginTop: "20px",
|
|
|
|
}}>
|
|
|
|
}}>
|
|
|
|
|
|
|
|
|
|
|
|
<p className="mexeheigth2">客观题成绩:</p>
|
|
|
|
<p className="mexeheigth2 mr10">客观题成绩:</p>
|
|
|
|
<Input
|
|
|
|
<Input
|
|
|
|
className={Inputsvaltypes === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
|
className={Inputsvaltypes === true ? "borerinput myinputnumbers bor-reds" : "myinputnumbers"}
|
|
|
|
style={{
|
|
|
|
style={{
|
|
|
@ -382,7 +395,7 @@ class ModulationModal_exercise extends Component {
|
|
|
|
<p style={{
|
|
|
|
<p style={{
|
|
|
|
color: "#DD1717",
|
|
|
|
color: "#DD1717",
|
|
|
|
width: "77%",
|
|
|
|
width: "77%",
|
|
|
|
marginLeft: "75px",
|
|
|
|
marginLeft: "82px",
|
|
|
|
marginTop: "10px",
|
|
|
|
marginTop: "10px",
|
|
|
|
}}>{Inputsvaltests}</p>
|
|
|
|
}}>{Inputsvaltests}</p>
|
|
|
|
: ""
|
|
|
|
: ""
|
|
|
|