|
@@ -56,7 +56,7 @@ class NumberDrop extends Component{
|
|
const that = this;
|
|
const that = this;
|
|
const isFine = this.validSymbols(text,min,max); //有~或/时是否合理
|
|
const isFine = this.validSymbols(text,min,max); //有~或/时是否合理
|
|
const hasSymbol = /[\/|\~]/g.test(text); //是否有~或/
|
|
const hasSymbol = /[\/|\~]/g.test(text); //是否有~或/
|
|
- const singleFine = !isNaN(+text)&&min<text&&text<max; //无~或/时是否合理
|
|
|
|
|
|
+ const singleFine = !isNaN(+text)&&parseFloat(min)<=parseFloat(text)&&parseFloat(text)<=parseFloat(max); //无~或/时是否合理
|
|
timer = setTimeout(function(){
|
|
timer = setTimeout(function(){
|
|
clearTimeout(that.state.sltTimer);
|
|
clearTimeout(that.state.sltTimer);
|
|
if(text!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
|
|
if(text!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
|
|
@@ -139,7 +139,7 @@ class NumberDrop extends Component{
|
|
if(index1!=-1&&index1==txt.lastIndexOf('~')&&index1!=txt.length-1){ //有且只有一个~,且不在最后
|
|
if(index1!=-1&&index1==txt.lastIndexOf('~')&&index1!=txt.length-1){ //有且只有一个~,且不在最后
|
|
arr1 = txt.split('~');
|
|
arr1 = txt.split('~');
|
|
//~的范围在合理范围内为合理值
|
|
//~的范围在合理范围内为合理值
|
|
- if(!isNaN(+arr1[0])&&!isNaN(+arr1[1])&&((!needCompare)||(needCompare&&min<arr1[0]&&arr1[0]<max&&min<arr1[1]&&arr1[1]<max))){
|
|
|
|
|
|
+ if(!isNaN(+arr1[0])&&!isNaN(+arr1[1])&&((!needCompare)||(needCompare&&parseFloat(min)<=parseFloat(arr1[0])&&parseFloat(arr1[0])<=parseFloat(max)&&parseFloat(min)<=parseFloat(arr1[1])&&parseFloat(arr1[1])<=parseFloat(max)))){
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -147,7 +147,7 @@ class NumberDrop extends Component{
|
|
if(index2!=-1&&index2==txt.lastIndexOf('/')&&index2!=txt.length-1){ //有且只有一个~,且不在最后
|
|
if(index2!=-1&&index2==txt.lastIndexOf('/')&&index2!=txt.length-1){ //有且只有一个~,且不在最后
|
|
arr2 = txt.split('/');
|
|
arr2 = txt.split('/');
|
|
// /两边的数字分别在合理范围内为合理值
|
|
// /两边的数字分别在合理范围内为合理值
|
|
- if(!isNaN(+arr2[0])&&!isNaN(+arr2[1])&&((!needCompare)||(needCompare&&min<arr2[0]&&arr2[0]<max&&min<arr2[1]&&arr2[1]<max))){
|
|
|
|
|
|
+ if(!isNaN(+arr2[0])&&!isNaN(+arr2[1])&&((!needCompare)||(needCompare&&parseFloat(min)<=parseFloat(arr2[0])&&parseFloat(arr2[0])<=parseFloat(max)&&parseFloat(min)<=parseFloat(arr2[1])&&parseFloat(arr2[1])<=parseFloat(max)))){
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -166,7 +166,7 @@ class NumberDrop extends Component{
|
|
const txt = e.target.innerText.trim();
|
|
const txt = e.target.innerText.trim();
|
|
const isFine = this.validSymbols(txt,min,max); //有~或/时是否合理
|
|
const isFine = this.validSymbols(txt,min,max); //有~或/时是否合理
|
|
const hasSymbol = /[\/|\~]/g.test(txt); //是否有~或/
|
|
const hasSymbol = /[\/|\~]/g.test(txt); //是否有~或/
|
|
- const singleFine = (!isNaN(+txt)&&!needCompare)||(!isNaN(+txt)&&needCompare&&min<txt&&txt<max); //无~或/时是否合理
|
|
|
|
|
|
+ const singleFine = (!isNaN(+txt)&&!needCompare)||(!isNaN(+txt)&&needCompare&&parseFloat(min)<=parseFloat(txt)&&parseFloat(txt)<=parseFloat(max)); //无~或/时是否合理
|
|
if(txt!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
|
|
if(txt!=''&&(!hasSymbol&&!singleFine)||(hasSymbol&&!isFine)){
|
|
this.beyondArea();
|
|
this.beyondArea();
|
|
return;
|
|
return;
|