<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
import Setting from '@/setting'
// console.log(Setting, 'Setting')
if (localStorage.getItem("token")) {
  (function () {
    _s = document.createElement("script");
    // _s.src = "https://yaochangkf.three.xinzhidi.cn/customerServer.js";
    _s.src = Setting.kfURL + "/customerServer.js";
    _s.onload = function () {
      var userInfo = JSON.parse(localStorage.getItem("userInfo"));
      var uplodBaseURL = localStorage.getItem("uplodBaseURL");
      var option = {
        authInit: true,
        openUrl: Setting.kfURL, // "https://yaochangkf.three.xinzhidi.cn",
        token: Setting.kfToken,
        kefuid: "", //默认为空自动对接客服，可填写指定客服ID
        isShowTip: true, // 初始化成功后，界面右下角会自动创建 “联系客服按钮”， 如无需默认展示，则填写false即可,默认为true
        mobileIcon: "", //  手机端悬浮客服图片
        pcIcon: "", // pc端悬浮客服图片
        windowStyle: "center", //默认空 右下角小弹窗， center 普通中间弹窗样式
        sendUserData: {
          uid: userInfo.member_id, // 用户id
          nickName: userInfo.nickname, // 用户昵称
          phone: userInfo.mobile, // 用户联系方式
          sex: userInfo.sex, // 用户性别
          avatar: uplodBaseURL + userInfo.headimg, // 用户头像 URL地址
          openid: "", //微信openid
        },
      };
      var canCustomerServer = new initCustomerServer(option);
      canCustomerServer.init();
    };
    document.head.appendChild(_s);
  })();
}
</script>
