search.page.js
2.25 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* search
* @author: sefon 2016-7-12 15:28:22
*/
var $ = require('yoho-jquery');
var yas = require('../common/data-yas');
var lazyLoad = require('yoho-jquery-lazyload');
var product = require('./index/product');
var qs = window.queryString;
var $footPage = $('.foot-pager1').data('total'),
$productIdArr = [],
$leftUl = $('.sort-container .sort-child-list'),
$leftLi = $leftUl.find('li.active');
var filterValue = yas.getFilterValue();
$('.good-info .product-id').each(function() {
$productIdArr.push($(this).html());
});
require('../common');
require('../plugins/filter');
require('../plugins/sort-pager');
require('./detail/latest-walk');
product.init(4);
lazyLoad($('img.lazy'), {
failure_limit: 20
});
/*
* 页面加载完
*/
$(function() {
var sto = setInterval(function() {
if (window._yas && window._yas.sendCustomInfo) {
// 关键词搜索结果页展示时
yas.givePoint('YB_KEYWORD_GOODS_LIST_L', {
KEYWORD: qs.query,
RES_QTY: $footPage || 0,
PRD_LIST: $productIdArr.join(','),
PAGE_NUM: qs.pager || 1,
FILTER_VALUE: filterValue,
L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '',
L2_SORT: $leftLi.find('a').attr('title') || '',
SORT_TYPE: qs.order || 's_n_desc'
});
clearInterval(sto);
}
}, 100);
// 点击搜索列表商品
$('.good-item-wrapper').click(function() {
var $this = $(this),
proId = $this.find('.product-id').html(),
aIndex = $this.attr('activeIndex'),
pageNum = qs.pager || 1,
limit = qs.limit || 60,
proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10);
// 点击搜索列表商品埋点
yas.givePoint('YB_KEYWORD_GOODS_LIST_C', {
KEYWORD: qs.query,
PRD_ID: proId,
PRD_NUM: proNum,
PAGE_NUM: pageNum,
FILTER_VALUE: filterValue,
L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '',
L2_SORT: $leftLi.find('a').attr('title') || '',
SORT_TYPE: qs.order || 's_n_desc'
});
});
});