接入在线客服
授权用户
在进入页面前,需通过api授权用户
嵌入页面
<iframe src="${domain}/${token}?leftclose=1&rightclose=1"></iframe>- domain为租户绑定的域名
- token为api授权时提供的token
- leftclose是否显示左侧返回图标,1表示显示,其他不显示
- rightclose是否显示右侧返回图标,1表示显示,其他不显示
监听关闭事件
用户点击客服页面的返回按钮时,会通过postMessage向调用页面发送customer-service-close消息,如:
if (window.parent) {
window.parent.postMessage({ type: 'customer-service-close' }, '*')
}调用页面可监听message消息
window.addEventListener('message', event => {
if(event && event.data && event.data.type==='customer-service-close'){
// 处理关闭逻辑
}
})引用插件
也可以引入reed-ui组件库,并使用客服组件
<reed-chat-room room-type="customer-service" :back="">
</reed-chat-room>room-type固定为customer-serviceback为返回事件监听
添加客服人员
- 进入后台
- 注册一个普通用户
- 以租户管理员的账号登录后台
- 进入【客服】|【人员】新增
- 在【用户】栏输入第2步注册的用户账号
- 保存