diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal.js b/public/react/src/modules/courses/coursesPublic/ModulationModal.js index 601e6dfbc..ebe9dd225 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal.js @@ -33,7 +33,7 @@ class ModulationModal extends Component{ this.setState({ Inputsval: "", Inputsvaltype: true, - Inputsvaltest: "请输入分数", + Inputsvaltest: "请填写分数", }) return } @@ -58,29 +58,39 @@ class ModulationModal extends Component{ setInputs=(e)=>{ console.log("setInputs"); - console.log(e); - if (e === undefined || e === null || e === "") { + console.log(e.target.value); + if (e.target.value === undefined || e.target.value === null || e.target.value === "") { this.setState({ borredszf: "ml10 color-grey-9 bor-reds ", - Inputsval: 0, + Inputsval: "", Inputsvaltype: true, - Inputsvaltest: "请输入分数", + Inputsvaltest: "请填写分数", }) return } var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/ - var nubmer = e; + var nubmer = e.target.value; if (!re.test(nubmer)) { this.setState({ borredszf: "ml10 color-grey-9 bor-reds ", - Inputsval: e, + Inputsval: e.target.value, + Inputsvaltype: true, + Inputsvaltest: "请输入0-100的分数", + }) + return; + } + + if (parseFloat(e.target.value) > 100) { + this.setState({ + borredszf: "ml10 color-grey-9 bor-reds ", + Inputsval: e.target.value, Inputsvaltype: true, Inputsvaltest: "请输入0-100的分数", }) return; } this.setState({ - Inputsval: parseFloat(e), + Inputsval: parseFloat(e.target.value), Inputsvaltype: false, }) } @@ -133,19 +143,36 @@ class ModulationModal extends Component{ line-height: 40px; height: 35px; } + ` } - + { + ` + .ant-input:hover { + border: 1px solid #DD1717!important; + } + .ant-input:focus { + border: 1px solid #DD1717!important; + } + } + ` + } + + : + "" + + } this.setInputs(e)} - value={Inputsval === undefined || Inputsval === null ? 0 : Inputsval}/> + placeholder="请填写分数" + onChange={(e) => this.setInputs(e)} + value={Inputsval === undefined || Inputsval === null ? "" : Inputsval}/>