issues25489
杨树林 5 years ago
parent 609bf2a6c5
commit 7e2993fac1

@ -59,46 +59,7 @@ class ModulationModal extends Component{
setInputs=(e)=>{
console.log("setInputs");
console.log(e);
let value = undefined;
if (e === undefined) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: "",
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
return;
} else if (e === null) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: "",
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
return;
} else if (e === "") {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: "",
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
return;
}
try {
value = parseFloat(e);
} catch (e) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: 0,
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
return;
}
if (value === undefined || value === null || value === "") {
if (e === undefined || e === null || e === "") {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: 0,
@ -108,18 +69,18 @@ class ModulationModal extends Component{
return
}
var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
var nubmer = value;
var nubmer = e;
if (!re.test(nubmer)) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: value,
Inputsval: e,
Inputsvaltype: true,
Inputsvaltest: "请输入0-100的分数",
})
return;
}
this.setState({
Inputsval: value,
Inputsval: parseFloat(e),
Inputsvaltype: false,
})
}
@ -195,7 +156,7 @@ class ModulationModal extends Component{
</div>
{
Inputsvaltype === true ?
<p style={{color: "#DD1717", width: "77%", marginLeft: "16px", marginTop: "10px",}}>{Inputsvaltest}</p>
<p style={{color: "#DD1717", width: "77%", marginLeft: "1px", marginTop: "10px",}}>{Inputsvaltest}</p>
: ""
}

Loading…
Cancel
Save