diff --git a/src/api/socket.js b/src/api/socket.js index 0869f8d8..2b304f90 100644 --- a/src/api/socket.js +++ b/src/api/socket.js @@ -86,7 +86,7 @@ export default class WebSocketUtil { // console.log('WebSocket连接已关闭', res); clearInterval(this.heartbeatTimer); // 清除心跳计时器 this.triggerEvent('close', res); // 触发连接关闭事件 - this.tryReconnect(); // 尝试重连 + // this.tryReconnect(); // 尝试重连 }); // 监听WebSocket错误事件 @@ -106,7 +106,7 @@ export default class WebSocketUtil { */ on(event, callback) { if (this.callbacks[event]) { - this.callbacks[event].push(callback); + this.callbacks[event] = [callback]; } return this; } diff --git a/src/pages.json b/src/pages.json index 62ee516d..8493c7fb 100644 --- a/src/pages.json +++ b/src/pages.json @@ -589,6 +589,7 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", "navigationStyle": "custom", + "screenOrientation": "portrait", "app-plus": { "titleView": false, "bounce": "none", diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 4d0f6bc4..c5bdba65 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -791,6 +791,9 @@ initsocketTask(); }; onLoad(() => { + //#ifdef APP-PLUS + plus.screen.lockOrientation('portrait-primary') + // #endif changeAppHeightBottom(); if (!common.isLogin()) { common.navigateTo('/pages/login/login'); diff --git a/src/pages/sparring/tip.vue b/src/pages/sparring/tip.vue index d17f119b..6526e28a 100644 --- a/src/pages/sparring/tip.vue +++ b/src/pages/sparring/tip.vue @@ -104,6 +104,7 @@ onShow, onLoad, onUnload, + onLaunch, onBackPress } from '@dcloudio/uni-app'; import common from '@/common/common'; @@ -311,6 +312,7 @@ let _id = new Date().getTime() + 'id'; if (rtnCode === '0000') { if (commond === 'ASK-OPEN') { + console.log('ASK-OPEN!',body) // 新连接 sendMessage({ commond: 'ASK-START', @@ -324,7 +326,7 @@ return; } if (commond === 'ASK-START') { - // console.log('开启对话!') + console.log('开启对话!',body) execId.value = body.execId; return; } @@ -477,8 +479,13 @@ talkingType.value = params.type; isPreview.value = params.isPreview === '1' getDetailInfo() + console.log('onLoad') + //#ifdef APP-PLUS + plus.screen.lockOrientation('portrait-primary') + // #endif }); onUnload(() => { + console.log('onUnload') watchFlag.value = 1; sendMessage({ commond: 'ASK-STOP', @@ -487,7 +494,11 @@ } }) socketStore?.closeSocket(); + execId.value = '' }); + onLaunch(() => { + console.log('onLaunch') + }) onMounted(() => { // getDetailInfo() }) diff --git a/src/pagesOther.json b/src/pagesOther.json index 3b5f6d23..26d99725 100644 --- a/src/pagesOther.json +++ b/src/pagesOther.json @@ -103,6 +103,7 @@ "navigationBarBackgroundColor": "#F8F8F8", "backgroundColor": "#F8F8F8", "navigationStyle": "custom", + "screenOrientation": "portrait", "app-plus": { "titleView": false, "bounce": "none",