From e4439e5d0a2cba9983f013bd044fe4e22c7b7077 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Wed, 11 Feb 2026 16:35:06 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue | 45 +++++++++++++++++++++++++++++++++++----------
1 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
index 6a2134c..ec529b9 100644
--- a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
+++ b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
@@ -41,8 +41,8 @@
import defaultAvatar from '@/appDataSource/appwork/defaultAvatar.svg'
const route = useRoute()
/** ✅ 你的 WS 地址前缀(后面拼 userId) */
-const WS_BASE = 'wss://wrj.shuixiongit.com/ws/chat?userId='
-
+// const WS_BASE = 'ws://218.202.104.82:38201/ws/chat?userId='
+const WS_BASE = 'ws://218.202.104.82:38201/ws/chat'
// 解析URL参数
const parseUrlParams = () => {
// 1. 优先从route.query.voiceparams获取参数
@@ -105,11 +105,11 @@
if (userId) {
return userId
}
- return '8' // 默认值
+ return '3' // 默认值
}
-const uid = ref('8')
-const peerUid = ref('7')
+const uid = ref('3')
+const peerUid = ref('2')
// 联系人名称
const contactName = ref('张三')
@@ -121,6 +121,8 @@
const callEnded = ref(false)
const endMessage = ref('对方已挂断')
const endTimer = ref(null)
+// token 存储
+const accessToken = ref('')
let ws = null
let pc = null
@@ -227,7 +229,17 @@
}
try {
- localStream = await navigator.mediaDevices.getUserMedia({ audio: true })
+ localStream = await navigator.mediaDevices.getUserMedia({
+ audio: {
+ echoCancellation: true,
+ noiseSuppression: true,
+ autoGainControl: true,
+ // 移动端特定配置
+ channelCount: 1,
+ sampleRate: 16000,
+ sampleSize: 16
+ }
+ })
log('✅ 已获取本地麦克风')
return localStream
} catch (e) {
@@ -378,8 +390,10 @@
if (ws) ws.close()
- ws = new WebSocket(WS_BASE + encodeURIComponent(uid.value))
-
+ // 使用从参数中获取的token或默认token
+ const token = accessToken.value
+ // ws = new WebSocket(WS_BASE + encodeURIComponent(uid.value))
+ ws = new WebSocket(WS_BASE, token)
ws.onopen = () => {
connected.value = true
log('WS 已连接 userId=', uid.value)
@@ -558,8 +572,19 @@
onMounted(() => {
console.log('收拾收拾',route.query.voiceparams);
- console.log('接收参数', JSON.parse(decodeURIComponent(receiveParameters.value)))
-
+ console.log('接收参数', receiveParameters)
+ if (route.query && route.query.params) {
+ try {
+ const params = JSON.parse(decodeURIComponent(route.query.params));
+ // 获取token
+ if (params.access_token) {
+ accessToken.value = params.access_token;
+ log('🔗 从params获取access_token:', accessToken.value);
+ }
+ } catch (e) {
+ log('❌ 解析params参数失败:', String(e));
+ }
+ }
// 解析并使用contact参数
if (receiveParameters.value) {
try {
--
Gitblit v1.9.3