|
| 1 | + |
| 2 | +<!doctype html> |
| 3 | +<html> |
| 4 | +<head> |
| 5 | + <meta charset="utf-8"> |
| 6 | + <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> |
| 7 | + <meta name="format-detection" content="telephone=no"> |
| 8 | + <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no"> |
| 9 | + <style> |
| 10 | + body { background-color: #eee;color: #555; } |
| 11 | + 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; } |
| 12 | + button:hover, a:hover { box-shadow: 0 0 5px #33CEB9; } |
| 13 | + button:active, a:active { background: #fff;color: #00CEB9; } |
| 14 | + input { height: 40px;outline: none;width: 300px;text-align: center;font-size: 16px;color: #00CEB9; float: left;border: 1px solid #fff; } |
| 15 | + </style> |
| 16 | +</head> |
| 17 | + |
| 18 | +<body> |
| 19 | + |
| 20 | + <h1>Demo</h1> |
| 21 | + <a target='_blank' href='http://docs.easemob.com/cs/300visitoraccess/20webplugin'>集成文档</a> |
| 22 | + <h1>测试</h1> |
| 23 | + <br> |
| 24 | + <div> |
| 25 | + <input id='testvalue' type='text' placeholder='请输入您的tenantId'/><br><br> |
| 26 | + |
| 27 | + <a id='test'>联系客服</a> |
| 28 | + </div> |
| 29 | + |
| 30 | + <button onclick="launchWebim()" class="custom-button">启动网页插件并发送订单消息</button> |
| 31 | + <button onclick="launchConfigId()" class="custom-button">启动configId网页插件配置</button> |
| 32 | + <button onclick="sendCrmExtendMessage()" class="custom-button">主动发送crm扩展消息</button> |
| 33 | + <button onclick="sendOrderExtendMessage()" class="custom-button">主动发送订单消息</button> |
| 34 | + <button onclick="sendTraceExtendMessage()" class="custom-button">主动发送轨迹消息</button> |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +<script> |
| 40 | + var v = document.getElementById('testvalue'); |
| 41 | + v.value = localStorage.getItem('easemobtest') || ''; |
| 42 | + document.getElementById('test').onclick = function () { |
| 43 | + if (/\d+/.test(v.value)) { |
| 44 | + localStorage.setItem('easemobtest', v.value); |
| 45 | + easemobim.bind({ tenantId: v.value.replace(/\s/g, '') }) |
| 46 | + } |
| 47 | + }; |
| 48 | +</script> |
| 49 | +<script> |
| 50 | + window.easemobim = window.easemobim || {}; |
| 51 | + |
| 52 | + easemobim.config = { |
| 53 | + // tenantId: '11884', |
| 54 | + // configId:'917a24a9-4e78-444b-b563-7533cb2e0755', |
| 55 | + // configId: 'a9b466b3-03c9-4467-8a28-a342035e6d42', |
| 56 | + // configId: "d316910b-7846-42ea-b5be-5df1a95cf9a7", |
| 57 | + // configId: "ea5aa579-1080-43b9-8ec3-f163db1170d0", |
| 58 | + // domain: '//kefu.easemob.com', |
| 59 | + // emgroup:'根据首次接待匹配会话分配策略', |
| 60 | + // domain: '//grey.sandbox.kefu.easemob.com', |
| 61 | + // path: '//172.17.2.128:8008/webim', //im.html的本机服务器路径, path: '//XXX/webim' |
| 62 | + // staticPath: '//172.17.2.128:8008/webim/static', //访客插件static的路径, staticPath: '//XXX/webim/static' |
| 63 | + domain: '//sandbox.kefu.easemob.com', |
| 64 | + // visitor: { |
| 65 | + // tags:["vip1"] |
| 66 | + // }, |
| 67 | + // 隐藏默认的联系客服按钮,使用自定义按钮 |
| 68 | + // hide: false, |
| 69 | + titleSlide: false, |
| 70 | + // emgroup: 'shouqian', |
| 71 | + // eventCollector: true, |
| 72 | + // user: { |
| 73 | + // username: '分分钟', //集成时必填,vip5:414vip5visitor_01 vip1:414test1visitor_01,02,03 |
| 74 | + // // password: '1', //password验证方式 |
| 75 | + // //token: 'YWMtl2twnEm0EeahzLvd5EXZoAAAAVceHgVoTXLfbOBQ-TzykmQIuhQUYaampMg' //token验证方式 |
| 76 | + // }, |
| 77 | + |
| 78 | + }; |
| 79 | +</script> |
| 80 | + |
| 81 | + |
| 82 | +<script> |
| 83 | +function launchWebim(){ |
| 84 | + easemobim.bind(); |
| 85 | + sendOrderExtendMessage(); |
| 86 | +} |
| 87 | + |
| 88 | +function launchConfigId(){ |
| 89 | + easemobim.bind({ |
| 90 | + configId: "d316910b-7846-42ea-b5be-5df1a95cf9a7" |
| 91 | + }); |
| 92 | +} |
| 93 | + |
| 94 | +function sendCrmExtendMessage(){ |
| 95 | + easemobim.sendExt({ |
| 96 | + ext: { |
| 97 | + cmd: { |
| 98 | + updateVisitorInfoSrc: { |
| 99 | + params: { |
| 100 | + customUserId: "6666", |
| 101 | + name: "李继鹏", |
| 102 | + age: "18", |
| 103 | + sex: "女" |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | + }); |
| 109 | +} |
| 110 | + |
| 111 | +function sendOrderExtendMessage(){ |
| 112 | + easemobim.sendExt({ |
| 113 | + ext: { |
| 114 | + imageName: "mallImage3.png", |
| 115 | + type: "custom", |
| 116 | + msgtype: { |
| 117 | + order: { |
| 118 | + title: "我现在正在看:这个商品", |
| 119 | + price: "¥: 199.00", |
| 120 | + desc: "其他商品", |
| 121 | + order_title: "pc订单号:123456789012345678901234567890", |
| 122 | + img_url: "http://sandbox.kefu.easemob.com/images/uikit/default_agent.png", |
| 123 | + item_url: "http://sandbox.kefu.easemob.com/v1/Tenants/11699/robot/article/html/99eda4eb-5b36-42bf-9cba-579166b396ae" |
| 124 | + } |
| 125 | + } |
| 126 | + } |
| 127 | + }); |
| 128 | +} |
| 129 | + |
| 130 | +function sendTraceExtendMessage(){ |
| 131 | + easemobim.sendExt({ |
| 132 | + ext: { |
| 133 | + imageName: "mallImage3.png", |
| 134 | + type: "custom", |
| 135 | + msgtype: { |
| 136 | + track: { |
| 137 | + title: "我正在看:", |
| 138 | + price: "¥: 235.00", |
| 139 | + desc: "女装小香风气质蕾丝假两件短袖", |
| 140 | + img_url: "http://sandbox.kefu.easemob.com/images/uikit/default_agent.png", |
| 141 | + item_url: "http://sandbox.kefu.easemob.com/v1/Tenants/11699/robot/article/html/99eda4eb-5b36-42bf-9cba-579166b396ae" |
| 142 | + } |
| 143 | + } |
| 144 | + } |
| 145 | + }); |
| 146 | +} |
| 147 | + |
| 148 | + |
| 149 | +</script> |
| 150 | + |
| 151 | + |
| 152 | +<!-- <script src='//kefu.easemob.com/webim/easemob.js'></script> --> |
| 153 | +<!-- <script src='//sandbox.kefu.easemob.com/webim/en-US/easemob.js'></script> --> |
| 154 | +<!-- <script src='//grey.sandbox.kefu.easemob.com/webim/easemob.js'></script> --> |
| 155 | +<script src='//sandbox.kefu.easemob.com/webim/easemob.js'></script> |
| 156 | +<!-- <script src="easemob.js"></script> --> |
| 157 | +<!-- <script src='//172.17.2.128:8008/webim/easemob.js'></script> --> |
| 158 | + |
| 159 | +</body> |
| 160 | +</html> |
0 commit comments