From ae0398be3a751fd928d327f40ea4e68395813f1d Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 26 Feb 2026 17:42:22 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/jagzwxm/ja_web
---
uniapps/work-app/src/hooks/useGlobalWS.js | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/uniapps/work-app/src/hooks/useGlobalWS.js b/uniapps/work-app/src/hooks/useGlobalWS.js
index f44567d..9a4b8f4 100644
--- a/uniapps/work-app/src/hooks/useGlobalWS.js
+++ b/uniapps/work-app/src/hooks/useGlobalWS.js
@@ -15,6 +15,18 @@
// 存储铃声实例
let ringtoneInstance = null
+ // 监听WebView消息事件
+ if (typeof uni !== 'undefined' && uni.$on) {
+ uni.$on('webViewMessage', (data) => {
+ console.log('📨 useGlobalWS 收到 WebView 消息:', data)
+ // 处理挂断消息
+ if (data?.type === 'hangupVoice') {
+ console.log('📞 收到挂断消息')
+ initWS()
+ }
+ });
+ }
+
// 设置默认用户ID为3
const defaultUserId = '2021474815063486465';
// WebSocket基础URL
@@ -165,6 +177,7 @@
return
}
recoverTimer = setInterval(() => {
+ // console.log('shouldRecoverWS()',shouldRecoverWS(),'----------',websocketService.getConnected())
if (shouldRecoverWS() && !websocketService.getConnected()) {
initWS()
}
@@ -172,6 +185,7 @@
}
function initWS() {
+ websocketService.close()
const userStore = useUserStore()
accessToken.value =userStore?.userInfo.access_token
if (!accessToken.value || isVoiceCallDetailActive()) {
--
Gitblit v1.9.3