吉安感知网项目-前端
张含笑
2026-01-15 d24a1d2109d32326e628b19d4150e3ecf0755eaf
feat:语音通话更新
1 files modified
25 ■■■■■ changed files
applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue 25 ●●●●● patch | view | raw | blame | history
applications/mobile-web-view/src/appPages/voiceCallDetail/index.vue
@@ -27,7 +27,7 @@
                <strong v-if="state==='in-call'" class="status-text">通话时长:{{ durationText }}</strong>
            </div>
            <div class="button-group">
                <button  @click="requestCall" :disabled="!connected || state!=='idle'" class="btn btn-call">呼叫</button>
                <button v-if="state === 'idle' && !receiveParameters" @click="requestCall" :disabled="!connected" class="btn btn-call">呼叫</button>
                <button v-if="state==='ringing'" @click="acceptCall" class="btn btn-accept incoming-accept">接听</button>
                <button v-if="state==='ringing'" @click="rejectCall" class="btn btn-reject incoming-reject">拒绝</button>
@@ -633,16 +633,17 @@
    }
}
onMounted(() => {
console.log('收拾收拾',route.query.voiceparams);
// 定义receiveParameters变量,用于模板中判断是否显示呼叫按钮
const receiveParameters = ref(route.query.contact || null);
    const receiveParameters = route.query.contact
    console.log('接收参数', receiveParameters)
onMounted(() => {
    console.log('收拾收拾',route.query.voiceparams);
    console.log('接收参数', receiveParameters.value)
    // 解析并使用contact参数
    if (receiveParameters) {
    if (receiveParameters.value) {
        try {
            const contact = JSON.parse(decodeURIComponent(receiveParameters))
            const contact = JSON.parse(decodeURIComponent(receiveParameters.value))
            if (contact.friendId) {
                peerUid.value = contact.friendId
                log('🔗 从contact参数获取peerUid:', contact.friendId)
@@ -657,7 +658,15 @@
    parseUrlParams()
    // 自动连接WebSocket
    connectWS()
})
});
// 监听连接状态,当connected变为true且有receiveParameters时自动呼叫
watch(() => connected.value, (newVal) => {
    if (newVal && state.value === 'idle' && receiveParameters.value) {
        log('📞 连接成功且有contact参数,自动发起呼叫');
        requestCall();
    }
});
// 监听连接状态,连接成功后自动呼叫
// watch(() => connected.value, (newVal) => {