Commit a38c3b9b by 姜雷

修改ws发送信息

parent b3c10c3d
......@@ -121,7 +121,6 @@ class Connect extends Component {
lastMessage: '',
canPay: false,
};
this.checkBluetoothAndWs();
}
componentWillMount() {
......@@ -132,6 +131,7 @@ class Connect extends Component {
payId: prepayConfig[0].id,
});
}
this.checkBluetoothAndWs();
}
componentWillUnmount() {
......@@ -259,22 +259,22 @@ class Connect extends Component {
sendDeviceCode() {
const { sockedDone, deviceDone } = this.state;
const { device } = this.props;
// const { device } = this.props;
console.log('socket状态:', sockedDone, '蓝牙状态:', deviceDone);
if (sockedDone && socketTask && deviceDone) {
let deviceData = '{<' + device.code + '>}';
console.log('<---发送设备编号:', deviceData);
socketTask.send({
data: str2ab(deviceData),
success: msg => {
console.log('发送设备编号:', msg, '--->');
},
fail: err => {
console.log('发送设备编号:', err, '--->');
},
});
}
// if (sockedDone && socketTask && deviceDone) {
// let deviceData = '{<' + device.code + '>}';
// console.log('<---发送设备编号:', deviceData);
// socketTask.send({
// data: str2ab(deviceData),
// success: msg => {
// console.log('发送设备编号:', msg, '--->');
// },
// fail: err => {
// console.log('发送设备编号:', err, '--->');
// },
// });
// }
}
closeDeviceSocket() {
......
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