<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="format-detection" content="telephone=no">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no">
<style>
body { background-color: #eee;color: #555; }
button, a { display: block;margin: 20px 0;background: #00CEB9;border: none;color: #fff;line-height: 40px;width: 200px;cursor: pointer;outline: none;text-align: center; }
button:hover, a:hover { box-shadow: 0 0 5px #33CEB9; }
button:active, a:active { background: #fff;color: #00CEB9; }
input { height: 40px;outline: none;width: 300px;text-align: center;font-size: 16px;color: #00CEB9; float: left;border: 1px solid #fff; }
</style>
</head>
<body>
<a href='javascript:;' onclick='easemobim.bind({
tenantId: 16038,
dialogWidth: "500px"
})'>窗口加宽示例</a>
<a href='javascript:;' onclick='easemobim.bind({
tenantId: 16038,
emgroup: "售后"
})'>绑定技能组示例</a>
<script>
window.easemobim = window.easemobim || {};
easemobim.config = {
tenantId: '', //租户id
to: '', //指定关联对应的im号
appKey: '', //关联的appkey, appKey: 'orgName#appName'
domain: '', //环信客户互动云域, domain: '//kefu.easemob.com',
path: '', //im.html的本机服务器路径, path: '//XXX'
staticPath: '', //访客插件static的路径, staticPath: '//XXX/static'
xmppServer: '', //环信IM服务器, xmppServer: 'im-api.easemob.com'
restServer: '', //环信REST服务器, restServer: 'a1.easemob.com'
visitor: '', //访客信息
agentName: '', //指定坐席
ticket: true, //是否展示留言入口
hideStatus: false, //是否显示会话创建、接起、转接、结束等提示
/*extMsg: { //移动端点击联系客服按钮自动发送订单消息demo
"imageName": "mallImage3.png",
"type": "custom",
"msgtype": {
"order": {
"img_url": "h\n.pn",
"title": "mmm",
"desc": "mmm端午节粽子四",
"order_title":"mmm订单号:123456789012345678901234567890",
"price": "",
"item_url": "http://www.baidu.com?s=order_sn/123123"
}
}
},*/
autoConnect: false, //自动连接
buttonText: '联系客服', //设置小按钮的文案
hide: true, //是否隐藏小的悬浮按钮
resources: false, //是否启用收消息同步
dragenable: true, //是否允许拖拽, H5不支持
hideKeyboard: false, //是否隐藏H5右上角的键盘图标
dialogWidth: '400px', //聊天窗口宽度, H5不支持
dialogHeight: '500px', //聊天窗口高度, H5不支持
minimum: true, //是否允许窗口最小化, H5不支持
satisfaction: true, //是否允许访客主动发起满意度评价
soundReminder: true, //是否启用声音提醒(低版本浏览器和H5不支持)
dialogPosition: { x: '10px', y: '10px' }, //聊天窗口初始位置,坐标以视口右边距和下边距为基准, H5不支持
onmessage: function ( message ) { }, //收消息回调, 只对当前打开的聊天窗口有效
onready: function () {
//PC端点击联系客服按钮自动发送订单消息demo
/*easemobim.sendExt({ext: {
"imageName": "mallImage3.png",
"type": "custom",
"msgtype": {
"order": {
"img_url": "h\n.pn",
"title": "pc",
"desc": "pc端午节粽子四",
"order_title":"pc订单号:123456789012345678901234567890",
"price": "",
"item_url": "http://www.baidu.com?s=order_sn/123123"
}
}
}});*/
}, //聊天窗口加载成功回调
onsessionclosed: function () { }, //会话结束回调
/*
* 可集成自己的用户,如不集成,则使用上面配置的appkey创建随机访客
* 如果上面没有配置appkey,那么将使用配置的tenantId获取APP关联,使用第一个APP关联的相关信息
* 验证的方式二选一,必填,另一项为空即可
*/
user: {
username: '', //集成时必填
password: '', //password验证方式
token: '' //token验证方式
}
};
</script>
<script src='//kefu.easemob.com/webim/easemob.js'></script>
</body>
</html>