联系customer的js
import api from '@/js/api'; export var conService = function getInfoSend() { var loginState = localStorage.getItem('login'); if (loginState != null && loginState == 'logining') { //获取登录者信息 api.get('/acl/user/info', null, response => { var nowhref = window.location.href; nowhref = nowhref.replace(/\#/g, "%23"); var ostr = '{"天注定后台用户信息直达:":"http://www.tzding.com/tzd/backend/index.html#/user/edit/' + response.data.id + '"}'; ostr = ostr.replace(/\#/g, "%23"); var url = 'https://www.sobot.com/chat/pc/index.html?sysNum=f18ce7f1ad3a497eadf1973f69024f46&partnerId=' + response.data.id + '&uname=' + response.data.name + '&visitUrl=' + nowhref + '¶ms=' + ostr + ''; var name = '客服页面'; var iWidth = 420; var iHeight = 600; //获得窗口的垂直位置 var iTop = (window.screen.availHeight - iHeight - 100); //获得窗口的水平位置 var iLeft = (window.screen.availWidth - iWidth - 100); window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no'); return; }, error => { console.log(error); }); } var url = 'https://www.sobot.com/chat/pc/index.html?sysNum=f18ce7f1ad3a497eadf1973f69024f46'; var name = '客服页面'; var iWidth = 420; var iHeight = 600; //获得窗口的垂直位置 var iTop = (window.screen.availHeight - iHeight - 100); //获得窗口的水平位置 var iLeft = (window.screen.availWidth - iWidth - 100); window.open(url, name, 'height=' + iHeight + ',,innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0,titlebar=no'); }
将上述文件放在js文件里
在使用的页面引入(vue)
import {conService} from '../../js/contactService.js';
调用
this.conService();