调整改版后调分弹框

issues25489
杨树林 5 years ago
parent 9e98330dbb
commit be3b094e2f

@ -32,7 +32,7 @@ module.exports = {
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s
// devtool: "cheap-module-eval-source-map",
// 开启调试
// devtool: "source-map", // 开启调试
devtool: "source-map", // 开启调试
// These are the "entry points" to our application.
// This means they will be the "root" imports that are included in JS bundle.
// The first two entry points enable "hot" CSS and auto-refreshes for JS.

@ -1,5 +1,5 @@
import React,{ Component } from "react";
import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form} from "antd";
import {Modal, Checkbox, Upload, Button, Icon, message, Input, Form, InputNumber} from "antd";
import { WordNumberTextarea } from 'educoder';
import './Newshixunmodel.css'
@ -17,6 +17,7 @@ class ModulationModal extends Component{
Saves=()=>{
console.log("Saves=()");
let {textareaval,Inputsval}=this.state;
// if(textareaval===""||textareaval===undefined){
// this.setState({
@ -44,6 +45,7 @@ class ModulationModal extends Component{
Inputsvaltype: false,
Inputsvaltest: "",
})
console.log(Inputsval);
this.props.Saves(textareaval,Inputsval)
}
@ -55,31 +57,45 @@ class ModulationModal extends Component{
}
setInputs=(e)=>{
debugger
var value=parseInt(e.target.value)
console.log("setInputs");
let value = undefined;
try {
value = parseFloat(e);
} catch (e) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: 0,
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
return;
}
if(isNaN(value)){
value = 0;
if (value === undefined || value === null || value === "") {
this.setState({
Inputsval: value,
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: 0,
Inputsvaltype: true,
Inputsvaltest: "请输入分数",
})
}else{
if(value<0||value>100){
value = 0;
this.setState({
Inputsval: value,
Inputsvaltype: true,
Inputsvaltest: "请输入0-100的分数",
})
}
}
this.setState({
return
}
var re = /^[0-9]+.?[0-9]*$/; //判断字符串是否为数字 //判断正整数 /^[1-9]+[0-9]*]*$/
var nubmer = value;
if (!re.test(nubmer)) {
this.setState({
borredszf: "ml10 color-grey-9 bor-reds ",
Inputsval: value,
Inputsvaltype: true,
Inputsvaltest: "请输入0-100的分数",
})
return;
}
console.log(value);
this.setState({
Inputsval: value,
Inputsvaltype: false,
})
})
}
render(){
let {textareaval, Inputsval, textareavaltype, Inputsvaltype, Inputsvaltest} = this.state;
@ -123,16 +139,26 @@ class ModulationModal extends Component{
lineHeight: " 40px",
color: " #f5222d",
}}>*</span></span>
<Input
className={Inputsvaltype === true ? "borerinput" : ""}
style={{
width: "120px",
height: "40px",
}}
placeholder="请填写分数"
value={Inputsval}
onInput={this.setInputs}
/>
<style>
{
`
.myinputnumbers .ant-input-number-input{
line-height: 40px;
height: 40px;
}
`
}
</style>
<InputNumber min={0}
className={Inputsvaltype === true ? "borerinput myinputnumbers" : "myinputnumbers"}
style={{
width: "120px",
height: "40px",
}}
step={0.1}
onChange={this.setInputs}
value={Inputsval === undefined || Inputsval === null ? 0 : Inputsval}/>
<span
style={{
textAlign: "center",

Loading…
Cancel
Save