Authored by 沈志敏

app埋点上报

<script>
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.yoho.cn/yas-jssdk/2.0.0/yas.js', '_yas'));
(function() {
var uid = getUid() || queryString.uid;
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.0.0', 'yohobuy_m', uid, '', '');
}
}());
</script>
... ...
... ... @@ -9,10 +9,6 @@ var $ = require('yoho-jquery'),
$tooltip = $('.floor-tooltip'),
tip = require('../plugin/tip');
var bannerSwiper;
var C_ID;
// 获取url中的参数
function getUrlParam(name) {
... ... @@ -59,6 +55,7 @@ function getCouponStatus() {
cates.forEach(function(obj) {
var e = document.getElementById(obj.couponID);
if (!e) {
return;
}
... ... @@ -149,7 +146,7 @@ $('.coupon-floor a, .banner-top a').on('click', function() {
});
if ($('.banner-swiper').find('li').length > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
... ... @@ -177,8 +174,7 @@ $mask.on('click', function() {
});
// 埋点
C_ID = window._ChannelVary[window.cookie('_Channel')];
var C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.floor-focus').find('li').on('click', function() {
// event.preventDefault();
... ... @@ -191,6 +187,7 @@ $('.floor-focus').find('li').on('click', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_LEADING_CENTER_FLR_C',
appop: 'YB_H5_LEADING_CENTER_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
F_ID: foId,
... ... @@ -214,6 +211,7 @@ $('.floor').on('click', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_LEADING_CENTER_FLR_C',
appop: 'YB_H5_LEADING_CENTER_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
F_ID: fId,
... ...
... ... @@ -66,7 +66,6 @@ function isValidate(rules, datas) {
var message = '',
data,
name,
reg,
rule;
datas = datas || {};
... ... @@ -79,13 +78,6 @@ function isValidate(rules, datas) {
break;
}
// if (rule.regex) {
// reg = $.trim(data).match(rule.regex);
// if (!reg || (reg && !reg.length)) {
// message = rule.msg;
// break;
// }
// }
if (rule.is !== void(0) && data !== rule.is) {
message = rule.msg;
}
... ... @@ -441,9 +433,9 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
appop: 'YB_H5_STUDENT_ATTCT_SUBMIT_C',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 1
}),
}, true);
... ... @@ -453,9 +445,9 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
appop: 'YB_H5_STUDENT_ATTCT_SUBMIT_C',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: 3,
}),
... ... @@ -478,9 +470,9 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
appop: 'YB_H5_STUDENT_ATTCT_SUBMIT_C',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: FAILURE_CAUSE
}),
... ...
... ... @@ -252,6 +252,7 @@ setTimeout(function() {
if (check && window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_VIP_GDS_LIST',
appop: 'YB_H5_STUDENT_VIP_GDS_LIST',
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: len,
... ... @@ -266,6 +267,7 @@ setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_RESULT',
appop: 'YB_H5_STUDENT_ATTCT_RESULT_L',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
... ... @@ -278,6 +280,7 @@ setTimeout(function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_RESULT',
appop: 'YB_H5_STUDENT_ATTCT_RESULT_L',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
... ... @@ -314,6 +317,7 @@ $('.swiper-slide', '.banner-top').click(function() {
options = {
op: 'YB_STUDENT_VIP_FLR',
appop: 'YB_H5_STUDENT_VIP_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid || 1,
... ... @@ -361,6 +365,7 @@ $('.s-activity, .main-left, .s-quan, .iconfont', '.s-section').click(function()
options = {
op: 'YB_STUDENT_VIP_FLR',
appop: 'YB_H5_STUDENT_VIP_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid,
... ... @@ -383,6 +388,7 @@ $('.good-info', '.goods-list').click(function() {
options = {
op: 'YB_STUDENT_VIP_GDS_LIST',
appop: 'YB_H5_STUDENT_VIP_GDS_LIST',
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: Number(index) + 1,
... ...
... ... @@ -216,35 +216,6 @@ $.extend({
}());
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
setTimeout(function() {
m.parentNode.insertBefore(a, m);
}, 50);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.yoho.cn/yas-jssdk/1.0.18/yas.js', '_yas'));
(function() {
var uid = getUid() || queryString().uid;
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.18', 'yohobuy_m', uid, '', '');
}
}());
$header.on('touchstart', 'a', function() {
$header.find('a').removeClass('highlight');
$(this).addClass('highlight');
... ...
... ... @@ -51,6 +51,10 @@ function massageAJAX(pageData) {
loading.hideLoadingMask();
lazyLoad($('img.lazy'));
if (pageData === 1) {
$('.buriedpoint').on('click', bpClickHdl);
}
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -73,3 +77,38 @@ $(window).scroll(function() {
if ($('.collocation-list').find('li').length === 0) {
massageAJAX(1);
}
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
var bpClickHdl = function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(this);
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 2,
TAB_NAME: '星搭配',
CONTENT_INDEX: $this.index() + 1,
CONTENT_ID: $this.attr('articleId')
})
}, true);
};
setTimeout(function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_TAB_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 2,
TAB_NAME: '星搭配'
})
}, true);
}, 500);
... ...
... ... @@ -56,3 +56,38 @@ function scrollHandler() {
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.info-list').on('click', function(e) {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(e.target),
$btn = $this.closest('.like-btn'),
$info = $this.closest('.guang-info');
if ($btn.length > 0) {
// 点赞
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_AUTHOR_LIKE_C',
param: JSON.stringify({
C_ID: C_ID,
TYPE: $btn.hasClass('like') ? 2 : 1,
CONTENT_ID: $info.data('id')
})
}, true);
} else if ($info.length > 0) {
// 点击各楼层
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_AUTHOR_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
CONTENT_INDEX: $('.guang-info').index($info) + 1,
CONTENT_ID: $info.data('id')
})
}, true);
}
});
... ...
... ... @@ -106,7 +106,7 @@ function initInfosEvt($container) {
// 点赞
$btn = $this.closest('.like-btn');
if ($btn.length > 0 && !isLoading) {
e.preventDefault();
// e.preventDefault();
if ($btn.hasClass('like')) {
opt = 'cancel';
}
... ... @@ -147,6 +147,7 @@ function initInfosEvt($container) {
$btn = $this.closest('.collect-btn');
if ($btn.length > 0) {
var uid = getUrlParam('uid');
if (uid) {
e.preventDefault();
if ($btn.hasClass('collected')) {
... ...
... ... @@ -12,11 +12,8 @@ var scrollFn,
RECPOSE,
isApp,
searching = false,
speckParamApp = {
udid: '',
apt: '',
sid: ''
};
resourcesTp = {},
CID;
require('yoho-jquery-lazyload');
require('../common');
... ... @@ -47,6 +44,10 @@ plusstar = {
// 事情委托机制
$tabUlDom.bind('click', function(event) {
if (!window._yas || !window._yas.sendCustomInfo) {
return;
}
$liDom = $(event.target).closest('li');
if ($liDom.hasClass('focus')) {
... ... @@ -59,21 +60,22 @@ plusstar = {
that.tabNav($liDom.data('code'));
// 点击潮流优选上方的TAB按钮时
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_FASHION_TAB_C',
param: JSON.stringify($.extend({
TAB_ID: $liDom.index() + 1
}, speckParamApp))
}, true);
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
param: JSON.stringify($.extend({
TAB_ID: that.ParentLiDom.index() + 1
}, speckParamApp))
}, true);
}
window._yas.sendCustomInfo({
op: 'YB_FASHION_TAB_C',
appop: 'YB_H5_STROLL_PLUSSTAR_TAB_C',
param: JSON.stringify({
TAB_ID: $liDom.index() + 1,
CID: CID
})
}, true);
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
param: JSON.stringify({
TAB_ID: that.ParentLiDom.index() + 1,
CID: CID
})
}, true);
});
// start -- 默认选中
... ... @@ -108,28 +110,31 @@ plusstar = {
// 商品单击埋点
$dom = $(event.target).closest('.good-info');
index = $dom.index() + 1;
window.givePoint($.extend({
window.givePoint({
CID: CID,
REC_POSE: RECPOSE,
PRD_ID: $dom.data('good-id'),
ORDER_CODE: '',
PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize,
ACTION_ID: 1,
page_num: Math.ceil(index / that.common.pagesize)
}, speckParamApp));
});
} else if ($(event.target).closest('.banner-top').length > 0) {
// 头部banner楼层埋点
$dom = $(event.target).closest('li');
index = $dom.index() + 1;
window._yas.sendCustomInfo({
op: 'YB_FASHION_FLR_C',
param: JSON.stringify($.extend({
appop: 'YB_H5_STROLL_PLUSSTAR_FLR_C',
param: JSON.stringify({
CID: CID,
TAB_ID: that.ParentLiDom.index() + 1,
F_ID: $dom.closest('ul').data('id'),
F_NAME: '焦点图',
F_URL: encodeURIComponent($dom.find('a').attr('href').replace(/\"/g, '\\"')),
F_INDEX: 1,
I_INDEX: index % 2 + 1// banner,li是双倍的
}, speckParamApp))
})
}, true);
} else if ($(event.target).closest('.speck-title-image a').length > 0) {
// 各楼层埋点
... ... @@ -138,14 +143,16 @@ plusstar = {
window._yas.sendCustomInfo({
op: 'YB_FASHION_FLR_C',
param: JSON.stringify($.extend({
appop: 'YB_H5_STROLL_PLUSSTAR_FLR_C',
param: JSON.stringify({
CID: CID,
TAB_ID: that.ParentLiDom.index() + 1,
F_ID: $dom.data('fid'),
F_NAME: $dom.data('name'),
F_URL: encodeURIComponent($domA.attr('href').replace(/\"/g, '\\"')),
F_INDEX: $dom.index() + 1,
I_INDEX: $domA.hasClass('more') ? 0 : ($domA.index() + 1)
}, speckParamApp))
})
}, true);
}
});
... ... @@ -153,59 +160,70 @@ plusstar = {
// 潮流优选首页加载时
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
param: JSON.stringify($.extend({
param: JSON.stringify({
CID: CID,
TAB_ID: that.ParentLiDom.index() + 1
}, speckParamApp))
})
}, true);
},
tabNav: function(code) {
var that = this;
var tabId = that.ParentLiDom.index() + 1;
this.common.codeDefault = code;// 记住最后一次的tab code
this.common.page = 1;// 商品列表从第一页开始
searching = false;// 初始化翻页
$.ajax({
type: 'GET',
url: '/guang/plusstar/resources-template',
data: {
code: code,
uid: window.queryString.uid,
app_version: isApp,
yh_channel: that.ParentLiDom.index() + 1
},
dataType: 'html',
success: function(data) {
var productSkns = '';
function execResData(data) {
var productSkns = '';
$('.plusstar-resources').html(data);
$('.plusstar-resources').html(data);
if (data === '') {
tip.show('没有更多内容了');
return true;
}
// 固定底部去除
window.rePosFooter();
if (data === '') {
tip.show('没有更多内容了');
return true;
}
// 记录切换tab位置
$(document).scrollTop(window.cookie(code) || 0);
// 固定底部去除
window.rePosFooter();
that.resInit();
// 记录切换tab位置
$(document).scrollTop(window.cookie(code) || 0);
$('.plusstar-resources').find('img.lazy').lazyload();
that.resInit();
productSkns = $(data).find('.product-skns').val();
if (productSkns) {
that.common.productSkns = productSkns.split(',');
}
$('.plusstar-resources').find('img.lazy').lazyload();
that.common.pageTotal = Math.ceil(that.common.productSkns.length / that.common.pagesize);
},
error: function() {
tip.show('网络断开连接了~');
productSkns = $(data).find('.product-skns').val();
if (productSkns) {
that.common.productSkns = productSkns.split(',');
}
});
that.common.pageTotal = Math.ceil(that.common.productSkns.length / that.common.pagesize);
}
if (resourcesTp[tabId]) {
execResData(resourcesTp[tabId]);
} else {
$.ajax({
type: 'GET',
url: '/guang/plusstar/resources-template',
data: {
code: code,
uid: window.queryString.uid,
app_version: isApp,
yh_channel: tabId
},
dataType: 'html',
success: function(data) {
resourcesTp[tabId] = data;
execResData(data);
},
error: function() {
tip.show('网络断开连接了~');
}
});
}
},
resInit: function() {
// 头部banner轮播
... ... @@ -260,14 +278,15 @@ plusstar = {
skn.push($(this).data('good-id'));
});
window.givePoint($.extend({
window.givePoint({
CID: CID,
REC_POSE: RECPOSE,
PRD_ID: skn.join(','),
ORDER_CODE: '',
PRD_NUM: that.common.pagesize,
ACTION_ID: 0,
page_num: that.common.page - 1
}, speckParamApp));
});
$('.plusstar-resources .goods').append(data);
... ... @@ -300,12 +319,6 @@ $(function() {
isApp = window.queryString.app_version || window.queryString.appVersion;
if (isApp) {
speckParamApp = {
udid: window.queryString.anbiudid || window.queryString.udid || '',
apt: window.queryString.client_type || '',
sid: window.queryString.session_id || '',
};
$('.plusstar-resources').css({'margin-top': $('.tab-nav').height()});
} else {
$('.tab-nav').css({
... ... @@ -314,7 +327,7 @@ $(function() {
}
// 男:1,女:2,潮童:3,创意生活:4
speckParamApp.CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;
CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;
plusstar.init();
... ...
... ... @@ -10,3 +10,39 @@ var $ = require('yoho-jquery'),
require('../common');
lazyLoad($('img.lazy'));
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.buriedpoint').on('click', function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(this);
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 1,
TAB_NAME: '星专题',
CONTENT_INDEX: $this.index() + 1,
CONTENT_ID: $this.attr('articleId')
})
}, true);
});
setTimeout(function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_TAB_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 1,
TAB_NAME: '星专题'
})
}, true);
}, 500);
... ...
... ... @@ -6,8 +6,6 @@
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
// inView = require('in-view'),
loading = require('../plugin/loading'),
PullRefresh = require('../plugin/pull-refresh');
... ... @@ -18,24 +16,12 @@ var $window = $(window),
u = navigator.userAgent,
isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
/*
$swiperView = $('.swiper-view'),
$viewImg = $('.view-img'),
$body = $('body'),
imgs = [],
allImgs = {};
var mySwiper;
*/
var avatarKey, bannerLen, res, avatarSwiper, getIndexHtml, bannerSwiper,
$avatarWrap, starIScroll;
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2,
topBanner = $('.banner-top');
// var $gif = $('img[data-original*="gif"]');
if ($('.star-main').css('height') === '0px') {
$('.star-main').css('height', $window.height() - $('.head-tab').height());
}
... ... @@ -47,81 +33,22 @@ if ($window.width() === 375 && isiOS) {
require('../common');
require('yoho-jquery-lazyload');
// require('yoho-jquery-inview');
$window.on('mousewheel', false);
$('#yoho-header, .head-tab').on('touchmove', function() {
return false;
});
// inView(document.querySelectorAll('img[data-original*="gif"]'))
// .on('enter', function() {
// console.log(1);
// })
// .on('exit', function() {
// console.log(2);
// });
// $('img[data-original*="gif"]').on('inview', function(event, isInView) {
// if (isInView) {
// $(this).css('display', 'block');
// } else {
// $(this).css('display', 'none');
// }
// });
// 限制标题字数
// function txtLimit() {
//
// }
// // 设置默认头像
// function setAvatar($userAvatar) {
// var myImage = new Image(),
// avatar = '';
//
// // 部分老用户没有头像,显示默认头像
// avatar = $userAvatar.data('avatar');
//
// // myImage.onload = function() {
// // $userAvatar.css('background-image', 'url(' + avatar + ')');
// // };
// //
// // if (avatar) {
// // myImage.src = avatar;
// // } else {
// // $userAvatar.addClass('default-avater');
// // }
// }
// 明星头像点击居中显示或跳转
function bindAvatar(dom) {
avatarKey = dom.index();
if (!dom.hasClass('swiper-slide-active')) {
// if (avatarKey >= (2 * bannerLen + 1)) {
// avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
// avatarSwiper.slideTo(bannerLen + 1, 0);
// } else if (avatarKey <= (bannerLen - 1)) {
// avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 0);
// avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 0);
// } else {
// avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 200);
// avatarSwiper.slideTo(avatarKey, 200);
// }
return false;
}
}
function setIndexAction() {
// $('.avatar').each(function(key, item) {
// $(item).addClass('avatar-' + key);
// });
// 明星头像 swiper 初始化
if (bannerLen > 1) {
avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
... ... @@ -146,17 +73,6 @@ function setIndexAction() {
});
}
// 明星动态头像左右滑动
// if ($('.article-avatar-swiper').find('li').length > 1) {
// new Swiper('.article-avatar-swiper', {
// initialSlide: 0,
// lazyLoading: true,
// lazyLoadingInPrevNext: true,
// loop: true,
// autoplay: 5000
// });
// }
// banner swiper 初始化
if ($('.banner-swiper').find('li').length > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
... ... @@ -170,32 +86,14 @@ function setIndexAction() {
pagination: '.banner-top .pagination-inner'
});
}
// if ($('.star-info').find('li').length > 0) {
// $starArticle.each(function(key, item) {
// txtLimit($(item), '.article-title', 'p');
//
// // articleImgAction($(item), key);
// });
// }
// $('.rank-avatar').each(function(key, item) {
// setAvatar($(item));
// });
}
function initAction() {
$avatarWrap = $('.avatar-wrap');
bannerLen = $('.avatar-wrap').find('.swiper-slide').length;
// if ($avatarClone) {
// $avatarClone.remove();
// }
$loadingTip.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
// $avatarClone = $('.avatar-clone');
$('img.lazy').lazyload({
effect: 'fadeIn'
});
... ... @@ -215,11 +113,6 @@ getIndexHtml = function() {
})
.done(function(data) {
if (data) {
// if (avatarSwiperClone) {
// avatarSwiperClone.destroy(true, true);
// avatarSwiperClone = null;
// }
$mainContent.html(data);
initAction();
... ... @@ -231,13 +124,6 @@ getIndexHtml = function() {
});
};
// $(window).ready(function() {
// topBannerH = $('.banner-top').height();
// console.log('init'+topBannerH);
// });
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-main', {
pullDown: function() {
... ... @@ -249,132 +135,92 @@ starIScroll = new PullRefresh('.star-main', {
});
starIScroll.iScroll.on('scrollStart', function() {
// 下拉
// if (this.directionY === -1) {
// $loadingTip.slideDown();
// }
// $gif.css('display', 'none');
bannerSwiper && bannerSwiper.stopAutoplay();
});
starIScroll.iScroll.on('scroll', function() {
$window.trigger('scroll');
// var avatarOffsetT;
//
// if (this.directionY !== -1) {
// setTimeout(function() {
// starIScroll.iScroll.refresh();
// }, 0);
// }
//
// avatarOffsetT = $avatarWrap[0].offsetTop;
//
// if (-this.y >= avatarOffsetT) {
// $avatarClone.show();
//
// if (!avatarSwiperClone) {
// avatarSwiperClone = new Swiper($avatarClone[0], {
// lazyLoading: true,
// lazyLoadingInPrevNext: true,
//
// // loop: true,
// initialSlide: $avatarWrap.find('.swiper-slide-active').index() % bannerLen,
// centeredSlides: true,
// slidesPerView: 'auto',
// loopedSlides: bannerLen,
// spaceBetween: 10,
// slidesOffsetBefore: -swiperNum,
// watchSlidesProgress: true,
// watchSlidesVisibility: true,
// onInit: function() {
// $avatarClone.find('li').on('click', function() {
// res = bindAvatar($(this));
// return res;
// });
// }
// });
//
// avatarSwiperClone.params.control = avatarSwiper;
// avatarSwiper.params.control = avatarSwiperClone;
// }
// } else {
// $avatarClone.hide();
// }
});
starIScroll.iScroll.on('scrollEnd', function() {
// $loadingTip.slideUp();
// $gif.css('display', 'block');
if (-this.y <= topBanner.height()) {
bannerSwiper && bannerSwiper.startAutoplay();
}
});
window.setCookie('guangStarUid', window.queryString.uid);
// $('img').on('load', function() {
// starIScroll && starIScroll.iScroll.refresh();
// });
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
// 明星动态文章图片相关操作
/*
function articleImgAction(dom, key) {
var $articeImgs = dom.find('.artice-imgs'),
$li = $articeImgs.find('li'),
imgLen = $articeImgs.find('img').length,
addFlagDom = $li.eq(2);
var i;
imgs = [];
$li.each(function() {
imgs.push($(this).find('img').attr('src'));
});
allImgs[key] = imgs;
$li.on('click', function() {
for (i = 0; i < imgLen; i++) {
$swiperView.find('ul').append('<li class="swiper-slide">' +
'<img class="swiper-lazy" data-src="' + allImgs[key][i] + '">' +
'<div class="swiper-lazy-preloader"></div></li>');
}
setTimeout(function() {
mySwiper = new Swiper('.swiper-view', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
slideElement: 'li'
});
$('.swiper-view li').on('click', function(e) {
if (e.target.nodeName === 'IMG') {
return;
}
$viewImg.hide();
$body.css({
overflow: 'auto'
});
$viewImg.find('li').remove();
mySwiper.destroy(false);
});
}, 100);
$viewImg.show();
$body.css({
overflow: 'hidden'
});
});
// 点击星潮教室页面中的banner
$('.banner-top').find('li').on('click', function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_BANNER_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 0,
TAB_NAME: '全部',
POS_ID: 2, // 轮播图
TO_URL: $(this).find('a')[0].href
})
}, true);
});
if (imgLen > 3 && addFlagDom.find('.img-size').length < 1) {
addFlagDom.append('<div class="img-size"><i class="pic-icon"></i>' + imgLen + '</div>');
$('.swiper-slide-active').on('click', function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
}
*/
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_BANNER_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 0,
TAB_NAME: '全部',
POS_ID: 2, // 轮播图
TO_URL: $(this).find('a')[0].href
})
}, true);
});
// 点击星潮教室页面中的文章时
$('.star-info').on('click', function(e) {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(e.target),
$a = $this.closest('.star-article');
if ($a.length > 0) {
var $li = $this.parents('li');
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 0,
TAB_NAME: '全部',
CONTENT_INDEX: $li.index() + 1,
CONTENT_ID: $li.data('id')
})
}, true);
}
});
setTimeout(function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_TAB_C',
param: JSON.stringify({
C_ID: C_ID,
TAB_INDEX: 0,
TAB_NAME: '全部'
})
}, true);
}, 500);
... ...
... ... @@ -3,7 +3,10 @@ var bp = require('./burying-point');
$(window).load(function() {
// 统计:分期首页点击账户管理进入账户管理页面时
bp.setContYas('YB_INST_REPAYMENT', {
bp.setContYas({
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
}, {
POS_ID: $('.account-page').data('posId')
});
}, true);
});
... ...
require('../common');
function setContYas(op, params, flag) {
function setContYas(operid, params, flag) {
params = $.extend({
C_ID: window.queryString.yh_channel || window.cookie('yhChannel')
}, params);
flag = flag === false ? flag : true;
if (window._yas && window._yas.sendCustomInfo) {
var op,
appop;
if (typeof operid === 'object') {
op = operid.op;
appop = operid.appop;
} else if (typeof operid === 'string') {
op = operid;
}
window._yas.sendCustomInfo({
op: op,
appop: appop,
param: JSON.stringify(params)
}, flag);
}
... ...
... ... @@ -82,12 +82,15 @@ ListData.prototype.getListData = function(page) {
if (!self.opt.noResult) { // 有商品列表
// 统计:商品翻页时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
bp.setContYas({
op: 'YB_INST_HOME_GDS_LIST',
appop: 'YB_H5_INST_HOME_GDS_LIST_C'
}, {
PRD_NUM: $('.installment-only .good-info').length,
PRD_ID: bp.countGoodsId(),
ACTION_ID: 0,
REC_ID: self.opt.uuid
});
}, true);
$('img.lazy').lazyload({
effect: 'fadeIn'
... ...
... ... @@ -98,14 +98,17 @@ $(window).load(function() {
// 统计:进入订单详情页时
bp.setContYas('YB_INST_ORDER_INFO', {
ORDER_CODE: orderCode
});
}, true);
$('.repayment-btn').on('click', function() {
// 统计:点击立即还款时
bp.setContYas('YB_INST_ORDER_TOPAY', {
bp.setContYas({
op: 'YB_INST_ORDER_TOPAY',
appop: 'YB_H5_INST_ORDER_TOPAY_C'
}, {
ORDER_CODE: orderCode,
PERIODS: $(CHECKBOX_SELECTOR + ':checked').last().data('sortId')
});
}, true);
});
});
... ...
... ... @@ -93,9 +93,12 @@ $('.header-tab a').click(function() {
loadOrderList(1, $(this).data('type'));
// 统计: tab 切换
bp.setContYas('YB_INST_ORDER_TAB', {
bp.setContYas({
op: 'YB_INST_ORDER_TAB',
appop: 'YB_H5_INST_ORDER_TAB_C'
}, {
LAB_ID: $(this).parent().index()
});
}, true);
return false;
});
... ... @@ -131,14 +134,20 @@ $(window).scroll(function() {
$(window).load(function() {
// 统计:分期主页点击分期订单进入订单列表页时
bp.setContYas('YB_INST_REPAYMENT', {
bp.setContYas({
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
}, {
POS_ID: $('.installment-order-page').data('posId')
});
}, true);
$(document).on('click', '.order-list a', function() {
// 统计:点击各个订单时
bp.setContYas('YB_INST_ORDER_CLICK', {
bp.setContYas({
op: 'YB_INST_ORDER_CLICK',
appop: 'YB_H5_INST_ORDER_C'
}, {
LAB_ID: $('.header-tab .active').index(),
ORDER_CODE: $(this).data('code')
}, false);
... ...
... ... @@ -60,25 +60,31 @@ var installment = {
// 统计:开通按钮点击时
$('.open-btn').on('click', function() {
bp.setContYas('YB_INST_OPEN', {});
bp.setContYas({
op: 'YB_INST_OPEN',
appop: 'YB_H5_INST_OPEN_C'
}, {}, true);
});
$(document).on('click', '.good-info', function() {
// 统计:商品点击时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
bp.setContYas({
op: 'YB_INST_HOME_GDS_LIST',
appop: 'YB_H5_INST_HOME_GDS_LIST_C'
}, {
PRD_NUM: parseInt($(this).index()) + 1, //eslint-disable-line
PRD_ID: $(this).data('goodId'),
ACTION_ID: 1,
REC_ID: self.uuidVal
});
}, true);
});
// 统计:开通后模块位点击时
$('.nav-bit').on('click', function() {
bp.setContYas('YB_INST_REPAYMENT_CLICK', {
POS_ID: $(this).data('id')
});
}, true);
});
if (window.queryString.status === '2') {
... ... @@ -131,9 +137,12 @@ var installment = {
}
// 统计:开通成功后首页头部tab切换
bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
bp.setContYas({
op: 'YB_INST_OPENED_HOME_CLICK',
appop: 'YB_H5_INST_OPENED_HOME_TAB_C'
}, {
LAB_ID: labId
});
}, true);
self.starIScroll.iScroll.refresh();
},
... ... @@ -185,22 +194,25 @@ $(window).load(function() {
// 统计:进入页面时
bp.setContYas('YB_INST_HOME', {
IS_OPEN: installment.$isOpen.val()
});
}, true);
// 统计:商品第一页加载时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
bp.setContYas({
op: 'YB_INST_HOME_GDS_LIST',
appop: 'YB_H5_INST_HOME_GDS_LIST_C'
}, {
PRD_NUM: $('.installment-only .good-info').length,
PRD_ID: bp.countGoodsId(),
ACTION_ID: 0,
REC_ID: installment.uuidVal
});
}, true);
if (installment.$isOpen.val() === 'true') {
// 统计:待还款金额默认页面加载时
bp.setContYas('YB_INST_OPENED_HOME_LOAD', {
LAB_ID: 1
});
}, true);
}
}
});
... ...
... ... @@ -214,7 +214,10 @@ $('#apply-button').click(function() {
}
// 统计:点击下一步按钮时
bp.setContYas('YB_INST_NEXT', {});
bp.setContYas({
op: 'YB_INST_NEXT',
appop: 'YB_H5_INST_NEXT_C'
}, {}, true);
$.ajax({
method: 'get',
... ... @@ -256,7 +259,10 @@ $('#apply-button').click(function() {
if (result.data.status === '2') {
// 统计:开通成功时
bp.setContYas('YB_INST_OPEN_SUCCESS', {});
bp.setContYas({
op: 'YB_INST_OPEN_SUCCESS',
appop: 'YB_H5_INST_OPEN_SUCCESS_L'
}, {}, true);
}
// 开通失败
... ... @@ -313,5 +319,5 @@ require('./overdue-notice');
$(window).load(function() {
// 统计:进入开通分期表单页面时
bp.setContYas('YB_INST_OPEN_INFO', {});
bp.setContYas('YB_INST_OPEN_INFO', {}, true);
});
... ...
... ... @@ -5,7 +5,10 @@ $('.repay-list .notice').on('click', function() {
$notice.show();
// 统计:点击逾期说明时
bp.setContYas('YB_INST_OVERDUE_INFO_CLICK', {});
bp.setContYas({
op: 'YB_INST_OVERDUE_INFO_CLICK',
appop: 'YB_H5_INST_OVERDUE_INFO_C'
}, {}, true);
return false;
});
... ...
... ... @@ -19,7 +19,10 @@ listData.getListData(0);
$(window).load(function() {
// 统计:分期首页点击还款记录进入落地页时
bp.setContYas('YB_INST_REPAYMENT', {
bp.setContYas({
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
}, {
POS_ID: $('.repayment-list-page').data('posId')
});
}, true);
});
... ...
... ... @@ -83,9 +83,12 @@ repayment.update();
$(window).load(function() {
// 统计:各模块的落地页进入时
bp.setContYas('YB_INST_REPAYMENT', {
bp.setContYas({
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
}, {
POS_ID: $('.repayment-list-page').data('posId')
});
}, true);
});
// 统计yas 需要传的参数
... ... @@ -114,11 +117,14 @@ function countYasParams() {
$('.repayment-btn').on('click', function() {
var opt = countYasParams();
bp.setContYas('YB_INST_TOPAY_CLICK', {
bp.setContYas({
op: 'YB_INST_TOPAY_CLICK',
appop: 'YB_H5_INST_TOPAY_C'
}, {
POS_ID: $('.repayment-list-page').data('posId'),
ORDER_CODE: opt.billNoAll,
INST_STYLE: opt.termNoAll
});
}, true);
});
... ... @@ -126,10 +132,13 @@ $('.repayment-btn').on('click', function() {
$('.list-right a').on('click', function() {
var li = $(this).parents('li');
bp.setContYas('YB_INST_TOPAY_INFO', {
bp.setContYas({
op: 'YB_INST_TOPAY_INFO',
appop: 'YB_H5_INST_TOPAY_INFO_C'
}, {
POS_ID: $('.repayment-list-page').data('posId'),
ORDER_CODE: li.data('billNo'),
INST_STYLE: curTermNo[li.data('terms')],
PERIODS: li.data('currterm')
});
}, true);
});
... ...