Authored by zzzzzzz

Merge branch 'hotfix/point' into release/5.0.0

... ... @@ -14,7 +14,7 @@
</section>
{{else}}
<section class='s-section clearfix'>
<div class='s-verify-img s-verify-fail'></div>
<div class='s-verify-img s-verify-fail' prompt='{{./prompt}}'></div>
<p class='s-verify-title'>太遗憾了,{{./prompt}}</p>
<p class='s-verify-txt'>您可以<a class='red' href='//m.yohobuy.com/activity/student/register'>重新验证 ></a></p>
</section>
... ...
... ... @@ -7,7 +7,7 @@ var STUDENTCOOKIES = 'STUDENTCOOKIES';
var C_ID,
getChannel,
asideSlider = new AsideSlider();//eslint-disable-line
asideSlider = new AsideSlider(); //eslint-disable-line
var province,
school,
... ... @@ -86,7 +86,7 @@ function isValidate(rules, datas) {
// break;
// }
// }
if (rule.is !== void (0) && data !== rule.is) {
if (rule.is !== void(0) && data !== rule.is) {
message = rule.msg;
}
} else {
... ... @@ -127,6 +127,20 @@ function changeSuccess() {
};
}
/**
* 身份信息过滤
*/
function filter(data) {
return {
college_name: data.college_name,
college_province: data.provinceName,
education_degree: data.education_degree,
enrollment_year: data.enrollment_year,
sex: (Number(data.cert_no[16]) % 2 === 0) ? 2 : 1,
birth: data.cert_no.substr(6, 8),
};
}
function setFormByCookes(item) {
var msg;
... ... @@ -243,7 +257,7 @@ Filter.prototype = {
if (data[name].length > 0) {
data[name].forEach(function(item) {
html.push('<div class=\'s-item close\' data-obj=\'' +
JSON.stringify(item) + '\'>' + item[that.__feild__] + '</div>');
JSON.stringify(item) + '\'>' + item[that.__feild__] + '</div>');
});
}
}
... ... @@ -346,7 +360,7 @@ window.JI_bilibili = function($el) {
} else {
// $("[data-aslider-in='school|fade']").attr("aslider-isshow","false")
// $("[data-aslider-in='school|fade']").attr("aslider-isshow","false")
}
}
};
... ... @@ -365,7 +379,7 @@ window.JI_getselectvalue = function(type, value) {
};
$('.s-blue').click(function() {
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(changeSuccess().data));
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(filter(changeSuccess().data)));
});
$(function() {
try {
... ... @@ -407,13 +421,12 @@ $(document).on('click', '.s-submit', function() {
var $that = $(this);
// 存cookie 记录状态
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(obj.data));
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(filter(obj.data)));
if ($that.data('isClick') === false) {
return;
}
$that.data('isClick', false);
if (!obj.msg) {
$.ajax({
url: '/activity/student/join',
... ... @@ -424,15 +437,26 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 1
}
}),
}, true);
}
location.href = data.data;
} else {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: 3,
}),
}, true);
}
$that.data('isClick', true);
tip.show(data.message);
}
... ... @@ -450,12 +474,12 @@ $(document).on('click', '.s-submit', function() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
SUBMIT_RES: 2,
FAILURE_CAUSE: FAILURE_CAUSE
}
}),
}, true);
}
... ...
... ... @@ -34,8 +34,8 @@ function uuid() {
for (i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = '-';
id = s.join('');
... ... @@ -64,13 +64,13 @@ if ($('.banner-swiper').find('li').size() > 1) {
// 获取url中的参数
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
// 构造一个含有目标参数的正则表达式对象
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
// 匹配目标参数
// 匹配目标参数
var r = window.location.search.substr(1).match(reg);
// 返回参数值
// 返回参数值
if (r !== null) {
return r[2];
}
... ... @@ -141,64 +141,64 @@ $('.on-lingqu', 'div.main-right-use').on('click', function() {
*/
if (typeof wx !== 'undefined') {
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?',
function(json) {
var _appId,
_timestamp,
_nonceStr,
_signature;
if (json) {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
encodeURIComponent(location.href.split('#')[0]) + '&callback=?',
function(json) {
var _appId,
_timestamp,
_nonceStr,
_signature;
if (json) {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
wx.ready(function() {
var shareData = {
... ... @@ -208,16 +208,16 @@ if (typeof wx !== 'undefined') {
link: 'https://m.yohobuy.com/activity/student'
};
// 分享给朋友
// 分享给朋友
wx.onMenuShareAppMessage(shareData);
// 分享到朋友圈
// 分享到朋友圈
wx.onMenuShareTimeline(shareData);
// 分享到QQ
// 分享到QQ
wx.onMenuShareQQ(shareData);
// 分享到微博
// 分享到微博
wx.onMenuShareWeibo(shareData);
});
}
... ... @@ -225,6 +225,7 @@ if (typeof wx !== 'undefined') {
setTimeout(function() {
var len = $('.good-info', '.goods-list').length;
var ids = [];
var check = location.pathname.indexOf('quanyi') === -1;
$('.good-info', '.goods-list').each(function() {
var goodids = $(this).find('.good-thumb').attr('href').match(/"product_skn":([^}]+)/, 'g');
... ... @@ -233,41 +234,55 @@ setTimeout(function() {
ids.push(goodid);
});
if (window._yas && window._yas.sendCustomInfo) {
if (check && window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_VIP_GDS_LIST',
param: {
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: len,
PRD_ID: ids.join(','),
ACTION_ID: 0,
SORT_TYPE: 4,
REC_ID: uuid(40) + '0000'
}
}),
}, true);
}
if ($('.s-verify-fail').size()) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_ATTCT_RESULT',
param: {
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 1,
FAILURE_CAUSE: ''
}
ATTCT_RES: 2,
FAILURE_CAUSE: $('.s-verify-fail').attr('prompt'),
}),
}, true);
}
} else {
// 埋点 学生营销宣传首页
} else if ($('.s-verify-success').size()) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_STUDENT_HOME',
param: {
C_ID: C_ID
}
op: 'YB_STUDENT_ATTCT_RESULT',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 5,
ATTCT_RES: 1,
FAILURE_CAUSE: '',
ATTCT_INFO: '{{info}}',
}).replace('{{info}}', localStorage.STUDENTCOOKIES),
}, true);
}
} else {
// 埋点 学生营销宣传首页
// if (window._yas && window._yas.sendCustomInfo) {
// window._yas.sendCustomInfo({
// op: 'YB_STUDENT_HOME',
// param: JSON.stringify({
// C_ID: C_ID
// }),
// }, true);
// }
}
}, 3000);
... ... @@ -284,14 +299,14 @@ $('.swiper-slide', '.banner-top').click(function() {
options = {
op: 'YB_STUDENT_VIP_FLR',
param: {
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid || 1,
F_NAME: '焦点图',
F_URL: url,
F_URL: encodeURIComponent(url),
F_INDEX: 1,
I_INDEX: index
}
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
... ... @@ -299,24 +314,47 @@ $('.swiper-slide', '.banner-top').click(function() {
// return false;
});
$('.s-activity', '.s-section').click(function() {
// 学生活动页楼层埋点
$('.s-activity, .main-left, .s-quan, .iconfont', '.s-section').click(function() {
var options;
var url = $(this).attr('href');
var index = $(this).index();
var tid = $(this).parents('.s-section').data('template-id');
var obj = {
's-activity': {
fname: '学生专属活动',
findex: 4,
iindex: index,
},
'more iconfont': {
fname: '领券中心',
findex: 3,
iindex: 0,
},
'main-left': {
fname: '领券中心',
findex: 3,
iindex: $(this).parent().parent().index(),
},
'more s-quan': {
fname: '学生权益',
findex: 2,
iindex: 0,
},
}[$(this).attr('class')];
options = {
op: 'YB_STUDENT_VIP_FLR',
param: {
param: JSON.stringify({
C_ID: C_ID,
F_ID: tid,
F_NAME: '学生专属活动',
F_URL: url,
F_INDEX: 3,
I_INDEX: index
}
F_NAME: obj.fname,
F_URL: encodeURIComponent(url),
F_INDEX: obj.findex,
I_INDEX: obj.iindex,
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
... ... @@ -330,14 +368,13 @@ $('.good-info', '.goods-list').click(function() {
options = {
op: 'YB_STUDENT_VIP_GDS_LIST',
param: {
param: JSON.stringify({
C_ID: C_ID,
PRD_NUM: index,
PRD_ID: goodid,
ACTION_ID: 1,
SORT_TYPE: 4,
REC_ID: uuid(40) + '0000'
}
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
... ... @@ -345,16 +382,14 @@ $('.good-info', '.goods-list').click(function() {
});
$('.s-renzhen').click(function() {
var options = {
op: 'YB_STUDENT_ATTCT_SUBMIT',
param: {
op: 'YB_STUDENT_ATTCT_INFO',
param: JSON.stringify({
C_ID: C_ID,
SRC_ID: 1
}
}),
};
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo(options, true);
}
});
... ...