From 0179da874093db9d081f349cf21aca03dec04f88 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 09 Feb 2026 15:42:58 +0800
Subject: [PATCH] feat:接收useId
---
applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue | 61 ++++++++++--------------------
1 files changed, 20 insertions(+), 41 deletions(-)
diff --git a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
index 84fb4e7..8ad9923 100644
--- a/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
+++ b/applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
@@ -1,18 +1,6 @@
<template>
<div class="call-container" :class="{'incoming-call': state === 'ringing'} ">
<div class="content-wrapper">
- <!-- <div class="input-group">
- <div class="input-item">
- <span class="input-label">我的 userId:</span>
- <input v-model="uid" class="input-field" />
- </div>
-
- <div class="input-item">
- <span class="input-label">对方 userId:</span>
- <input v-model="peerUid" class="input-field" />
- </div>
- </div>-->
-
<div class="button-group" v-if="false">
<button @click="connectWS" :disabled="connected" class="btn btn-connect">连接WS</button>
</div>
@@ -44,18 +32,6 @@
</div>
-
- <!-- <div class="tip-message">
- <small>提示:若 getUserMedia 不可用,请用 https 或 localhost 访问页面。</small>
- </div>-->
-
- <!-- <div class="log-container">
- <div class="log-box">
- <div class="log-title">日志信息:</div>
- <pre class="log-content">{{ logText }}</pre>
- </div>
- </div>-->
-
<audio ref="remoteAudio" autoplay class="hidden-audio"></audio>
</div>
</template>
@@ -100,26 +76,30 @@
}
// 2. 同时保留原有的URL参数解析逻辑,作为备选
- const url = new URL(window.location.href);
- const paramsStr = url.searchParams.get('params');
- if (paramsStr) {
- try {
- const params = JSON.parse(decodeURIComponent(paramsStr));
- if (params.peerUid) {
- peerUid.value = String(params.peerUid);
- log('🔗 从URL参数获取peerUid:', params.peerUid);
- }
- } catch (e) {
- log('❌ 解析URL参数失败:', String(e));
- }
- }
+ // const url = new URL(window.location.href);
+ // const paramsStr = url.searchParams.get('params');
+ // if (paramsStr) {
+ // try {
+ // const params = JSON.parse(decodeURIComponent(paramsStr));
+ // if (params.peerUid) {
+ // peerUid.value = String(params.peerUid);
+ // log('🔗 从URL参数获取peerUid:', params.peerUid);
+ // }
+ // } catch (e) {
+ // log('❌ 解析URL参数失败:', String(e));
+ // }
+ // }
}
// 从URL参数或本地存储获取用户ID
const getUserIdFromStorage = () => {
+ // 从url获取用户id
+ const contact = JSON.parse(decodeURIComponent(receiveParameters.value)).userId
+ console.log('从url获取用户id',contact)
+ // 从本地获取用户id
const userId = localStorage.getItem('userId') || sessionStorage.getItem('userId')
+ console.log('从本地存储获取userId:', userId)
if (userId) {
- log('🔗 从本地存储获取userId:', userId)
return userId
}
return '3' // 默认值
@@ -556,9 +536,8 @@
callEnded.value = true
endMessage.value = '对方已挂断'
- // 延迟10秒后跳转页面
+ // 延迟5秒后跳转页面
endTimer.value = setTimeout(() => {
- log('⏰ 通话结束10秒后自动返回')
// 返回上一页(uni-app的语音通话列表页面)
if (window.uni) {
window.uni.navigateBack()
@@ -576,7 +555,7 @@
onMounted(() => {
console.log('收拾收拾',route.query.voiceparams);
- console.log('接收参数', receiveParameters.value)
+ console.log('接收参数', JSON.parse(decodeURIComponent(receiveParameters.value)))
// 解析并使用contact参数
if (receiveParameters.value) {
--
Gitblit v1.9.3