From 4af871597f94631e18cc03a35bedea2679e14d9f Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Fri, 27 Feb 2026 16:44:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
uniapps/work-app/src/hooks/useGlobalWS.js | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/uniapps/work-app/src/hooks/useGlobalWS.js b/uniapps/work-app/src/hooks/useGlobalWS.js
index 9a4b8f4..bdc3c91 100644
--- a/uniapps/work-app/src/hooks/useGlobalWS.js
+++ b/uniapps/work-app/src/hooks/useGlobalWS.js
@@ -2,7 +2,7 @@
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'
+import { openDialog, allowFloat, getBatteryCapacity, showIncomingCallNotification, cancelIncomingCallNotification } from '@/uni_modules/lgh-dialog'
// #endif
export function useGlobalWS() {
const userStore = useUserStore();
@@ -35,34 +35,35 @@
// 消息处理
function messageHandler(payload) {
+
// 先尝试直接处理消息(适用于mobile-web-view的voiceCallDetail页面的消息格式)
const t = (payload.type || '').toString()
callStatus.value = t
// 处理语音通话请求
if (t === 'call') {
console.log('📞 全局收到来电 call,来自', payload.from)
- // 播放铃声
- // playRingtone();
// 触发震动
- triggerVibration();
+ // triggerVibration();
// 构建来电参数
const callParams = {
peerUid: payload.from,
from: payload.from,
type: 'incoming'
};
-// #ifdef APP-PLUS
+ // #ifdef APP-PLUS
+ // 发送来电通知(锁屏/后台都会弹出 + 亮屏)
+ showIncomingCallNotification(payload.from || '未知来电')
+ // 拉起应用到前台
openDialog()
// #endif
// 转义参数以便在URL中传递
const encodedParams = encodeURIComponent(JSON.stringify(callParams));
-
try {
// 优先使用uni-app的导航API(适用于同应用内跳转)
if (typeof uni !== 'undefined' && uni.navigateTo) {
- uni.navigateTo({
- url: `/subPackages/voiceCallDetail/index?voiceparams=${encodedParams}`,
- });
+ uni.navigateTo({
+ url: `/subPackages/voiceCallDetail/index?voiceparams=${encodedParams}`,
+ });
} else {
console.error('无法跳转到语音通话页面:当前环境不支持导航');
}
--
Gitblit v1.9.3