| | |
| | | this.isRegistered = false; // 新增注册状态标志 |
| | | this.registrationTime = null; // 新增注册成功时间戳 |
| | | this.currentConfig = null; // 存储当前配置 |
| | | this.isManualEnd = false; |
| | | } |
| | | // 获取医院配置方法 |
| | | getHospitalConfig() { |
| | |
| | | makeCall(targetNumber) { |
| | | const { canCall, reason } = this.canMakeCall(); |
| | | if (!canCall) { |
| | | Message.error(reason); |
| | | Message.info(reason); |
| | | return Promise.reject(new Error(reason)); |
| | | } |
| | | return new Promise((resolve, reject) => { |
| | |
| | | eventHandlers: { |
| | | progress: () => this.updateCallStatus("calling", "呼叫中..."), |
| | | failed: (e) => { |
| | | if (this.isManualEnd) { |
| | | console.log("主动挂断,忽略失败事件"); |
| | | return; |
| | | } |
| | | this.handleCallFailure(e, reject); |
| | | }, |
| | | ended: () => this.updateCallStatus("ended", "通话结束"), |
| | |
| | | |
| | | endCall() { |
| | | if (this.currentSession) { |
| | | this.isManualEnd = true; |
| | | this.currentSession.terminate(); |
| | | this.updateCallStatus("ended", "通话已结束"); |
| | | this.updateCallStatus('ended', '通话已结束'); |
| | | this.currentSession = null; |
| | | // 延迟重置标志,避免影响后续事件 |
| | | setTimeout(() => { this.isManualEnd = false; }, 100); |
| | | } |
| | | } |
| | | |