Commit 9b9606d3 by wujiabao

优化 breakage

parent 13acee51
...@@ -23,7 +23,7 @@ class BarcodeComponent extends React.Component{ ...@@ -23,7 +23,7 @@ class BarcodeComponent extends React.Component{
{ {
barcodeWord?<p className={'font30'} style={{color:'#d0021b',textAlign:'center',marginTop:'20px'}}>条形码输入错误,请重新输入</p>:null barcodeWord?<p className={'font30'} style={{color:'#d0021b',textAlign:'center',marginTop:'20px'}}>条形码输入错误,请重新输入</p>:null
} }
<input type="text" className={'font30'} vlaue={barcode} onChange={(ev)=>{this.setState({barcode:ev.target.value})}}/> <input type="text" className={'font30'} value={barcode} onChange={(ev)=>{this.setState({barcode:ev.target.value})}}/>
<p className={'barcodeScan font30 colfff'}>or<span className={'colff7860'}>条形码扫描</span></p> <p className={'barcodeScan font30 colfff'}>or<span className={'colff7860'}>条形码扫描</span></p>
<Button text={'确定'} option={this.getCodeProduct.bind(this)} btnContainer={'font30 backff775c colfff'} style={{border:'0',margin:'0 auto',marginTop:'120px'}} /> <Button text={'确定'} option={this.getCodeProduct.bind(this)} btnContainer={'font30 backff775c colfff'} style={{border:'0',margin:'0 auto',marginTop:'120px'}} />
</div> </div>
...@@ -33,25 +33,24 @@ class BarcodeComponent extends React.Component{ ...@@ -33,25 +33,24 @@ class BarcodeComponent extends React.Component{
let {barcode}=this.state; let {barcode}=this.state;
let props=this.props; let props=this.props;
//验证输入的条形码是否为空 //验证输入的条形码是否为空
console.log(barcode,'sakldjklasjkdljasjdajskdjksajl')
if(barcode){ if(barcode){
props.getBarCodeProductInfo(barcode); props.getBarCodeProductInfo(barcode);
// props.changePage&&props.changePage(2) // props.changePage&&props.changePage(2)
this.setState({barcodeWord:false,barcode:''}); this.setState({barcodeWord:false,barcode:''});
}else{ }else{
this.setState({barcodeWord:true}) this.setState({barcodeWord:true,barcode:''})
} }
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
let props=this.props; let props=this.props;
if(nextProps.breakageProductInfo.product&&nextProps.breakageProductInfo.product.success!==false){ if(nextProps.breakageProductInfo.product&&nextProps.breakageProductInfo.product.success!==false){
props.changePage&&props.changePage(2)
}
}
componentDidMount(){
this.setState({ this.setState({
barcode:'' barcode:''
}) })
props.changePage&&props.changePage(2)
}
} }
} }
export default BarcodeComponent; export default BarcodeComponent;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment