Authored by wenjiekong

添加埋点

... ... @@ -11,7 +11,7 @@
</div>
{{! 学生权益}}
<div class="stu-box">
<div class="stu-box" id="stu-rights-box">
<div class="floor-header clearfix">
<a name="stu-rights">
<h2 class="floor-title">学生权益</h2>
... ... @@ -24,7 +24,7 @@
</div>
{{! 身份验证}}
<div class="stu-box ">
<div class="stu-box " id="stu-identity-box">
<div class="floor-header clearfix">
<a name="stu-identity">
<h2 class="floor-title">身份验证</h2>
... ... @@ -36,13 +36,13 @@
</div>
{{! 优惠券}}
<div class="stu-box">
<div class="stu-box" id="stu-coupon-box">
<div class="floor-header clearfix">
<a name="stu-coupon">
<h2 class="floor-title">优惠券</h2>
</a>
<span class="floor-more">
<a href="http://www.yohobuy.com/coupon/index?contentCode=bb7268bd46dd46d304c2917309814681">MORE</a>
<a href="http://www.yohobuy.com/coupon/index?contentCode=bb7268bd46dd46d304c2917309814681" id="stu-coupon-more">MORE</a>
</span>
</div>
<div class="commodity-list clearfix">
... ... @@ -53,13 +53,13 @@
</div>
{{! 热门单品}}
<div class="stu-box">
<div class="stu-box" id="stu-good-box">
<div class="floor-header clearfix">
<a name="stu-good">
<h2 class="floor-title">热门单品</h2>
</a>
<span class="floor-more">
<a target="_blank" href="{{moreProducts}}">MORE</a>
<a target="_blank" href="{{moreProducts}}" id="stu-good-more">MORE</a>
</span>
</div>
<div class="commodity-list clearfix">
... ... @@ -70,7 +70,7 @@
</div>
{{! 活动推荐}}
<div class="stu-box">
<div class="stu-box" id="stu-activity-box">
<div class="floor-header clearfix">
<a name="stu-activity">
<h2 class="floor-title">活动推荐</h2>
... ...
... ... @@ -68,12 +68,12 @@
{{#verifyRusult}}
<div class="identity-back-wrap">
{{#if isStudent}}
<div class="identity-back-icon success-icon"></div>
<div id="identity-success" class="identity-back-icon success-icon"></div>
<p class="identity-back-title">恭喜您,您的验证成功啦!</p>
<p class="identity-back-subtitle"><span>{{prompt}}</span></p>
{{else}}
<div class="identity-back-icon fail-icon"></div>
<p class="identity-back-title">{{#if msg}} {{msg}} {{else}} 太遗憾了,您的学校信息未通过审核!{{/if}}</p>
<div id="identity-fail" class="identity-back-icon fail-icon"></div>
<p id="identity-fail-text" class="identity-back-title">{{#if msg}} {{msg}} {{else}} 太遗憾了,您的学校信息未通过审核!{{/if}}</p>
<p class="identity-back-subtitle">您可以<span class="backForm">重新验证></span></p>
{{/if}}
</div>
... ...
... ... @@ -106,6 +106,8 @@ function clearSelectUl($a, code) {
* 最终提交表单
*/
function submitIdentity(json) {
//xls-3提交认证埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 1});
$.ajax({
type: 'GET',
url: '/product/students/verify',
... ... @@ -113,10 +115,14 @@ function submitIdentity(json) {
}).then(function(data) {
if (data.code === 200) {
window.location.href = data.data;
//xls-4认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1});
} else {
$identityForm.addClass('hide');
$('identity-back-wrap').remove();
$identityWrap.append(identityFn({msg: data.message}));
//xls-4认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2,FAILURE_CAUSE: data.message});
}
});
}
... ... @@ -371,6 +377,10 @@ $rightDia.on('click', function() {
'<p>(4) 不定期学生专享活动;</p>';
createStuDialog(cont);
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-rights-box', F_NAME: '学生权益',
F_URL: '', F_INDEX: 2, I_INDEX: 0});
});
$agreenShow.on('click', function() {
... ... @@ -412,6 +422,10 @@ $('.enable .info').on('click', function(e) {
e.preventDefault();
requestCoupon($(this).closest('a').data('id'));
redirect.gunangSrc = $(this).closest('a').get(0).href;
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券',
F_URL: '', F_INDEX: 4, I_INDEX: 0});
});
$('#identity-Btn').on('click', function() {
... ... @@ -424,38 +438,63 @@ $('#identity-Btn').on('click', function() {
};
var $prompt = $('#prompt'),
$agreen = $('#agreen-show');
$agreen = $('#agreen-show'),
failText = '';
if (identData.name === '') {
$prompt.html('真实姓名不能为空');
failText = '真实姓名不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!/^[\u4e00-\u9fa5a-zA-Z]{2,12}$/.test(identData.name)) {
$prompt.html('真实姓名为2~12个汉字或者英文');
failText = '真实姓名为2~12个汉字或者英文';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.certNo === '') {
$prompt.html('身份证号不能为空');
failText = '身份证号不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(identData.certNo)) {
$prompt.html('身份证号格式错误');
failText = '身份证号格式错误';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.collegeName === '') {
$prompt.html('学校名称不能为空');
failText = '学校名称不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.educationDegree === '') {
$prompt.html('学历程度不能为空');
failText = '学历程度不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (identData.enrollmentYear === '') {
$prompt.html('入学年份不能为空');
failText = '入学年份不能为空';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
if (!$agreen.hasClass('active')) {
$prompt.html('未同意Yoho!有货学生认证协议');
failText = '未同意Yoho!有货学生认证协议';
$prompt.html(failText);
//xls-3埋点
givePoint('YB_STUDENT_ATTCT_SUBMIT',{SRC_ID: 2, SUBMIT_RES: 2, FAILURE_CAUSE: failText});
return;
}
$prompt.html('');
... ... @@ -466,3 +505,119 @@ $('#identity-Btn').on('click', function() {
$('.ident-select-wrap').one('click', function() {
$(this).removeClass('gray-p');
});
function givePoint(op,parameter) {
var CID = 1;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
}
//男:1,女:2,潮童:3,创意生活:4
switch(cookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
}
parameter = $.extend({
'REC_POSE': '',
'PRD_ID': '',
'PRD_NUM': 0,
'C_ID': CID,
'ACTION_ID': 0,
'page_num': 1
}, parameter);
if (parameter.REC_POSE === '' || parameter.PRD_ID === '') {
return true;
}
console.info(parameter);
window._yas.sendCustomInfo({
'op': op,
'uid': getUid(),
'param': JSON.stringify(parameter)
}, true);
}
/*
*埋点
*/
$(function(){
  
if ($('#identity-success').length >0) {
//xls-4学生认证成功埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 1});
}
if ($('#identity-fail').length >0) {
//xls-4学生认证失败埋点
givePoint('YB_STUDENT_ATTCT_RESULT',{SRC_ID: 5, SUBMIT_RES: 2,
FAILURE_CAUSE: $('#identity-fail-text').html()});
}
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_HOME',{SRC_ID: 5});
$('.banner-img').click(function(){
var url = $(this).children().attr('href'),
index = $(this).index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'banner', F_NAME: 'banner',
F_URL: url, F_INDEX: 1, I_INDEX: parseInt(index)+1});
});
$('#stu-coupon-more').click(function(){
var url = $(this).attr('href');
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-coupon-box', F_NAME: '优惠券',
F_URL: url, F_INDEX: 4, I_INDEX: 0});
});
$('#stu-good-more').click(function(){
var url = $(this).attr('href');
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: 0});
});
$('.good-thumb').click(function(){
var url = $(this).attr('href'),
index = $(this).closest('.good-info').index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1});
});
$('.stu-good-detail a').click(function(){
var url = $(this).attr('href'),
index = $(this).closest('.good-info').index();
console.info(index);
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-good-box', F_NAME: '热门单品',
F_URL: url, F_INDEX: 5, I_INDEX: parseInt(index)+1});
});
$('.commodity-list a').click(function(){
var url = $(this).attr('href'),
index = $(this).index();
//xls-5学生营销,页面加载埋点
givePoint('YB_STUDENT_VIP_FLR',{F_ID: 'stu-activity-box', F_NAME: '活动推荐',
F_URL: url, F_INDEX: 6, I_INDEX: parseInt(index)+1});
});
});
... ...