Commit dd4457e6 by yemin

no message

parent 56ca3932
...@@ -65,8 +65,10 @@ class EquipmentTest extends Component { ...@@ -65,8 +65,10 @@ class EquipmentTest extends Component {
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有 scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
success: res => { success: res => {
const result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果 const result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
var bar = result.indexOf("https://www.dcrym.com")!==-1?result.slice(29):result;
bar = bar.length>8?bar.substring(0,8):bar;
this.setState({ this.setState({
deviceCode: result, deviceCode: bar,
}); });
}, },
fail: err => { fail: err => {
......
...@@ -43,12 +43,33 @@ export class Index extends React.Component { ...@@ -43,12 +43,33 @@ export class Index extends React.Component {
showBig: !showBig, showBig: !showBig,
}); });
}; };
startTest = () => { startTest0 = () => {
Toast.loading('', 20); Toast.loading('', 20);
console.log(this.props.match.params);
const { deviceCode } = this.props.match.params; const { deviceCode } = this.props.match.params;
console.log(deviceCode);
// const { quantity } = this.state; // const { quantity } = this.state;
const { side } = { "side":0 };
console.log(side);
testWater({ testWater({
deviceCode, deviceCode,
side,
}).then(res => {
console.log(res);
Toast.success(res.msg || '设置成功!');
}).catch(err => {
console.log(err);
Toast.fail(err.msg || '请求失败');
});
};
startTest1 = () => {
Toast.loading('', 20);
const { deviceCode } = this.props.match.params;
// const { quantity } = this.state;
const { side } = { "side":1 };
testWater({
deviceCode,
side,
}).then(res => { }).then(res => {
console.log(res); console.log(res);
Toast.success(res.msg || '设置成功!'); Toast.success(res.msg || '设置成功!');
...@@ -80,8 +101,12 @@ export class Index extends React.Component { ...@@ -80,8 +101,12 @@ export class Index extends React.Component {
{deviceCode} {deviceCode}
</span> </span>
</div> </div>
<Button type='primary' className={styles.btn} onClick={this.startTest}> <Button type='primary' className={styles.btn} onClick={this.startTest0}>
点击测试 测试左边
</Button>
<br></br>
<Button type='primary' className={styles.btn} onClick={this.startTest1}>
测试右边
</Button> </Button>
</div> </div>
); );
......
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