Skip to content

Commit

Permalink
CCL-2454 通话组件makeCall(number, options) 成功后设置5 秒网页电话自动摘机【智融】{前端}
Browse files Browse the repository at this point in the history
  • Loading branch information
LeLeCao committed Feb 14, 2020
1 parent 87c4578 commit 988d7d2
Show file tree
Hide file tree
Showing 11 changed files with 82,794 additions and 24 deletions.
2,631 changes: 2,630 additions & 1 deletion dist/css/callcenter-component.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/callcenter-component.css.map

Large diffs are not rendered by default.

499 changes: 498 additions & 1 deletion dist/js/call-api.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/call-api.js.map

Large diffs are not rendered by default.

79,655 changes: 79,640 additions & 15 deletions dist/js/callcenter-component.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/callcenter-component.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/js/CallInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class CallInfo extends Eventable {
this.queue_desc = '';
this.customer_phone = '';
this.phone_location = '';
this.startCallTime = 0;
this.ringingTime = 0;
this.talkingTime = 0;
this.call_type = '呼入';
Expand Down
14 changes: 12 additions & 2 deletions src/js/CallUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function makeCall(callNumber) {
return;
}
calling = true;

CallInfo.set('startCallTime', 0);
let options;
let successCallback;
let failureCallback;
Expand All @@ -42,6 +42,7 @@ export function makeCall(callNumber) {
calling = false;
}, 3000);


if (CallConfig.agent_work_state === Const.OFFLINE) {
Alert.error('离线不可以拨打电话');
utils.isFunction(failureCallback) && failureCallback(new Error('离线不可以外呼'));
Expand All @@ -60,7 +61,16 @@ export function makeCall(callNumber) {
// softPhone.call(callNumber);
// return;
//}

let startCallTimeId;
let clearStartTimeId;
clearInterval(startCallTimeId);
clearTimeout(clearStartTimeId);
startCallTimeId = setInterval(() => {
CallInfo.set('startCallTime', CallInfo.startCallTime + 1);
}, 1000);
clearStartTimeId = setTimeout(() => {
clearInterval(startCallTimeId);
}, 6000);
let params = {number: callNumber};
if (options && options.biz_id) {
params.biz_id = options.biz_id;
Expand Down
4 changes: 4 additions & 0 deletions src/js/component/RingingPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import CustomerInfo from './CustomerInfo';
import HangupButton from './HangupButton';
import images from './images';
import PropTypes from 'prop-types';
import { answer } from '../CallUtil';

export default class RingingPanelComponent extends React.Component {
constructor() {
Expand All @@ -19,6 +20,9 @@ export default class RingingPanelComponent extends React.Component {
CallInfo.on('change', this.onCallInfoChange = function() {
if (CallInfo.state === 'ringing') {
self.setState(CallInfo);
if (CallInfo.can_accept === 'in' && CallConfig.agent_work_way === VOIP_ONLINE && CallInfo.startCallTime < 6) {
answer();
}
}
});
}
Expand Down
5 changes: 4 additions & 1 deletion src/js/component/accept-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ const style = {
};

class AcceptButton extends React.Component {
handleClick = () => {
answer();
}
render() {
return <button onClick={answer} style={style}>
return <button onClick={this.handleClick} style={style}>
<img src={images.call_out}/>
</button>;
}
Expand Down
3 changes: 2 additions & 1 deletion src/js/soft-phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ class SoftPhone {
}
this._ua.stop();
}

//网页电话因为要透传一些参数,所以后端强制回拨
//此api废弃
call(target) {
let self = this;
let options = {
Expand Down

0 comments on commit 988d7d2

Please sign in to comment.