recommend-for-you-user-center.js
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* 为您优选
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/16
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var $recommendForYou = $('.recommend-for-you');
setTimeout(function () {
$.get('/product/recommend-for-you/userCenter').then(function (html) {
var PRDID = [];
$recommendForYou.html(html);
lazyLoad($('img.lazy'));
// 为您优选埋点 http://redmine.yoho.cn/issues/10116
$recommendForYou.find('.good-info').each(function () {
PRDID.push($(this).data('id'));
});
var $recommendSonLen = $recommendForYou.find('.good-info').length;
if ($recommendSonLen === 0) {
$recommendForYou.hide();
} else {
$recommendForYou.show();
}
window.givePoint({
REC_POSE: 110004,
PRD_ID: PRDID.join(','),
PRD_NUM: $('.recommend-for-you .good-info').length,
ACTION_ID: 0,
PAGE_NUM: 1
});
$recommendForYou.find('.good-info').on('click', 'a', function () {
var index = $(this).closest('.good-info').index() + 1;
window.givePoint({
REC_POSE: 110004,
PRD_ID: $(this).closest('.good-info').data('id'),
PRD_NUM: index,
ACTION_ID: 1,
PAGE_NUM: 1
});
return true;
});
}).fail(function () {
$recommendForYou.hide();
});
}, 500);