|
@@ -140,22 +140,22 @@
|
|
|
:title="callStatus === 'talking' ? '发送DTMF: ' + digit : '输入: ' + digit">{{ digit }}</button>
|
|
:title="callStatus === 'talking' ? '发送DTMF: ' + digit : '输入: ' + digit">{{ digit }}</button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <!-- 呼叫按钮组 -->
|
|
|
|
|
|
|
+ <!-- 呼叫按钮组:空闲=绿色外呼;外呼振铃/通话中=中间挂断;来电振铃=左右接听/拒接;接通=左保持/中挂断/右转移 -->
|
|
|
<div class="call-buttons">
|
|
<div class="call-buttons">
|
|
|
<button class="call-button call-left-button"
|
|
<button class="call-button call-left-button"
|
|
|
- :class="{ hidden: !showLeftButton, normal: leftButtonNormal }"
|
|
|
|
|
|
|
+ :class="{ hidden: !showSideCallButtons, normal: callStatus === 'talking' && leftButtonNormal }"
|
|
|
@click="onLeftButtonClick"
|
|
@click="onLeftButtonClick"
|
|
|
:title="getLeftButtonTitle()">
|
|
:title="getLeftButtonTitle()">
|
|
|
<i class="material-icons">{{ leftButtonIcon }}</i>
|
|
<i class="material-icons">{{ leftButtonIcon }}</i>
|
|
|
</button>
|
|
</button>
|
|
|
<button class="call-button call-hangup-button"
|
|
<button class="call-button call-hangup-button"
|
|
|
- :class="[getHangupButtonClass(), { hidden: callStatus === 'ringing' }]"
|
|
|
|
|
|
|
+ :class="[getHangupButtonClass(), { hidden: !showCenterCallButton }]"
|
|
|
@click="onHangupClick"
|
|
@click="onHangupClick"
|
|
|
:title="getHangupButtonTitle()">
|
|
:title="getHangupButtonTitle()">
|
|
|
<i class="material-icons">{{ hangupButtonIcon }}</i>
|
|
<i class="material-icons">{{ hangupButtonIcon }}</i>
|
|
|
</button>
|
|
</button>
|
|
|
<button class="call-button call-right-button"
|
|
<button class="call-button call-right-button"
|
|
|
- :class="{ hidden: !showRightButton, normal: rightButtonNormal, hangup: rightButtonHangup }"
|
|
|
|
|
|
|
+ :class="{ hidden: !showSideCallButtons, normal: callStatus === 'talking' && rightButtonNormal, hangup: isIncomingRinging }"
|
|
|
@click="onRightButtonClick"
|
|
@click="onRightButtonClick"
|
|
|
:title="getRightButtonTitle()">
|
|
:title="getRightButtonTitle()">
|
|
|
<i class="material-icons">{{ rightButtonIcon }}</i>
|
|
<i class="material-icons">{{ rightButtonIcon }}</i>
|
|
@@ -340,6 +340,7 @@ export default {
|
|
|
isRegistered: false,
|
|
isRegistered: false,
|
|
|
isConnected: false,
|
|
isConnected: false,
|
|
|
callStatus: UI_STATE.IDLE,
|
|
callStatus: UI_STATE.IDLE,
|
|
|
|
|
+ isIncomingCall: false, // 振铃阶段是否为来电(非外呼)
|
|
|
incomingCaller: '', // 来电号码
|
|
incomingCaller: '', // 来电号码
|
|
|
|
|
|
|
|
// ===== 音频控制 =====
|
|
// ===== 音频控制 =====
|
|
@@ -492,8 +493,22 @@ export default {
|
|
|
if (this.fabX === null) return false;
|
|
if (this.fabX === null) return false;
|
|
|
return this.fabX + 28 < window.innerWidth / 2;
|
|
return this.fabX + 28 < window.innerWidth / 2;
|
|
|
},
|
|
},
|
|
|
|
|
+ /** 来电振铃(左右接听/拒接,隐藏中间按钮) */
|
|
|
|
|
+ isIncomingRinging() {
|
|
|
|
|
+ return this.callStatus === UI_STATE.RINGING && this.isIncomingCall;
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 中间按钮:空闲外呼 / 外呼振铃挂断 / 通话中挂断 */
|
|
|
|
|
+ showCenterCallButton() {
|
|
|
|
|
+ return this.callStatus === UI_STATE.IDLE
|
|
|
|
|
+ || (this.callStatus === UI_STATE.RINGING && !this.isIncomingCall)
|
|
|
|
|
+ || this.callStatus === UI_STATE.TALKING;
|
|
|
|
|
+ },
|
|
|
|
|
+ /** 左右侧按钮:来电振铃 或 通话中 */
|
|
|
|
|
+ showSideCallButtons() {
|
|
|
|
|
+ return this.isIncomingRinging || this.callStatus === UI_STATE.TALKING;
|
|
|
|
|
+ },
|
|
|
leftButtonIcon() {
|
|
leftButtonIcon() {
|
|
|
- if (this.callStatus === 'ringing') return 'phone';
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) return 'phone';
|
|
|
if (this.callStatus === 'talking') {
|
|
if (this.callStatus === 'talking') {
|
|
|
if (this.ccPhoneBar && this.ccSocketConnected) {
|
|
if (this.ccPhoneBar && this.ccSocketConnected) {
|
|
|
return this.isOnHold ? 'play_arrow' : 'pause';
|
|
return this.isOnHold ? 'play_arrow' : 'pause';
|
|
@@ -503,7 +518,7 @@ export default {
|
|
|
return '';
|
|
return '';
|
|
|
},
|
|
},
|
|
|
rightButtonIcon() {
|
|
rightButtonIcon() {
|
|
|
- if (this.callStatus === 'ringing') return 'call_end';
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) return 'call_end';
|
|
|
if (this.callStatus === 'talking') return 'call_split';
|
|
if (this.callStatus === 'talking') return 'call_split';
|
|
|
return '';
|
|
return '';
|
|
|
}
|
|
}
|
|
@@ -880,7 +895,7 @@ export default {
|
|
|
|
|
|
|
|
// ==================== UI事件 ====================
|
|
// ==================== UI事件 ====================
|
|
|
getLeftButtonTitle() {
|
|
getLeftButtonTitle() {
|
|
|
- if (this.callStatus === 'ringing') return '接听来电';
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) return '接听来电';
|
|
|
if (this.callStatus === 'talking') return this.isOnHold ? '恢复通话' : '保持通话';
|
|
if (this.callStatus === 'talking') return this.isOnHold ? '恢复通话' : '保持通话';
|
|
|
return '';
|
|
return '';
|
|
|
},
|
|
},
|
|
@@ -892,7 +907,7 @@ export default {
|
|
|
return '未就绪';
|
|
return '未就绪';
|
|
|
},
|
|
},
|
|
|
getRightButtonTitle() {
|
|
getRightButtonTitle() {
|
|
|
- if (this.callStatus === 'ringing') return '拒绝来电';
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) return '拒绝来电';
|
|
|
if (this.callStatus === 'talking') return '呼叫转移';
|
|
if (this.callStatus === 'talking') return '呼叫转移';
|
|
|
return '';
|
|
return '';
|
|
|
},
|
|
},
|
|
@@ -1095,6 +1110,10 @@ export default {
|
|
|
if (!this.ccSocketConnected && this.ccConnectingReject) this.ccConnectingReject(new Error('服务器错误'));
|
|
if (!this.ccSocketConnected && this.ccConnectingReject) this.ccConnectingReject(new Error('服务器错误'));
|
|
|
});
|
|
});
|
|
|
this.ccPhoneBar.on(EventList.OUTBOUND_START, (msg) => {
|
|
this.ccPhoneBar.on(EventList.OUTBOUND_START, (msg) => {
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
|
|
+ this.callStatus = UI_STATE.RINGING;
|
|
|
|
|
+ this.showLeftButton = false;
|
|
|
|
|
+ this.showRightButton = false;
|
|
|
this.showStatus('拨号中...', 'info');
|
|
this.showStatus('拨号中...', 'info');
|
|
|
if (msg?.object?.uuid) {
|
|
if (msg?.object?.uuid) {
|
|
|
this.currentCallUuid = msg.object.uuid;
|
|
this.currentCallUuid = msg.object.uuid;
|
|
@@ -1102,7 +1121,10 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
this.ccPhoneBar.on(EventList.CALLEE_RINGING, () => {
|
|
this.ccPhoneBar.on(EventList.CALLEE_RINGING, () => {
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
this.callStatus = UI_STATE.RINGING;
|
|
this.callStatus = UI_STATE.RINGING;
|
|
|
|
|
+ this.showLeftButton = false;
|
|
|
|
|
+ this.showRightButton = false;
|
|
|
this.showStatus('振铃中...', 'info');
|
|
this.showStatus('振铃中...', 'info');
|
|
|
if (this.currentCallUuid && this.callUuidMap[this.currentCallUuid]) {
|
|
if (this.currentCallUuid && this.callUuidMap[this.currentCallUuid]) {
|
|
|
this.callUuidMap[this.currentCallUuid].status = 'ringing';
|
|
this.callUuidMap[this.currentCallUuid].status = 'ringing';
|
|
@@ -1123,6 +1145,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
this.callStatus = UI_STATE.TALKING;
|
|
this.callStatus = UI_STATE.TALKING;
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
this.showLeftButton = true;
|
|
this.showLeftButton = true;
|
|
|
this.showRightButton = true;
|
|
this.showRightButton = true;
|
|
|
this.leftButtonNormal = true;
|
|
this.leftButtonNormal = true;
|
|
@@ -1309,6 +1332,7 @@ export default {
|
|
|
},
|
|
},
|
|
|
onRing(event) {
|
|
onRing(event) {
|
|
|
if (!event.outgoing) {
|
|
if (!event.outgoing) {
|
|
|
|
|
+ this.isIncomingCall = true;
|
|
|
this.incomingJsipCall = true;
|
|
this.incomingJsipCall = true;
|
|
|
this.incomingCaller = event.caller || '';
|
|
this.incomingCaller = event.caller || '';
|
|
|
this.callStatus = UI_STATE.RINGING;
|
|
this.callStatus = UI_STATE.RINGING;
|
|
@@ -1323,6 +1347,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onAnswered() {
|
|
onAnswered() {
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
this.callStatus = UI_STATE.TALKING;
|
|
this.callStatus = UI_STATE.TALKING;
|
|
|
this.showLeftButton = true;
|
|
this.showLeftButton = true;
|
|
|
this.showRightButton = true;
|
|
this.showRightButton = true;
|
|
@@ -1334,6 +1359,7 @@ export default {
|
|
|
_resetCallState() {
|
|
_resetCallState() {
|
|
|
if (this.callStatus !== UI_STATE.IDLE) {
|
|
if (this.callStatus !== UI_STATE.IDLE) {
|
|
|
this.callStatus = UI_STATE.IDLE;
|
|
this.callStatus = UI_STATE.IDLE;
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
this.isOnHold = false;
|
|
this.isOnHold = false;
|
|
|
this.province = '';
|
|
this.province = '';
|
|
|
this.callDuration = '00:00';
|
|
this.callDuration = '00:00';
|
|
@@ -1363,15 +1389,18 @@ export default {
|
|
|
onCallTimer(time) { this.callDuration = time; },
|
|
onCallTimer(time) { this.callDuration = time; },
|
|
|
|
|
|
|
|
// ==================== 弹窗通话状态同步 ====================
|
|
// ==================== 弹窗通话状态同步 ====================
|
|
|
- onDialogCallRinging() {
|
|
|
|
|
|
|
+ onDialogCallRinging(payload) {
|
|
|
|
|
+ const incoming = !!(payload && payload.incoming);
|
|
|
|
|
+ this.isIncomingCall = incoming;
|
|
|
this.callStatus = UI_STATE.RINGING;
|
|
this.callStatus = UI_STATE.RINGING;
|
|
|
- this.showLeftButton = true;
|
|
|
|
|
- this.showRightButton = true;
|
|
|
|
|
- this.rightButtonHangup = true;
|
|
|
|
|
- this.delegatedCallActive = true; // 来电由弹窗phoneBar处理,标记为委托通话
|
|
|
|
|
- this.showStatus('振铃中...', 'info');
|
|
|
|
|
|
|
+ this.showLeftButton = incoming;
|
|
|
|
|
+ this.showRightButton = incoming;
|
|
|
|
|
+ this.rightButtonHangup = incoming;
|
|
|
|
|
+ this.delegatedCallActive = true;
|
|
|
|
|
+ this.showStatus(incoming ? '来电振铃中...' : '振铃中...', 'info');
|
|
|
},
|
|
},
|
|
|
onDialogCallTalking() {
|
|
onDialogCallTalking() {
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
this.callStatus = UI_STATE.TALKING;
|
|
this.callStatus = UI_STATE.TALKING;
|
|
|
this.showLeftButton = true;
|
|
this.showLeftButton = true;
|
|
|
this.showRightButton = true;
|
|
this.showRightButton = true;
|
|
@@ -1414,6 +1443,10 @@ export default {
|
|
|
if (window.__floatingPhoneCallDelegateActive) {
|
|
if (window.__floatingPhoneCallDelegateActive) {
|
|
|
this.$root.$emit('floating-softphone-call-triggered', phoneNumber);
|
|
this.$root.$emit('floating-softphone-call-triggered', phoneNumber);
|
|
|
this.delegatedCallActive = true;
|
|
this.delegatedCallActive = true;
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
|
|
+ this.callStatus = UI_STATE.RINGING;
|
|
|
|
|
+ this.showLeftButton = false;
|
|
|
|
|
+ this.showRightButton = false;
|
|
|
this.showStatus('拨号中...', 'info');
|
|
this.showStatus('拨号中...', 'info');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1421,6 +1454,10 @@ export default {
|
|
|
// 普通页面:使用浮动软电话自身的 ccPhoneBar 直接外呼
|
|
// 普通页面:使用浮动软电话自身的 ccPhoneBar 直接外呼
|
|
|
try {
|
|
try {
|
|
|
this.delegatedCallActive = false;
|
|
this.delegatedCallActive = false;
|
|
|
|
|
+ this.isIncomingCall = false;
|
|
|
|
|
+ this.callStatus = UI_STATE.RINGING;
|
|
|
|
|
+ this.showLeftButton = false;
|
|
|
|
|
+ this.showRightButton = false;
|
|
|
this.ccPhoneBar.call(phoneNumber, 'audio', VideoLevels.HD.levelId);
|
|
this.ccPhoneBar.call(phoneNumber, 'audio', VideoLevels.HD.levelId);
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
console.error('[FloatingSoftPhone] 外呼失败:', err);
|
|
console.error('[FloatingSoftPhone] 外呼失败:', err);
|
|
@@ -1467,7 +1504,7 @@ export default {
|
|
|
else this.makeCall();
|
|
else this.makeCall();
|
|
|
},
|
|
},
|
|
|
onLeftButtonClick() {
|
|
onLeftButtonClick() {
|
|
|
- if (this.callStatus === UI_STATE.RINGING) {
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) {
|
|
|
if (this.phone) this.phone.Answer();
|
|
if (this.phone) this.phone.Answer();
|
|
|
} else if (this.callStatus === UI_STATE.TALKING) {
|
|
} else if (this.callStatus === UI_STATE.TALKING) {
|
|
|
// 委托通话时,通知弹窗执行保持/恢复
|
|
// 委托通话时,通知弹窗执行保持/恢复
|
|
@@ -1484,7 +1521,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onRightButtonClick() {
|
|
onRightButtonClick() {
|
|
|
- if (this.callStatus === UI_STATE.RINGING) this.endCall();
|
|
|
|
|
|
|
+ if (this.isIncomingRinging) this.endCall();
|
|
|
else if (this.callStatus === UI_STATE.TALKING) this.showStatus('呼叫转移功能暂未实现', 'info');
|
|
else if (this.callStatus === UI_STATE.TALKING) this.showStatus('呼叫转移功能暂未实现', 'info');
|
|
|
},
|
|
},
|
|
|
|
|
|