diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index d203470c0..a1d354e78 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -29,11 +29,21 @@ class ModulationModal extends Component{ }) if(Inputsval===undefined||Inputsval===""){ - this.setState({ - Inputsvaltype:true - }) + this.setState({ + Inputsval: "", + Inputsvaltype: true, + Inputsvaltest: "请输入分数", + }) return } + + if (this.state.Inputsvaltype === true) { + return; + } + this.setState({ + Inputsvaltype: false, + Inputsvaltest: "", + }) this.props.Saves(textareaval,Inputsval) } @@ -45,21 +55,34 @@ class ModulationModal extends Component{ } setInputs=(e)=>{ + debugger var value=parseInt(e.target.value) if(isNaN(value)){ - value=0 + value = 0; + this.setState({ + Inputsval: value, + Inputsvaltype: true, + Inputsvaltest: "请输入分数", + }) }else{ if(value<0||value>100){ - value=0 + value = 0; + this.setState({ + Inputsval: value, + Inputsvaltype: true, + Inputsvaltest: "请输入0-100的分数", + }) + } } this.setState({ - Inputsval:value + Inputsval: value, + Inputsvaltype: false, }) } render(){ - let {textareaval,Inputsval,textareavaltype,Inputsvaltype}=this.state; + let {textareaval, Inputsval, textareavaltype, Inputsvaltype, Inputsvaltest} = this.state; return(
{Inputsvaltest}
+ : "" + } +