美洽客服:美洽在线客服绑定独立域名的源码教程 美洽JavaScript 网页插件

2024-03-14 338 0

经常都有客户在问我们机长,怎么弄一个全屏的弹窗客服代码

下面分享一个关于美洽在线客服的html代码,可以参考一下


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible " content="IE=edge" />
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <title>在线咨询</title>
  <style>
    html,
    body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0
    }
  </style>
</head>
<body>
  <script type="text/javascript">
    function parse(query) {
      var qs = {};
      var i = query.indexOf('?');
      if (i < 0 && query.indexOf('=') < 0) {
        return qs;
      } else if (i >= 0) {
        query = query.substring(i + 1);
      }
      var parts = query.split('&');
      for (var n = 0; n < parts.length; n++) {
        var part = parts[n];
        var key = part.split('=')[0];
        var val = part.split('=')[1];
        key = key.toLowerCase();
        if (typeof qs[key] === 'undefined') {
          qs[key] = decodeURIComponent(val);
        } else if (typeof qs[key] === 'string') {
          var arr = [qs[key], decodeURIComponent(val)];
          qs[key] = arr;
        } else {
          qs[key].push(decodeURIComponent(val));
        }
      }
      return qs;
    }
    function init() {
      (function (m, ei, q, i, a, j, s) {
        m[i] =
          m[i] ||
          function () {
            (m[i].a = m[i].a || []).push(arguments);
          };
        (j = ei.createElement(q)), (s = ei.getElementsByTagName(q)[0]);
        j.async = true;
        j.charset = 'UTF-8';
        j.src = 'https://static.meiqia.com/widget/loader.js';
        s.parentNode.insertBefore(j, s);
      })(window, document, 'script', '_MEIQIA');
      var data = parse(window.location.search);
      var entId = data.entid || data.eid;
      if (Object.prototype.toString.call(entId) === '[object Array]') {
        entId = +entId[0];
      } else {
        entId = +entId;
      }
      _MEIQIA('entId', '3a868043facfaeb313a49667afda3815' || entId);
      _MEIQIA('standalone', function (config) {
        if (config.color) {
          document.body.style['background-color'] = '#' + config.color;
        }
        if (config.url) {
          document.body.style['background-image'] = 'url(' + config.url + ')';
          document.body.style['background-repeat'] = 'no-repeat';
          document.body.style['background-size'] = '100% 100%';
        }
      });
      _MEIQIA('withoutBtn');
      if (data.metadata) {
        try {
          var metadata = JSON.parse(data.metadata);
          _MEIQIA('metadata', metadata);
        } catch (e) { }
      }
      if (data.language) {
        if (data.languagelocal !== 'true') {
          _MEIQIA('language', data.language);
        }
      }
      if (data.languagelocal === 'true') {
        _MEIQIA('languageLocal', true);
      }
      if (data.subsource) {
        _MEIQIA('subSource', data.subsource);
      }
      if (data.fallback) {
        _MEIQIA('fallback', +data.fallback);
      }
      if (data.clientid) {
        _MEIQIA('clientId', data.clientid);
      }
      if (data.agentid || data.groupid) {
        _MEIQIA('assign', { agentToken: data.agentid || null, groupToken: data.groupid || null });
      }
      _MEIQIA('showPanel', {
        greeting: data.greeting || '',
        agentToken: data.agentid || null,
        groupToken: data.groupid || null
      });
    }
    init();
    </script>
    </body >
  </html >

关于美洽在线客服的JavaScript开发说明文档,这里好主机测评站长给大家整理了一份,可以多阅读一下:

JavaScript 网页插件

    相关文章

    如何将代码仓库中的”online”分支推送到线上服务器,并确保主分支”main”与之同步?
    宝塔里面给项目设置固定的git 帐号和密码,不然每次都要输入帐号和密码,让人烦
    宝塔面板搭建服务器网站环境(超详细)
    Git常见报错:Your local changes to the following files would be overwritten by merge
    Chatwoot客服系统:自建网站客服实时聊天工具详细教程
    Epusdt搭建教程:开源免费的跨平台USDT收付款Epusdt搭建

    发布评论