Commit c6493dfd authored by 罗超's avatar 罗超

优化呼叫中心

parent 7f9b08e3
......@@ -3,8 +3,8 @@
*/
import request from '../utils/request'
export function login({ Account, Password, AutoLoginId}) {
AutoLoginId=AutoLoginId?AutoLoginId:0
export function login({ Account, Password, AutoLoginId }) {
AutoLoginId = AutoLoginId ? AutoLoginId : 0
// headers: {
// 'Content-Type': 'application/json;charset=UTF-8'
// }, 申明Headers信息,不包含token ,token通过注入添加
......@@ -29,6 +29,14 @@ export function getInfo(token) {
})
}
export function getSeatNewToken() {
return request({
url: '/user/GetSeatNewToken',
method: 'post',
data: {}
})
}
export function logout() {
return request({
url: '/logout',
......
......@@ -333,6 +333,7 @@ export default {
phoneNumber: this.baseObj.StuRealMobile,
phoneDesc: this.baseObj.StuName
});
//this.closeCutomer();
},
//判断是否显示转交
getJudgeTrans() {
......
......@@ -154,6 +154,14 @@
:socekt-obj="socektArr"
@close="closeSaveForm"
></notify>
<studentRight-form
v-if="callInStu"
:isJudgeTrans="1"
:BelongType="1"
:save-obj="callInStu"
@close="closeStuForm"
>
</studentRight-form>
</q-layout>
</template>
......@@ -165,6 +173,10 @@ import notify from "../components/global/notify";
import { GetMsgLogList } from "../api/course/index";
import { sendSock } from "../api/common/socket";
import { queryStudentByTel } from "../api/users/user";
import { saveStudentFollow } from "../api/customerstudent/customerstudent";
import { getSeatNewToken } from "../api/login";
import studentRightForm from "../components/school/student/studentRight-form";
export default {
name: "MainLayout",
data() {
......@@ -191,12 +203,14 @@ export default {
isExpend: false,
IsShowLeft: true,
userCenterMenuList: [], //用户中心菜单
socektArr: [] //消息数组
socektArr: [], //消息数组
callInStu: null
};
},
components: {
userInfoBox,
notify
notify,
studentRightForm
},
watch: {
$route: {
......@@ -271,6 +285,9 @@ export default {
}
},
methods: {
closeStuForm() {
this.callInStu = null;
},
injectTCCC(token, sdkAppId, userId, sdkUrl) {
const scriptDom = document.createElement("script");
scriptDom.dataset.token = token;
......@@ -279,6 +296,112 @@ export default {
//定制是否需要在登录后展示 坐席工作台。默认为true,这里可以通过设为false关闭
scriptDom.dataset.showWorkBenchAtFirstLogin = false;
scriptDom.src = sdkUrl;
scriptDom.onload = () => {
tccc.on("ready", () => {
//tccc.UI.hide();
let that = this;
let accepted = false;
tccc.on(tccc.events.calloutAccepted, data => {
accepted = true;
});
tccc.on(tccc.events.callIn, data => {
queryStudentByTel({
StuRealMobile: data.phone.replace("0086", ""),
QQ: "",
WeChatNo: ""
}).then(r => {
if (r.Data) {
that.callInStu = r.Data;
}
});
});
tccc.on(tccc.events.sessionEnded, function(data) {
//也可以通过tccc.events枚举避免字符串typo
console.log("会话结束", data);
var msg = "";
this.callInStu = null;
queryStudentByTel({
StuRealMobile: data.phone.replace("0086", ""),
QQ: "",
WeChatNo: ""
}).then(r => {
if (r.Data) {
let stu = r.Data;
let msg = "";
if (data.direction == 1) {
//呼出
msg = `课程顾问:${that.userInfo.AccountName}呼出学员电话,`;
if (!accepted) {
msg += `学员未接听,响铃${data.duration}秒后,${
data.closeBy == "client"
? "客户拒绝"
: data.closeBy == "seat"
? "顾问放弃"
: "系统挂断"
}`;
} else {
msg += `学员未接听,响铃${data.duration}秒后,${
data.closeBy == "client"
? "客户拒绝"
: data.closeBy == "seat"
? "顾问放弃"
: "系统挂断"
}`;
}
} else {
//呼入
msg = `客户呼入电话,`;
if (!data.duration || data.duration == 0) {
msg +=
"<span class='negative'>未接听," +
(data.closeBy == "client"
? "客户放弃"
: data.closeBy == "seat"
? "顾问拒接"
: "系统挂断") +
"</span>";
} else {
msg += `<span class='negative'>已接听,通话时长:${
data.duration
}秒,由${
data.closeBy == "client"
? "客户挂断"
: data.closeBy == "seat"
? "顾问挂断"
: "系统挂断"
}<span>`;
}
}
accepted = false;
saveStudentFollow({
StuId: stu.StuId,
Remark: msg
}).then(res => {});
}
});
});
tccc.on(tccc.events.tokenExpired, data => {
getSeatNewToken().then(r => {
if (r.Data) {
that.injectTCCC(
r.Data.Token,
1400617921,
this.userInfo.Email,
r.Data.SdkURL
);
}
});
});
this.$q.notify({
type: "dark",
message: `电话服务已连接`,
position: "top"
});
});
};
document.body.appendChild(scriptDom);
},
changeLeft() {
......@@ -553,6 +676,9 @@ export default {
.wave_wrapper span.wave_scale {
animation: wave_scale 2s both infinite;
}
#tcccSdkDomRoot {
z-index: 5000;
}
@keyframes wave_scale {
0% {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment