conversation.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>编辑管理员</title>
  7. <link rel="shortcut icon" href="favicon.ico">
  8. <link href="__CSS__/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  9. <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
  10. <link href="__CSS__/animate.min.css" rel="stylesheet">
  11. <link href="__JS__/layui/css/layui.css" rel="stylesheet">
  12. <link href="__CSS__/style.min.css?v=4.1.0" rel="stylesheet">
  13. </head>
  14. <body class="gray-bg">
  15. <div class="wrapper wrapper-content animated fadeInRight">
  16. <div class="row">
  17. <div class="col-sm-8">
  18. <div class="ibox float-e-margins">
  19. <div class="ibox-title">
  20. <h5>会话设置</h5>
  21. </div>
  22. <div class="ibox-content">
  23. <form class="form-horizontal m-t layui-form" id="commentForm" method="post" action="{:url('system/conversation')}">
  24. <h4 style="margin-bottom: 10px;">双方静默超时设置</h4>
  25. <div class="ibox-title">
  26. </div>
  27. <div class="form-group" style="flex-wrap: wrap; display: flex">
  28. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">在设置的时间内没有新消息产生,系统将自动关闭会话;在自动关闭前1分钟,系统会发送会话即将关闭的提示。</p>
  29. <label class="col-sm-3 control-label">超时时间:</label>
  30. <div class="input-group col-sm-1">
  31. <input type="text" class="form-control" name="overtime" required="" aria-required="true" value="{$systemconfig[0]['systemconfig_data']}">
  32. </div>
  33. <label class="control-label" style="margin-left: 20px;">秒,</label>
  34. </div>
  35. <div class="form-group" style="flex-wrap: wrap; display: flex">
  36. <label class="col-sm-3 control-label">给与提示语:</label>
  37. <div class="input-group col-sm-8">
  38. <input type="text" class="form-control" name="overtimeInfo" required="" aria-required="true" value="{$systemconfig[0]['systemconfig_content']}">
  39. </div>
  40. </div>
  41. <h4 style="margin-bottom: 10px; margin-top: 40px">无效会话关闭设置</h4>
  42. <div class="ibox-title">
  43. </div>
  44. <div class="form-group" style="flex-wrap: wrap; display: flex">
  45. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">访客开启会话框后,在设置的时间内,访客没有任何操作,系统将发出提示语并立即关闭对话。</p>
  46. <label class="col-sm-3 control-label">超时时间:</label>
  47. <div class="input-group col-sm-1">
  48. <input type="text" class="form-control" name="unoperated" required="" aria-required="true" value="{$systemconfig[1]['systemconfig_data']}">
  49. </div>
  50. <label class="control-label" style="margin-left: 20px;">秒,</label>
  51. </div>
  52. <div class="form-group" style="flex-wrap: wrap; display: flex">
  53. <label class="col-sm-3 control-label">给与提示语:</label>
  54. <div class="input-group col-sm-8">
  55. <input type="text" class="form-control" name="unoperatedInfo" required="" aria-required="true" value="{$systemconfig[1]['systemconfig_content']}">
  56. </div>
  57. </div>
  58. <h4 style="margin-bottom: 10px; margin-top: 40px">会话时长设置</h4>
  59. <div class="ibox-title">
  60. </div>
  61. <div class="form-group" style="flex-wrap: wrap; display: flex">
  62. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">设置访客进入到会话结束时的时间间隔值,作为客服的质检标准。</p>
  63. <label class="col-sm-3 control-label">标准值:</label>
  64. <div class="input-group col-sm-1">
  65. <input type="text" class="form-control" name="verifyAllTime" required="" aria-required="true" value="{$systemconfig[2]['systemconfig_data']}">
  66. </div>
  67. <label class="control-label" style="margin-left: 20px;">秒</label>
  68. </div>
  69. <h4 style="margin-bottom: 10px; margin-top: 40px">会话响应时长设置</h4>
  70. <div class="ibox-title">
  71. </div>
  72. <div class="form-group" style="flex-wrap: wrap; display: flex">
  73. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">设置访客访问到客服回复的时间间隔值,作为客服的质检标准。</p>
  74. <label class="col-sm-3 control-label">标准值:</label>
  75. <div class="input-group col-sm-1">
  76. <input type="text" class="form-control" name="verifyReturnTime" required="" aria-required="true" value="{$systemconfig[3]['systemconfig_data']}">
  77. </div>
  78. <label class="control-label" style="margin-left: 20px;">秒</label>
  79. </div>
  80. <h4 style="margin-bottom: 10px; margin-top: 40px">满意度评价回合限制</h4>
  81. <div class="ibox-title">
  82. </div>
  83. <div class="form-group" style="flex-wrap: wrap; display: flex">
  84. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">设置会话回合数后,会话聊天条数没超过设置的值时,访客端右上角评价按钮隐藏,所有系统邀评都不触发。系统消息条数不计算在内。</p>
  85. <label class="col-sm-3 control-label">起始值:</label>
  86. <div class="input-group col-sm-1" style="width: 45px">
  87. <input type="text" class="form-control" name="round" required="" aria-required="true" value="{$systemconfig[4]['systemconfig_data']}">
  88. </div>
  89. <label class="control-label" style="margin-left: 20px;">回合</label>
  90. </div>
  91. <h4 style="margin-bottom: 10px; margin-top: 40px">客服接待设置</h4>
  92. <div class="ibox-title">
  93. </div>
  94. <div class="form-group" style="flex-wrap: wrap; display: flex">
  95. <p style="width: 100%; margin-left: 20px; color: #9c9c9c; margin-bottom: 15px; font-size: 15px;">当客服服务达到上限时,顾客会进入排队等待状态。当排队人数达上限,后续不再接入顾客。</p>
  96. <label class="col-sm-3 control-label">单个客服接待人数:</label>
  97. <div class="input-group col-sm-1" style="width: 45px">
  98. <input type="text" class="form-control" name="max_service" required="" aria-required="true" value="{$systemconfig[6]['systemconfig_data']}">
  99. </div>
  100. <label class="control-label" style="margin-left: 20px;">人</label>
  101. </div>
  102. <div class="form-group" style="flex-wrap: wrap; display: flex">
  103. <label class="col-sm-3 control-label">最大排队人数上限:</label>
  104. <div class="input-group col-sm-1" style="width: 45px">
  105. <input type="text" class="form-control" name="kfConfig_maxWait" required="" aria-required="true" value="{$systemconfig[7]['systemconfig_data']}">
  106. </div>
  107. <label class="control-label" style="margin-left: 20px;">人</label>
  108. </div>
  109. <div class="form-group" style="margin-top: 40px;">
  110. <label class="col-sm-3 control-label"></label>
  111. <div class="input-group col-sm-4">
  112. <button class="btn btn-primary btn-sm" type="submit">提交</button>
  113. </div>
  114. </div>
  115. </form>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <script src="__JS__/jquery.min.js?v=2.1.4"></script>
  122. <script src="__JS__/bootstrap.min.js?v=3.3.6"></script>
  123. <script src="__JS__/content.min.js?v=1.0.0"></script>
  124. <script src="__JS__/plugins/validate/jquery.validate.min.js"></script>
  125. <script src="__JS__/plugins/validate/messages_zh.min.js"></script>
  126. <script src="__JS__/plugins/layer/layer.min.js"></script>
  127. <script src="__JS__/layui/layui.js"></script>
  128. <script src="__JS__/jquery.form.js"></script>
  129. <script src="/static/customer/js/md5.js"></script>
  130. <script type="text/javascript">
  131. let config = {
  132. socket: '{$socket}',
  133. };
  134. let date = new Date(new Date().setHours(0, 0, 0, 0)) / 1000;
  135. let getLocation = window.location.href;
  136. let host = getLocation.split('/admin')[0];
  137. //let apiToken = hex_md5('customer-service'+date+host);
  138. let apiToken = hex_md5('customer-service'+host);
  139. layui.use(['form', 'upload'], function(){
  140. var form = layui.form;
  141. var upload = layui.upload;
  142. //执行实例
  143. var uploadInst = upload.render({
  144. elem: '#up-avatar' //绑定元素
  145. ,url: "{:url('users/upAvatar')}" //上传接口
  146. ,exts: 'png|jpg|jpeg|gif'
  147. ,done: function(res){
  148. //上传完毕回调
  149. if(0 == res.code){
  150. $("#avatar").html('<img src="' + res.data.src + '" width="50px" height="50px">');
  151. $("#advertisement_img").val(res.data.src);
  152. }else{
  153. layer.msg(res.msg);
  154. }
  155. }
  156. ,error: function(){
  157. //请求异常回调
  158. }
  159. });
  160. form.on('select(group)', function(value){
  161. $("#group_id").val(value.value);
  162. });
  163. });
  164. var index = '';
  165. function showStart(){
  166. index = layer.load(0, {shade: false});
  167. return true;
  168. }
  169. function showSuccess(res){
  170. let socket = new WebSocket('ws://' + config.socket+'?apiToken=' + apiToken);
  171. socket.onopen = function(res) {
  172. console.log('握手成功');
  173. socket.send(JSON.stringify({
  174. type: 'updatecache',
  175. data: {dtype: ''},
  176. }));
  177. };
  178. layer.ready(function(){
  179. layer.close(index);
  180. if(1 == res.code){
  181. layer.alert(res.msg, {title: '友情提示', icon: 1, closeBtn: 0}, function(){
  182. window.location.href = res.data;
  183. });
  184. }else if(111 == res.code){
  185. window.location.reload();
  186. }else{
  187. layer.msg(res.msg, {anim: 6});
  188. }
  189. });
  190. }
  191. $(document).ready(function(){
  192. // 添加管理员
  193. var options = {
  194. beforeSubmit:showStart,
  195. success:showSuccess
  196. };
  197. $('#commentForm').submit(function(){
  198. $(this).ajaxSubmit(options);
  199. return false;
  200. });
  201. });
  202. // 表单验证
  203. $.validator.setDefaults({
  204. highlight: function(e) {
  205. $(e).closest(".form-group").removeClass("has-success").addClass("has-error")
  206. },
  207. success: function(e) {
  208. e.closest(".form-group").removeClass("has-error").addClass("has-success")
  209. },
  210. errorElement: "span",
  211. errorPlacement: function(e, r) {
  212. e.appendTo(r.is(":radio") || r.is(":checkbox") ? r.parent().parent().parent() : r.parent())
  213. },
  214. errorClass: "help-block m-b-none",
  215. validClass: "help-block m-b-none"
  216. });
  217. </script>
  218. </body>
  219. </html>