| | |
| | | import { ref, computed, onBeforeUnmount } from 'vue' |
| | | |
| | | /** ✅ 你的 WS 地址前缀(后面拼 userId) */ |
| | | const WS_BASE = 'wss://域名/ws/chat?userId=' |
| | | const WS_BASE = 'wss://wrj.shuixiongit.com/ws/chat?userId=' |
| | | |
| | | const uid = ref('2') |
| | | const peerUid = ref('3') |
| | | const uid = ref('7') |
| | | const peerUid = ref('8') |
| | | |
| | | const connected = ref(false) |
| | | const state = ref('idle') // idle | calling | ringing | in-call |
| | |
| | | state.value = 'ringing'; |
| | | log('📞 收到来电 call,来自', incomingFrom); |
| | | |
| | | // 开始来电提示(铃声和震动) |
| | | playRingtone(); |
| | | startVibration(); |
| | | } |
| | | } catch (e) { |
| | | log('❌ 解析voiceparams参数失败:', String(e)); |
| | |
| | | if (userId) { |
| | | return userId |
| | | } |
| | | return '3' // 默认值 |
| | | return '8' // 默认值 |
| | | } |
| | | |
| | | const uid = ref('3') |
| | | const peerUid = ref('2') |
| | | const uid = ref('8') |
| | | const peerUid = ref('7') |
| | | // 联系人名称 |
| | | const contactName = ref('张三') |
| | | |
| | |
| | | } catch {} |
| | | |
| | | stopTimer() |
| | | |
| | | // 停止来电提示 |
| | | stopRingtone() |
| | | stopVibration() |
| | | if (pc) { |
| | | pc.getSenders().forEach(s => s.track && s.track.stop()) |
| | | pc.close() |
| | |
| | | const callStatus = ref(null) |
| | | |
| | | // 设置默认用户ID为3 |
| | | const defaultUserId = '3'; |
| | | const defaultUserId = '8'; |
| | | // WebSocket基础URL |
| | | const WS_BASE = 'wss://wrj.shuixiongit.com/ws/chat?userId='; |
| | | |