Commit dd4457e6 by yemin

no message

parent 56ca3932
......@@ -65,8 +65,10 @@ class EquipmentTest extends Component {
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
success: res => {
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({
deviceCode: result,
deviceCode: bar,
});
},
fail: err => {
......
......@@ -43,12 +43,33 @@ export class Index extends React.Component {
showBig: !showBig,
});
};
startTest = () => {
startTest0 = () => {
Toast.loading('', 20);
console.log(this.props.match.params);
const { deviceCode } = this.props.match.params;
console.log(deviceCode);
// const { quantity } = this.state;
const { side } = { "side":0 };
console.log(side);
testWater({
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 => {
console.log(res);
Toast.success(res.msg || '设置成功!');
......@@ -80,8 +101,12 @@ export class Index extends React.Component {
{deviceCode}
</span>
</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>
</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