|
|
import $ from 'jquery';
|
|
|
import jsonp from './jsonp';
|
|
|
import user from './user';
|
|
|
import utils from './utils';
|
|
|
import cookies from './cookies';
|
|
|
|
...
|
...
|
@@ -129,17 +130,8 @@ let _jsonp = function(el, param, cond){ |
|
|
});
|
|
|
};
|
|
|
|
|
|
let _abTest = function(uid) {
|
|
|
let mkt_code;
|
|
|
if (uid) {
|
|
|
if (Number(uid) % 1024 >= 512) {
|
|
|
mkt_code = 100000000000195; // 默认的值
|
|
|
} else {
|
|
|
mkt_code = 100000000000193; // 个性化,动态接口数据
|
|
|
}
|
|
|
} else {
|
|
|
mkt_code = 100000000000197; // 访客接口数据
|
|
|
}
|
|
|
let _abTest = function() {
|
|
|
let mkt_code = user.getMktCode();
|
|
|
|
|
|
// cover覆盖mkt_code
|
|
|
utils.sParamByIframe('cover=1&mkt_code=' + mkt_code +'&expires=' + (7 * 24 * 60 * 60 * 1000));
|
...
|
...
|
@@ -147,11 +139,21 @@ let _abTest = function(uid) { |
|
|
// 上报曝光事件
|
|
|
let actionUrl = [];
|
|
|
$('a').each(function(){
|
|
|
actionUrl.push($(this).attr('href'));
|
|
|
let href = $(this).attr('href');
|
|
|
if (href && !/^#.*$/.test(href) && !/^javascript.*$/i.test(href)) {
|
|
|
actionUrl.push(href);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
setTimeout(function(){
|
|
|
if (window._yas && window._yas.sendAppLogs) {
|
|
|
var cnt = 0;
|
|
|
var timer = setInterval(function() {
|
|
|
cnt++;
|
|
|
if (cnt > 3) {
|
|
|
clearInterval(timer);
|
|
|
return;
|
|
|
}
|
|
|
if (window._yas && window._yas.sendAppLogs && window.appBaseLogs) {
|
|
|
clearInterval(timer);
|
|
|
window._yas.sendAppLogs({
|
|
|
appop: 'YB_H5_PAGE_AB_OPEN_L',
|
|
|
param: JSON.stringify({
|
...
|
...
|
@@ -164,16 +166,19 @@ let _abTest = function(uid) { |
|
|
}, true);
|
|
|
|
|
|
$('a').click(function() {
|
|
|
window._yas.sendAppLogs({
|
|
|
appop: 'YB_H5_PAGE_AB_FLR_C',
|
|
|
param: JSON.stringify({
|
|
|
C_ID: utils.queryString().yh_channel || 1,
|
|
|
PAGE_URL: window.originUrl,
|
|
|
PAGE_NAME: decodeURI(window.qs.title || document.title),
|
|
|
F_URL: $(this).attr('href'),
|
|
|
CROWD_CODE: mkt_code + ''
|
|
|
})
|
|
|
}, true);
|
|
|
let furl = $(this).attr('href');
|
|
|
if (furl && !/^#.*$/.test(furl) && !/^javascript.*$/i.test(furl)) {
|
|
|
window._yas.sendAppLogs({
|
|
|
appop: 'YB_H5_PAGE_AB_FLR_C',
|
|
|
param: JSON.stringify({
|
|
|
C_ID: utils.queryString().yh_channel || 1,
|
|
|
PAGE_URL: window.originUrl,
|
|
|
PAGE_NAME: decodeURI(window.qs.title || document.title),
|
|
|
F_URL: furl,
|
|
|
CROWD_CODE: mkt_code + ''
|
|
|
})
|
|
|
}, true);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, 1000);
|
...
|
...
|
@@ -202,7 +207,7 @@ let _getProduct = function(param) { |
|
|
}
|
|
|
});
|
|
|
|
|
|
abTestFlag && _abTest(param.uid);
|
|
|
abTestFlag && _abTest();
|
|
|
};
|
|
|
|
|
|
export default {
|
...
|
...
|
@@ -210,6 +215,8 @@ export default { |
|
|
if (utils.isApp()) {
|
|
|
document.addEventListener('deviceready', function() {
|
|
|
window.yohoInterface.triggerEvent(function(data) {
|
|
|
user.uid = data.uid; // app端 获取uid
|
|
|
|
|
|
// 获取个性话数据
|
|
|
_getProduct({
|
|
|
uid: data.uid,
|
...
|
...
|
|