Commit 56ca3932 by yemin

微信端主动触发测试吹风

parent b50e5b48
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import './style.scss'; import { Button, Toast } from 'antd-mobile';
import styles from './style.scss';
import eqIcon from '../../images/Equipment/equip_number_icon@2x.png'; import eqIcon from '../../images/Equipment/equip_number_icon@2x.png';
import { testWater } from '../../api/index';
import UserInfoContext from '../../context/userinfo-context'; import UserInfoContext from '../../context/userinfo-context';
import JsBarcode from 'jsbarcode'; import JsBarcode from 'jsbarcode';
...@@ -41,6 +43,20 @@ export class Index extends React.Component { ...@@ -41,6 +43,20 @@ export class Index extends React.Component {
showBig: !showBig, showBig: !showBig,
}); });
}; };
startTest = () => {
Toast.loading('', 20);
const { deviceCode } = this.props.match.params;
// const { quantity } = this.state;
testWater({
deviceCode,
}).then(res => {
console.log(res);
Toast.success(res.msg || '设置成功!');
}).catch(err => {
console.log(err);
Toast.fail(err.msg || '请求失败');
});
};
render() { render() {
const { deviceCode } = this.props.match.params; const { deviceCode } = this.props.match.params;
...@@ -64,6 +80,9 @@ export class Index extends React.Component { ...@@ -64,6 +80,9 @@ export class Index extends React.Component {
{deviceCode} {deviceCode}
</span> </span>
</div> </div>
<Button type='primary' className={styles.btn} onClick={this.startTest}>
点击测试
</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