From 057bcf202227150ca64c615751c5ea8c79687b18 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Thu, 26 Feb 2026 11:11:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 uniapps/work-app/src/hooks/useGlobalWS.js |   90 +++++++++++++++++++++++----------------------
 1 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/uniapps/work-app/src/hooks/useGlobalWS.js b/uniapps/work-app/src/hooks/useGlobalWS.js
index 3173f88..36086d1 100644
--- a/uniapps/work-app/src/hooks/useGlobalWS.js
+++ b/uniapps/work-app/src/hooks/useGlobalWS.js
@@ -1,8 +1,9 @@
 import { useUserStore } from "@/store/index.js";
 import useAppStore from "../store/modules/app/index.js";
 import websocketService from "@/utils/websocket.js";
+// #ifdef APP-PLUS
 import { openDialog, allowFloat, getBatteryCapacity } from '@/uni_modules/lgh-dialog'
-
+// #endif
 export function useGlobalWS() {
 	const userStore = useUserStore();
   const appStore = useAppStore();
@@ -27,7 +28,7 @@
     if (t === 'call') {
       console.log('📞 全局收到来电 call,来自', payload.from)
       // 播放铃声
-      playRingtone();
+      // playRingtone();
       // 触发震动
       triggerVibration();
       // 构建来电参数
@@ -36,8 +37,9 @@
         from: payload.from,
         type: 'incoming'
       };
-
+// #ifdef APP-PLUS
 			openDialog()
+      // #endif
       // 转义参数以便在URL中传递
       const encodedParams = encodeURIComponent(JSON.stringify(callParams));
 
@@ -58,21 +60,21 @@
   }
 
   // 播放来电铃声 - 定义在 messageHandler 外部
-  function playRingtone() {
-    try {
-      if (typeof uni !== 'undefined' && uni.createInnerAudioContext) {
-        const ringtone = uni.createInnerAudioContext();
-        // 使用默认铃声,注意路径写法
-        ringtone.src = '/static/audio/ringtone.mp3';
-        ringtone.loop = true;
-        ringtone.volume = 0.8;
-        ringtone.play();
-        // 存储铃声实例
-        ringtoneInstance = ringtone; // 使用局部变量而不是window
-      }
-    } catch (error) {
-    }
-  }
+  // function playRingtone() {
+  //   try {
+  //     if (typeof uni !== 'undefined' && uni.createInnerAudioContext) {
+  //       const ringtone = uni.createInnerAudioContext();
+  //       // 使用默认铃声,注意路径写法
+  //       ringtone.src = '/static/audio/ringtone.mp3';
+  //       ringtone.loop = true;
+  //       ringtone.volume = 0.8;
+  //       ringtone.play();
+  //       // 存储铃声实例
+  //       ringtoneInstance = ringtone; // 使用局部变量而不是window
+  //     }
+  //   } catch (error) {
+  //   }
+  // }
 
   // 触发震动
   function triggerVibration() {
@@ -113,32 +115,32 @@
   }
 
   // 停止铃声
-  function stopRingtone() {
-    try {
-      if (ringtoneInstance) {
-        ringtoneInstance.stop();
-        ringtoneInstance.destroy();
-        ringtoneInstance = null;
-      }
-    } catch (error) {
-      // 即使出错也重置实例
-      ringtoneInstance = null;
-    }
-  }
-
-  // 监听停止铃声事件
-  if (typeof uni !== 'undefined' && uni.$on) {
-    uni.$on('stopRingtone', stopRingtone);
-    // 监听WebView消息事件
-    uni.$on('webViewMessage', (data) => {
-      // 检查是否是停止铃声消息
-      if (data?.type === 'stopVoice') {
-        stopRingtone();
-        console.log('📳 收到WebView停止铃声消息,已停止铃声');
-
-      }
-    });
-  }
+  // function stopRingtone() {
+  //   try {
+  //     if (ringtoneInstance) {
+  //       ringtoneInstance.stop();
+  //       ringtoneInstance.destroy();
+  //       ringtoneInstance = null;
+  //     }
+  //   } catch (error) {
+  //     // 即使出错也重置实例
+  //     ringtoneInstance = null;
+  //   }
+  // }
+  //
+  // // 监听停止铃声事件
+  // if (typeof uni !== 'undefined' && uni.$on) {
+  //   uni.$on('stopRingtone', stopRingtone);
+  //   // 监听WebView消息事件
+  //   uni.$on('webViewMessage', (data) => {
+  //     // 检查是否是停止铃声消息
+  //     if (data?.type === 'stopVoice') {
+  //       stopRingtone();
+  //       console.log('📳 收到WebView停止铃声消息,已停止铃声');
+  //
+  //     }
+  //   });
+  // }
 
   // 初始化WebSocket连接
   function initWS() {

--
Gitblit v1.9.3