From e00da17ae2adaecf1cdf2d5128e357a50607bc90 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Fri, 27 Feb 2026 08:40:37 +0800
Subject: [PATCH] feat: 权限获取调整

---
 uniapps/work-app/src/hooks/useGlobalWS.js |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/uniapps/work-app/src/hooks/useGlobalWS.js b/uniapps/work-app/src/hooks/useGlobalWS.js
index 36086d1..0026451 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();
@@ -27,8 +27,6 @@
     // 处理语音通话请求
     if (t === 'call') {
       console.log('📞 全局收到来电 call,来自', payload.from)
-      // 播放铃声
-      // playRingtone();
       // 触发震动
       triggerVibration();
       // 构建来电参数
@@ -37,7 +35,10 @@
         from: payload.from,
         type: 'incoming'
       };
-// #ifdef APP-PLUS
+      // #ifdef APP-PLUS
+      // 发送来电通知(锁屏/后台都会弹出 + 亮屏)
+      showIncomingCallNotification(payload.from || '未知来电')
+      // 拉起应用到前台
 			openDialog()
       // #endif
       // 转义参数以便在URL中传递
@@ -57,6 +58,12 @@
       }
       return
     }
+    // 通话接听或结束时,取消来电通知
+    if (t === 'accept' || t === 'reject' || t === 'hangup' || t === 'cancel') {
+      // #ifdef APP-PLUS
+      cancelIncomingCallNotification()
+      // #endif
+    }
   }
 
   // 播放来电铃声 - 定义在 messageHandler 外部

--
Gitblit v1.9.3