Commit a38c3b9b by 姜雷

修改ws发送信息

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