UNPKG

@beisen/ethos

Version:

beisencloud pc react components

53 lines (47 loc) 2.21 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); //数据分析接口 var dataAnalysis = { _up: function _up(label, cmp_id, step) { if (typeof BSGlobal !== 'undefined') { var uid = BSGlobal.loginUserInfo.Id ? BSGlobal.loginUserInfo.Id : 0; // 这里是用户ID var tid = BSGlobal.tenantInfo.Id ? BSGlobal.tenantInfo.Id : 0; // 这里是租户ID var appName = BSGlobal.appName ? BSGlobal.appName : null; var sessionId = 0; var type = 1; if (step === undefined) { type = 1; step = 0; sessionId = BSGlobal.start ? uid + BSGlobal.start.getTime() : 0; } else { type = 2; } var sw = screen.width; var sh = screen.height; var ww = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; var wh = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var pages = location.hash.split('?')[0].split('/')[1]; var cid = cmp_id ? cmp_id : null; //判断是否存在 var params = "appName=" + appName + "&label=" + encodeURIComponent(label) + "&uid=" + uid + "&tid=" + tid + "&cmp_id=" + cid + "&sessionId=" + sessionId + "&scrWidth=" + sw + "&scrHeight=" + sh + "&winwidth=" + ww + "&winheight=" + wh + "&pages=" + pages + '&ts=' + new Date().getTime(); var url, url1; if (BSGlobal.env && BSGlobal.env == 'Production') { url = "http://log.tita.com/api/v2/addUserLog?"; if (label.indexOf("[components-reRender]") === -1) { url1 = "http://opsapi.beisen.com/opsapi/addlog?"; var img1 = new Image(); img1.src = url1 + params; } } else { url = "http://log.tita.com/api/v2/addUserLog?"; } var img = new Image(); img.src = url + params; } else { return false; } } }; exports.default = dataAnalysis; module.exports = exports['default'];