|
@@ -23,7 +23,6 @@
|
|
|
:groupList="groupList"
|
|
|
:cloudList="cloudList"
|
|
|
:mealTypeObj="mealTypeObj"
|
|
|
- @shearplate="shearplate"
|
|
|
@funcHandle="funcHandle"
|
|
|
@exit="exit"
|
|
|
/>
|
|
@@ -653,14 +652,14 @@ export default {
|
|
|
// 设置定时器 每3秒发送一次心跳
|
|
|
this.doConnectDirectivesIntervalerPing = setInterval(() => {
|
|
|
if (this.doConnectDirectivesWs.readyState === 1) {
|
|
|
- this.doConnectDirectivesWs.send(JSON.stringify({ type: 'ping' }));
|
|
|
+ this.sendWsCommand({ type: 'ping' });
|
|
|
} else {
|
|
|
clearInterval(this.doConnectDirectivesIntervalerPing);
|
|
|
}
|
|
|
}, 3000);
|
|
|
|
|
|
// 输入法: 本地输入法 1 云机输入法 2
|
|
|
- this.doConnectDirectivesWs.send(JSON.stringify({ type: 'InputMethod', data: { type: 2 } }));
|
|
|
+ this.sendWsCommand({ type: 'InputMethod', data: { type: 2 } });
|
|
|
}
|
|
|
|
|
|
// 接受到的消息
|
|
@@ -734,11 +733,19 @@ export default {
|
|
|
break;
|
|
|
case 'shake':
|
|
|
// 摇一摇
|
|
|
-
|
|
|
+ if(this.sendWsCommand({ type: 'shakeit' })) {
|
|
|
+ this.$toast('操作成功,如有异常请联系客服');
|
|
|
+ } else {
|
|
|
+ this.$toast('操作失败,请联系客服');
|
|
|
+ }
|
|
|
break;
|
|
|
case 'blow':
|
|
|
// 吹一吹
|
|
|
-
|
|
|
+ if(this.sendWsCommand({ type: 'blow' })) {
|
|
|
+ this.$toast('操作成功,如有异常请联系客服');
|
|
|
+ } else {
|
|
|
+ this.$toast('操作失败,请联系客服');
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
@@ -791,6 +798,15 @@ export default {
|
|
|
}
|
|
|
uni && uni.reLaunch({ url: '/pages/index/index' });
|
|
|
},
|
|
|
+ // 发送业务指令通道消息
|
|
|
+ sendWsCommand(data) {
|
|
|
+ if(this.doConnectDirectivesWs.readyState === 1) {
|
|
|
+ this.doConnectDirectivesWs.send(JSON.stringify(data));
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ },
|
|
|
// 初始化日志上报实例
|
|
|
initLogReport() {
|
|
|
// 初始化日志上报实例
|