'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*global ga, _pt_sp_2,_MEIQIA*/ (function () { function getQueryString(key, func) { if (!key || typeof key === 'undefined') { key = ''; return null; } else { key = key.toLowerCase(); var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)'); var r = window.location.search.toLowerCase().substr(1).match(reg); if (r !== null) { if (!func || func === '' || func == 'decodeURI' || typeof func == 'undefined') { return decodeURI(r[2]); } else if (func == 'unescape') { return unescape(r[2]); } else if (func == 'decodeURIComponent') { return decodeURIComponent(r[2]); } } else { return null; } } } var devicetype = getQueryString('devicetype'); var source = getQueryString('source'); var hasmeiqia = document.getElementsByClassName('j-uzai-meiqia')[0]; if (devicetype === 'ios' || devicetype === 'android' || source === 'iphone' || source === 'android') { if (hasmeiqia !== null && hasmeiqia !== undefined && hasmeiqia !== '') { hasmeiqia.onclick = function () { api.invoke('action.openMQ', ''); }; } console.info('devicetype' + devicetype); console.info('source' + source); } else { //GA (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments); }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m); })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-27817301-10', 'uzai.com'); ga('send', 'pageview'); //国双 // var _gsq = _gsq || []; // (function() { // var s = document.createElement('script'); // s.type = 'text/javascript'; // s.async = true; // s.src = (location.protocol == 'https:' ? 'https://ssl.' : 'http://static.') + 'gridsumdissector.com/js/Clients/GWD-002800-E6A64F/gs.js'; // var firstScript = document.getElementsByTagName('script')[0]; // firstScript.parentNode.insertBefore(s, firstScript); // })(); //Ptengine window._pt_lt = new Date().getTime(); window._pt_sp_2 = []; _pt_sp_2.push('setAccount,49512ddd'); var _protocol = 'https:' == document.location.protocol ? ' https://' : ' http://'; //新增用户对应Ptengine用户ID 李铁辉 2016-11-30 if (api.getCookie('user')) { var user = api.getCookie('user'); var user_PtengineUserId = user.substring(user.indexOf('PtengineUserId=') + 15, user.length); _pt_sp_2.push('setCustomVar,def01,svid,value,' + user_PtengineUserId + ',0'); } (function () { var atag = document.createElement('script'); atag.type = 'text/javascript'; atag.async = true; atag.src = _protocol + 'js.ptengine.cn/js/pta.js'; var stag = document.createElement('script'); stag.type = 'text/javascript'; stag.async = true; stag.src = _protocol + 'js.ptengine.cn/js/pts.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(atag, s); s.parentNode.insertBefore(stag, s); })(); var _hmt = _hmt || []; (function () { var hm = document.createElement('script'); hm.src = 'https://hm.baidu.com/hm.js?c0fb73081cbc7d5e7d68bbcc113343e9'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(hm, s); })(); //美洽在线客服 //var hasmeiqia = document.getElementsByClassName('j-uzai-meiqia'); if (hasmeiqia !== null && hasmeiqia !== undefined && hasmeiqia !== '') { (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 = '//static.meiqia.com/dist/meiqia.js'; s.parentNode.insertBefore(j, s); })(window, document, 'script', '_MEIQIA'); _MEIQIA('entId', 48931); _MEIQIA('withoutBtn'); _MEIQIA('hidePanel'); var user = api.getCookie('user'); // 传递顾客信息 if (user) { var username = api.getValue('realname', user); _MEIQIA('metadata', { name: username // 美洽默认字段 //address: location.href // 美洽默认字段 }); var PtengineUserId = api.getValue('PtengineUserId', user); _MEIQIA('clientId', PtengineUserId); } else { _MEIQIA('metadata', { name: '游客' // 美洽默认字段 //address: location.href // 美洽默认字段 }); } hasmeiqia.onclick = function () { _MEIQIA('showPanel'); }; //上海、南京、苏州、杭州、宁波、无锡、常州7个站点均不做弹出 var pathname = window.location.pathname; var uzmCityID = api.getCookie('uzmCityID'); if (pathname !== '/' && pathname.length > 4) { if (uzmCityID != '2' && uzmCityID != '57' && uzmCityID != '60' && uzmCityID != '19' && uzmCityID != '22' && uzmCityID != '58' && uzmCityID != '68') { setTimeout(function () { _MEIQIA('showPanel'); }, 50000); } } } } })(); (function () { var ur = location.href.toLowerCase(); //百度网盟:4008793692:360.cn:r159478 var ckName = 'uzmCooperateSource'; try { //fix malformed URI sequence bug ur = decodeURIComponent(ur); } catch (e) { ur = unescape(ur); } finally { var refer = document.referrer; ur = ur.replace(location.hash, '').replace('#', ''); //remove hash ur = ur.split('?')[1]; ur = '?' + ur; // 有些来源会带有问号,如: "b": "?360&" if (!refer && !ur) { //判断回车||手动输入链接 api.removeCookie(ckName); } if (!ur || ur.length == 0 || typeof ur == 'undefined') { return false; } } var unitFixHotline = function unitFixHotline(item) { api.setCookie(ckName, item.a + ':' + item.d + ':' + item.e); }; var unitEvt = function unitEvt() { //注释wapi接口 /*var jsonp = document.createElement('script'); jsonp.type = 'text/javascript'; jsonp.src = 'https://wapi.uzai.com/api/UzaiHotline/GetUzaiHotline?callback=jsonpDone'; document.getElementsByTagName('head')[0].appendChild(jsonp);*/ }; var urlsid = api.getQueryString('sourceid'); if (urlsid) { api.setCookie('uzmCooperateSource', '::' + urlsid); } window.jsonpDone = function (data) { if (data) { if (typeof JSON !== 'undefined') { try { if ((typeof data === 'undefined' ? 'undefined' : _typeof(data)) == 'object') { api.setLocalStorage(ckName, JSON.stringify(data)); } } catch (e) { console.log(e.messages); } } } if (data) { var lst = data.listUzaiDicTable; var items = []; var i, j, k, nt, ntArr, ntc, urlsid, iMin; urlsid = api.getQueryString('sourceid'); if (urlsid) { //check url sourceid for (i = 0; i < lst.length; i++) { var sid = lst[i].e; if (sid && sid.toLowerCase() === urlsid.toLowerCase()) { unitFixHotline(lst[i]); return; } } } for (i = 0, k = 0; i < lst.length; i++) { nt = decodeURIComponent(lst[i].b).toLowerCase(); ntArr = nt.split('|'); for (j = 0; j < ntArr.length; j++) { ntc = ntArr[j]; //判断是不是登录的返回地址 if (ur.indexOf(ntc) > -1 && ur.toLowerCase().indexOf('reurl') < 0) { items[k] = lst[i]; k++; break; } } } //反转判断 iMin = items[0]; if (iMin) { for (i = 0; i < items.length - 1; i++) { // 多来源,优先值小的优先 iMin = items[i].c < items[i + 1].c ? items[i] : items[i + 1]; } unitFixHotline(iMin); return; } } }; unitEvt(); })();