Merge branch 'feature/collectListYas' into release/5.2
# Conflicts: # config/common.js
Showing
12 changed files
with
363 additions
and
36 deletions
@@ -297,7 +297,8 @@ const getBrandData = (params, extra, channel) => { | @@ -297,7 +297,8 @@ const getBrandData = (params, extra, channel) => { | ||
297 | brand: { | 297 | brand: { |
298 | brandBanner: searchHandler.handleBrandBanner(extra), | 298 | brandBanner: searchHandler.handleBrandBanner(extra), |
299 | leftContent: {}, | 299 | leftContent: {}, |
300 | - node: extra.node || '' | 300 | + node: extra.node || '', |
301 | + brandId: extra.brandId | ||
301 | } | 302 | } |
302 | }; | 303 | }; |
303 | 304 |
@@ -648,6 +648,7 @@ exports.handleFilterData = (origin, params, total) => { | @@ -648,6 +648,7 @@ exports.handleFilterData = (origin, params, total) => { | ||
648 | }; | 648 | }; |
649 | dest.checkedConditions.conditions.push({ | 649 | dest.checkedConditions.conditions.push({ |
650 | name: name, | 650 | name: name, |
651 | + itemType: 'price', | ||
651 | href: handleFilterUrl(params, {}, {price: true}) | 652 | href: handleFilterUrl(params, {}, {price: true}) |
652 | }); | 653 | }); |
653 | } | 654 | } |
@@ -838,7 +839,8 @@ exports.handleSeniorFilterData = (data, params) => { | @@ -838,7 +839,8 @@ exports.handleSeniorFilterData = (data, params) => { | ||
838 | }); | 839 | }); |
839 | 840 | ||
840 | _.forEach(data.standard, value => { | 841 | _.forEach(data.standard, value => { |
841 | - let sub = []; | 842 | + let sub = [], |
843 | + standardName = value.standard_name; | ||
842 | 844 | ||
843 | // let parKey = `parameter_${value.standard_id}`; | 845 | // let parKey = `parameter_${value.standard_id}`; |
844 | 846 | ||
@@ -848,6 +850,7 @@ exports.handleSeniorFilterData = (data, params) => { | @@ -848,6 +850,7 @@ exports.handleSeniorFilterData = (data, params) => { | ||
848 | if (ched) { | 850 | if (ched) { |
849 | conditions.push({ | 851 | conditions.push({ |
850 | name: subValue.standard_name, | 852 | name: subValue.standard_name, |
853 | + itemType: standardName, | ||
851 | href: handleFilterUrl(params, { | 854 | href: handleFilterUrl(params, { |
852 | standard: getStandard(qStandard, null, { | 855 | standard: getStandard(qStandard, null, { |
853 | k: value.standard_id, | 856 | k: value.standard_id, |
@@ -910,7 +913,6 @@ exports.handleFilterDataAll = (data, qs) => { | @@ -910,7 +913,6 @@ exports.handleFilterDataAll = (data, qs) => { | ||
910 | Object.assign(destFilter, seniorFilter, baseFilter); | 913 | Object.assign(destFilter, seniorFilter, baseFilter); |
911 | 914 | ||
912 | _.set(destFilter, 'checkedConditions.conditions', conditions); | 915 | _.set(destFilter, 'checkedConditions.conditions', conditions); |
913 | - | ||
914 | return destFilter; | 916 | return destFilter; |
915 | }; | 917 | }; |
916 | 918 | ||
@@ -1009,7 +1011,8 @@ exports.handlePathNavData = (data, params, page, channel) => { | @@ -1009,7 +1011,8 @@ exports.handlePathNavData = (data, params, page, channel) => { | ||
1009 | break; | 1011 | break; |
1010 | } | 1012 | } |
1011 | return { | 1013 | return { |
1012 | - pathNav: pathNav | 1014 | + pathNav: pathNav, |
1015 | + listType: page | ||
1013 | }; | 1016 | }; |
1014 | }; | 1017 | }; |
1015 | 1018 |
@@ -17,15 +17,14 @@ module.exports = { | @@ -17,15 +17,14 @@ module.exports = { | ||
17 | cookieDomain: '.yohobuy.com', | 17 | cookieDomain: '.yohobuy.com', |
18 | domains: { | 18 | domains: { |
19 | favApi: 'http://192.168.102.31:8092/brower', | 19 | favApi: 'http://192.168.102.31:8092/brower', |
20 | - | ||
21 | - // api: 'http://api-test1.yohops.com:9999/', | ||
22 | - // service: 'http://service-test1.yohops.com:9999/', | 20 | + api: 'http://api-test3.yohops.com:9999/', |
21 | + service: 'http://service-test3.yohops.com:9999/', | ||
23 | 22 | ||
24 | // api: 'http://api.yoho.cn/', | 23 | // api: 'http://api.yoho.cn/', |
25 | // service: 'http://service.yoho.cn/', | 24 | // service: 'http://service.yoho.cn/', |
26 | 25 | ||
27 | - api: 'http://dev-api.yohops.com:9999/', | ||
28 | - service: 'http://dev-service.yohops.com:9999/', | 26 | + //api: 'http://dev-api.yohops.com:9999/', |
27 | + //service: 'http://dev-service.yohops.com:9999/', | ||
29 | 28 | ||
30 | search: 'http://192.168.102.216:8080/yohosearch/' | 29 | search: 'http://192.168.102.216:8080/yohosearch/' |
31 | }, | 30 | }, |
@@ -104,7 +103,7 @@ module.exports = { | @@ -104,7 +103,7 @@ module.exports = { | ||
104 | } | 103 | } |
105 | }, | 104 | }, |
106 | apiCache: { | 105 | apiCache: { |
107 | - cache: true | 106 | + cache: false |
108 | }, | 107 | }, |
109 | zookeeperServer: '192.168.102.168:2188' | 108 | zookeeperServer: '192.168.102.168:2188' |
110 | }; | 109 | }; |
1 | {{# footPager}} | 1 | {{# footPager}} |
2 | 2 | ||
3 | - <div class="foot-pager clearfix"> | 3 | + <div class="foot-pager clearfix" data-total={{../totalCount}}> |
4 | <span class="total"> | 4 | <span class="total"> |
5 | {{# tip}} | 5 | {{# tip}} |
6 | {{#if totalText}} | 6 | {{#if totalText}} |
@@ -19,10 +19,10 @@ | @@ -19,10 +19,10 @@ | ||
19 | {{# pages}} | 19 | {{# pages}} |
20 | <a{{#if url}} href="{{url}}"{{/if}}{{#if cur}} class="cur"{{/if}}>{{num}}</a> | 20 | <a{{#if url}} href="{{url}}"{{/if}}{{#if cur}} class="cur"{{/if}}>{{num}}</a> |
21 | {{/ pages}} | 21 | {{/ pages}} |
22 | - | 22 | + |
23 | {{# nextPage}} | 23 | {{# nextPage}} |
24 | <a href="{{url}}" title="下一页">下一页<span class="iconfont"></span></a> | 24 | <a href="{{url}}" title="下一页">下一页<span class="iconfont"></span></a> |
25 | {{/ nextPage}} | 25 | {{/ nextPage}} |
26 | </div> | 26 | </div> |
27 | </div> | 27 | </div> |
28 | -{{/ footPager}} | ||
28 | +{{/ footPager}} |
1 | {{#if pathNav}} | 1 | {{#if pathNav}} |
2 | - <p class="path-nav"> | 2 | + <p class="path-nav" listType="{{listType}}" brandId="{{brandId}}"> |
3 | {{#each pathNav}} | 3 | {{#each pathNav}} |
4 | {{#if name}} | 4 | {{#if name}} |
5 | {{#if href}} | 5 | {{#if href}} |
@@ -14,4 +14,4 @@ | @@ -14,4 +14,4 @@ | ||
14 | {{/if}} | 14 | {{/if}} |
15 | {{/each}} | 15 | {{/each}} |
16 | </p> | 16 | </p> |
17 | -{{/if}} | ||
17 | +{{/if}} |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <span class="title">已选条件:</span> | 6 | <span class="title">已选条件:</span> |
7 | <div class="attr-content clearfix"> | 7 | <div class="attr-content clearfix"> |
8 | {{#each conditions}} | 8 | {{#each conditions}} |
9 | - <a class="tag" href="{{href}}"> | 9 | + <a class="tag" href="{{href}}" name="{{name}}" itemType="{{itemType}}"> |
10 | {{#if name}} | 10 | {{#if name}} |
11 | {{name}} | 11 | {{name}} |
12 | {{^}} | 12 | {{^}} |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | 28 | ||
29 | <div class="attr-content clearfix"> | 29 | <div class="attr-content clearfix"> |
30 | {{#each channel}} | 30 | {{#each channel}} |
31 | - <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> | 31 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}"> |
32 | {{name}} | 32 | {{name}} |
33 | </a> | 33 | </a> |
34 | {{/each}} | 34 | {{/each}} |
@@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
42 | 42 | ||
43 | <div class="attr-content clearfix"> | 43 | <div class="attr-content clearfix"> |
44 | {{#each gender}} | 44 | {{#each gender}} |
45 | - <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> | 45 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}"> |
46 | {{name}} | 46 | {{name}} |
47 | </a> | 47 | </a> |
48 | {{/each}} | 48 | {{/each}} |
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | <ul class="sort-pre clearfix"> | 58 | <ul class="sort-pre clearfix"> |
59 | {{#each sort}} | 59 | {{#each sort}} |
60 | <li data-id="{{id}}"> | 60 | <li data-id="{{id}}"> |
61 | - <span class="attr {{#if checked}}checked{{/if}}"> | 61 | + <span class="attr {{#if checked}}checked{{/if}}" name="{{name}}"> |
62 | {{name}} | 62 | {{name}} |
63 | <div class="sort-up-icon"></div> | 63 | <div class="sort-up-icon"></div> |
64 | </span> | 64 | </span> |
@@ -70,7 +70,7 @@ | @@ -70,7 +70,7 @@ | ||
70 | {{#each sort}} | 70 | {{#each sort}} |
71 | <ul class="sort-sub clearfix hide"> | 71 | <ul class="sort-sub clearfix hide"> |
72 | {{#each sub}} | 72 | {{#each sub}} |
73 | - <li class="attr {{#if checked}}checked{{/if}}"> | 73 | + <li class="attr {{#if checked}}checked{{/if}}" name="{{name}}"> |
74 | <a href="{{href}}">{{name}}</a> | 74 | <a href="{{href}}">{{name}}</a> |
75 | </li> | 75 | </li> |
76 | {{/each}} | 76 | {{/each}} |
@@ -88,7 +88,7 @@ | @@ -88,7 +88,7 @@ | ||
88 | 88 | ||
89 | <div class="attr-content clearfix"> | 89 | <div class="attr-content clearfix"> |
90 | {{#each misort}} | 90 | {{#each misort}} |
91 | - <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> | 91 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}"> |
92 | {{name}} | 92 | {{name}} |
93 | </a> | 93 | </a> |
94 | {{/each}} | 94 | {{/each}} |
@@ -136,7 +136,7 @@ | @@ -136,7 +136,7 @@ | ||
136 | 136 | ||
137 | <div class="attr-content clearfix"> | 137 | <div class="attr-content clearfix"> |
138 | {{#each ageLevel}} | 138 | {{#each ageLevel}} |
139 | - <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}"> | 139 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}"> |
140 | {{name}} | 140 | {{name}} |
141 | </a> | 141 | </a> |
142 | {{/each}} | 142 | {{/each}} |
@@ -150,7 +150,7 @@ | @@ -150,7 +150,7 @@ | ||
150 | 150 | ||
151 | <div class="attr-content clearfix"> | 151 | <div class="attr-content clearfix"> |
152 | {{# price}} | 152 | {{# price}} |
153 | - <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}">{{name}}</a> | 153 | + <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}">{{name}}</a> |
154 | {{/ price}} | 154 | {{/ price}} |
155 | 155 | ||
156 | <div class="ud-price-range"> | 156 | <div class="ud-price-range"> |
@@ -166,12 +166,12 @@ | @@ -166,12 +166,12 @@ | ||
166 | {{/if}} | 166 | {{/if}} |
167 | 167 | ||
168 | {{#if discount}} | 168 | {{#if discount}} |
169 | - <div class="price section"> | 169 | + <div class="discount section"> |
170 | <span class="title">折扣:</span> | 170 | <span class="title">折扣:</span> |
171 | 171 | ||
172 | <div class="attr-content clearfix"> | 172 | <div class="attr-content clearfix"> |
173 | {{# discount}} | 173 | {{# discount}} |
174 | - <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}">¥{{name}}</a> | 174 | + <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}">¥{{name}}</a> |
175 | {{/ discount}} | 175 | {{/ discount}} |
176 | </div> | 176 | </div> |
177 | </div> | 177 | </div> |
@@ -184,7 +184,7 @@ | @@ -184,7 +184,7 @@ | ||
184 | 184 | ||
185 | <div class="attr-content clearfix"> | 185 | <div class="attr-content clearfix"> |
186 | {{# color}} | 186 | {{# color}} |
187 | - <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}"> | 187 | + <a class="attr{{#if checked}} checked{{/if}}" href="{{href}}" name="{{name}}"> |
188 | {{#if checked}} | 188 | {{#if checked}} |
189 | <span class="color-block"> | 189 | <span class="color-block"> |
190 | <i class="sub-color-block" style="background: {{rgb}}"></i> | 190 | <i class="sub-color-block" style="background: {{rgb}}"></i> |
@@ -204,7 +204,7 @@ | @@ -204,7 +204,7 @@ | ||
204 | 204 | ||
205 | <div class="attr-content clearfix"> | 205 | <div class="attr-content clearfix"> |
206 | {{# size}} | 206 | {{# size}} |
207 | - <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a> | 207 | + <a class="attr {{#if checked}}checked{{/if}}" href="{{href}}" name="{{name}}">{{name}}</a> |
208 | {{/ size}} | 208 | {{/ size}} |
209 | </div> | 209 | </div> |
210 | </div> | 210 | </div> |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | {{#if product_id}} | 2 | {{#if product_id}} |
3 | <span class="hide product-id">{{product_id}}</span> | 3 | <span class="hide product-id">{{product_id}}</span> |
4 | {{/if}} | 4 | {{/if}} |
5 | + <span class="hide shelve-time">{{shelve_time}}</span> | ||
5 | <div class="tag-container clearfix"> | 6 | <div class="tag-container clearfix"> |
6 | {{# tags}} | 7 | {{# tags}} |
7 | {{# is_new_festival}} | 8 | {{# is_new_festival}} |
public/js/common/data-yas.js
0 → 100644
1 | +/** | ||
2 | + * Created by DELL on 2016.11.9. | ||
3 | + */ | ||
4 | +var $ = require('yoho-jquery'); | ||
5 | + | ||
6 | +function getCookie(name) { | ||
7 | + var arr, reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); | ||
8 | + | ||
9 | + if (arr === document.cookie.match(reg)) { | ||
10 | + return unescape(arr[2]); | ||
11 | + } else { | ||
12 | + return null; | ||
13 | + } | ||
14 | +} | ||
15 | + | ||
16 | +// 频道、性别、品类、折扣、人群、颜色、尺码、分类 | ||
17 | +function _getCommonFilterValue() { | ||
18 | + var $section = $('.channel, .sort, .discount, .misort, .color, .size'); | ||
19 | + var $attrchecked = $section.find('.attr-content .attr.checked'); | ||
20 | + var filterValue = ''; | ||
21 | + | ||
22 | + $attrchecked.each(function() { | ||
23 | + var $this = $(this); | ||
24 | + var key = $this.parents('.attr-content').prev().html(), | ||
25 | + name = $this.attr('name'); | ||
26 | + | ||
27 | + filterValue += key + name + ';'; | ||
28 | + }); | ||
29 | + | ||
30 | + return filterValue; | ||
31 | +} | ||
32 | + | ||
33 | +// 价格、品牌、高级筛选 | ||
34 | +function _getOtherFilterValue() { | ||
35 | + var filterValue = ''; | ||
36 | + | ||
37 | + $('.checked-conditions .attr-content .tag').each(function() { | ||
38 | + var type = $(this).attr('itemType'), | ||
39 | + name = $(this).attr('name'); | ||
40 | + | ||
41 | + switch (type) { | ||
42 | + case 'brands': | ||
43 | + type = '品牌'; | ||
44 | + break; | ||
45 | + case 'price': | ||
46 | + type = '价格'; | ||
47 | + break; | ||
48 | + default: | ||
49 | + break; | ||
50 | + } | ||
51 | + filterValue += type + ':' + name + ';'; | ||
52 | + }); | ||
53 | + | ||
54 | + return filterValue; | ||
55 | +} | ||
56 | + | ||
57 | +/** *埋点方法***/ | ||
58 | +function givePoint(op, parameter) { | ||
59 | + var CID = 1; | ||
60 | + | ||
61 | + if (!window._yas || !window._yas.sendCustomInfo) { | ||
62 | + return false; | ||
63 | + } | ||
64 | + | ||
65 | + if (!getCookie('_Channel')) { | ||
66 | + // 男:1,女:2,潮童:3,创意生活:4 | ||
67 | + switch (getCookie('_Channel')) { | ||
68 | + case 'boys': | ||
69 | + CID = 1; | ||
70 | + break; | ||
71 | + case 'girls': | ||
72 | + CID = 2; | ||
73 | + break; | ||
74 | + case 'kids': | ||
75 | + CID = 3; | ||
76 | + break; | ||
77 | + case 'lifestyle': | ||
78 | + CID = 4; | ||
79 | + break; | ||
80 | + default: | ||
81 | + CID = 1; | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + parameter = $.extend({ | ||
86 | + C_ID: CID | ||
87 | + }, parameter); | ||
88 | + | ||
89 | + console.info(parameter); | ||
90 | + window._yas.sendCustomInfo({ | ||
91 | + op: op, | ||
92 | + param: JSON.stringify(parameter) | ||
93 | + }, true); | ||
94 | +} | ||
95 | + | ||
96 | +function getFilterValue() { | ||
97 | + return _getCommonFilterValue() + _getOtherFilterValue(); | ||
98 | +} | ||
99 | + | ||
100 | + | ||
101 | +exports.givePoint = givePoint; | ||
102 | +exports.getFilterValue = getFilterValue; | ||
103 | + |
@@ -9,9 +9,11 @@ | @@ -9,9 +9,11 @@ | ||
9 | * 页面已经被 nginx 缓存,变化后的数据需要通过 ajax 进行获取后,重新绑定事件。 | 9 | * 页面已经被 nginx 缓存,变化后的数据需要通过 ajax 进行获取后,重新绑定事件。 |
10 | */ | 10 | */ |
11 | 11 | ||
12 | -var $ = require('yoho-jquery'), | ||
13 | - lazyLoad = require('yoho-jquery-lazyload'), | ||
14 | - dataLazyLoad = require('../plugins/lazy-load')(document); | 12 | +var $ = require('yoho-jquery'); |
13 | + | ||
14 | +var lazyLoad = require('yoho-jquery-lazyload'); | ||
15 | +var yas = require('../common/data-yas'); | ||
16 | +var dataLazyLoad = require('../plugins/lazy-load')(document); | ||
15 | 17 | ||
16 | var bindEvent = $.Callbacks(); // eslint-disable-line | 18 | var bindEvent = $.Callbacks(); // eslint-disable-line |
17 | var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line | 19 | var clickAcquireCouponEvent = $.Callbacks('unique'); // eslint-disable-line |
@@ -449,12 +451,18 @@ bindEvent.add(function() { | @@ -449,12 +451,18 @@ bindEvent.add(function() { | ||
449 | // 收藏 | 451 | // 收藏 |
450 | $('#collect-product').click(function() { | 452 | $('#collect-product').click(function() { |
451 | var $this = $(this), | 453 | var $this = $(this), |
452 | - cancel; | 454 | + cancel, |
455 | + coltyp; | ||
453 | 456 | ||
454 | if ($this.hasClass('coled')) { | 457 | if ($this.hasClass('coled')) { |
455 | cancel = true; | 458 | cancel = true; |
456 | } | 459 | } |
457 | 460 | ||
461 | + coltyp = cancel ? 2 : 1; | ||
462 | + | ||
463 | + // 收藏埋點 | ||
464 | + yas.givePoint('YB_COLLECTION_C', {PRD_ID: id, COL_TYP: coltyp }); | ||
465 | + | ||
458 | $.ajax({ | 466 | $.ajax({ |
459 | type: 'POST', | 467 | type: 'POST', |
460 | url: '/product/item/togglecollect', | 468 | url: '/product/item/togglecollect', |
@@ -99,7 +99,6 @@ exports.init = function(num) { | @@ -99,7 +99,6 @@ exports.init = function(num) { | ||
99 | containerPt, // 商品列表容器的上内边距 | 99 | containerPt, // 商品列表容器的上内边距 |
100 | _from = event.target.attr('data-from') || ''; | 100 | _from = event.target.attr('data-from') || ''; |
101 | 101 | ||
102 | - | ||
103 | pics = []; | 102 | pics = []; |
104 | event.target.find('.hideList > li').each(function() { | 103 | event.target.find('.hideList > li').each(function() { |
105 | pic = $(this).data(); | 104 | pic = $(this).data(); |
@@ -138,6 +137,7 @@ exports.init = function(num) { | @@ -138,6 +137,7 @@ exports.init = function(num) { | ||
138 | if (diffWidth <= 0) { | 137 | if (diffWidth <= 0) { |
139 | wrapperX = wrapperX + diffWidth - 25; | 138 | wrapperX = wrapperX + diffWidth - 25; |
140 | } | 139 | } |
140 | + $goodItemWrapper.attr('activeIndex', event.activeIndex); | ||
141 | $goodItemWrapper.css({ | 141 | $goodItemWrapper.css({ |
142 | width: wrapperWidth, | 142 | width: wrapperWidth, |
143 | left: wrapperX, | 143 | left: wrapperX, |
@@ -3,10 +3,30 @@ | @@ -3,10 +3,30 @@ | ||
3 | * @author: sefon 2016-7-12 15:28:22 | 3 | * @author: sefon 2016-7-12 15:28:22 |
4 | */ | 4 | */ |
5 | 5 | ||
6 | -var $ = require('yoho-jquery'), | ||
7 | - lazyLoad = require('yoho-jquery-lazyload'); | 6 | +var $ = require('yoho-jquery'); |
7 | +var yas = require('../common/data-yas'); | ||
8 | +var lazyLoad = require('yoho-jquery-lazyload'); | ||
9 | + | ||
10 | + | ||
8 | 11 | ||
9 | var product = require('./index/product'); | 12 | var product = require('./index/product'); |
13 | +var qs = {}; | ||
14 | + | ||
15 | +var $footPage = $('.foot-pager1').data('total'), | ||
16 | + $productIdArr = [], | ||
17 | + $leftUl = $('.sort-container .sort-child-list'), | ||
18 | + $leftLi = $leftUl.find('li.active'); | ||
19 | + | ||
20 | +var listType = $('.path-nav').attr('listType'), | ||
21 | + brandId = $('.path-nav').attr('brandId'); | ||
22 | + | ||
23 | +var filterValue = yas.getFilterValue(); | ||
24 | + | ||
25 | +var commonParams = {}; | ||
26 | + | ||
27 | +$('.good-info .product-id').each(function() { | ||
28 | + $productIdArr.push($(this).html()); | ||
29 | +}); | ||
10 | 30 | ||
11 | require('../common'); | 31 | require('../common'); |
12 | require('../plugins/filter'); | 32 | require('../plugins/filter'); |
@@ -22,3 +42,88 @@ product.init(4); | @@ -22,3 +42,88 @@ product.init(4); | ||
22 | lazyLoad($('img.lazy'), { | 42 | lazyLoad($('img.lazy'), { |
23 | failure_limit: 20 | 43 | failure_limit: 20 |
24 | }); | 44 | }); |
45 | +qs = window.queryString(); | ||
46 | +commonParams = { | ||
47 | + PAGE_NUM: qs.pager || 1, | ||
48 | + FILTER_VALUE: filterValue, | ||
49 | + L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '', | ||
50 | + L2_SORT: $leftLi.find('a').attr('title') || '', | ||
51 | + SORT_TYPE: qs.order || 's_n_desc' | ||
52 | +}; | ||
53 | + | ||
54 | +// 时间戳格式化 | ||
55 | +function getLocalTime(nS) { | ||
56 | + return new Date(parseInt(nS, 10) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' '); | ||
57 | +} | ||
58 | + | ||
59 | +/* | ||
60 | + * 页面加载完 | ||
61 | + */ | ||
62 | +$(function() { | ||
63 | + var sto = setInterval(function() { | ||
64 | + var loadYas = {}; | ||
65 | + | ||
66 | + if (window._yas && window._yas.sendCustomInfo) { | ||
67 | + loadYas = { | ||
68 | + RES_QTY: $footPage || 0, | ||
69 | + PRD_LIST: $productIdArr.join(',') | ||
70 | + }; | ||
71 | + switch (listType) { | ||
72 | + case 'search': | ||
73 | + loadYas.KEYWORD = qs.query || ''; | ||
74 | + break; | ||
75 | + case 'brand': | ||
76 | + loadYas.BRAND_ID = brandId; | ||
77 | + break; | ||
78 | + case 'new': | ||
79 | + loadYas.SHELF_TIME = 'ALL'; | ||
80 | + break; | ||
81 | + default:// 品类查找sort | ||
82 | + loadYas.CATEGORY_ID = qs.misort || qs.msort || ''; | ||
83 | + break; | ||
84 | + } | ||
85 | + loadYas = $.extend(loadYas, commonParams); | ||
86 | + | ||
87 | + // 关键词搜索结果页展示时 | ||
88 | + yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas); | ||
89 | + clearInterval(sto); | ||
90 | + } | ||
91 | + }, 100); | ||
92 | + | ||
93 | + // 点击搜索列表商品 | ||
94 | + $('.good-item-wrapper').click(function() { | ||
95 | + var $this = $(this), | ||
96 | + proId = $this.find('.product-id').html(), | ||
97 | + aIndex = $this.attr('activeIndex'), | ||
98 | + pageNum = qs.pager || 1, | ||
99 | + limit = qs.limit || 60, | ||
100 | + proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10), | ||
101 | + shelveTime = $this.find('.shelve-time').html(); | ||
102 | + | ||
103 | + var loadYas = { | ||
104 | + PRD_ID: proId, | ||
105 | + PRD_NUM: proNum | ||
106 | + }; | ||
107 | + | ||
108 | + switch (listType) { | ||
109 | + case 'search': | ||
110 | + loadYas.KEYWORD = qs.query || ''; | ||
111 | + break; | ||
112 | + case 'brand': | ||
113 | + loadYas.BRAND_ID = brandId; | ||
114 | + break; | ||
115 | + case 'new': | ||
116 | + loadYas.SHELF_TIME = getLocalTime(shelveTime); | ||
117 | + break; | ||
118 | + default:// 品类查找sort | ||
119 | + loadYas.CATEGORY_ID = qs.misort || qs.msort || ''; | ||
120 | + break; | ||
121 | + } | ||
122 | + loadYas = $.extend(loadYas, commonParams); | ||
123 | + | ||
124 | + // 点击搜索列表商品埋点 | ||
125 | + yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas); | ||
126 | + }); | ||
127 | +}); | ||
128 | + | ||
129 | + |
@@ -3,10 +3,30 @@ | @@ -3,10 +3,30 @@ | ||
3 | * @author: sefon 2016-7-12 15:28:22 | 3 | * @author: sefon 2016-7-12 15:28:22 |
4 | */ | 4 | */ |
5 | 5 | ||
6 | -var $ = require('yoho-jquery'), | ||
7 | - lazyLoad = require('yoho-jquery-lazyload'); | 6 | +var $ = require('yoho-jquery'); |
7 | +var yas = require('../common/data-yas'); | ||
8 | +var lazyLoad = require('yoho-jquery-lazyload'); | ||
9 | + | ||
10 | + | ||
8 | 11 | ||
9 | var product = require('./index/product'); | 12 | var product = require('./index/product'); |
13 | +var qs = {}; | ||
14 | + | ||
15 | +var $footPage = $('.foot-pager1').data('total'), | ||
16 | + $productIdArr = [], | ||
17 | + $leftUl = $('.sort-container .sort-child-list'), | ||
18 | + $leftLi = $leftUl.find('li.active'); | ||
19 | + | ||
20 | +var listType = $('.path-nav').attr('listType'), | ||
21 | + brandId = $('.path-nav').attr('brandId'); | ||
22 | + | ||
23 | +var filterValue = yas.getFilterValue(); | ||
24 | + | ||
25 | +var commonParams = {}; | ||
26 | + | ||
27 | +$('.good-info .product-id').each(function() { | ||
28 | + $productIdArr.push($(this).html()); | ||
29 | +}); | ||
10 | 30 | ||
11 | require('../common'); | 31 | require('../common'); |
12 | require('../plugins/filter'); | 32 | require('../plugins/filter'); |
@@ -15,6 +35,93 @@ require('./detail/latest-walk'); | @@ -15,6 +35,93 @@ require('./detail/latest-walk'); | ||
15 | 35 | ||
16 | product.init(4); | 36 | product.init(4); |
17 | 37 | ||
38 | + | ||
39 | + | ||
18 | lazyLoad($('img.lazy'), { | 40 | lazyLoad($('img.lazy'), { |
19 | failure_limit: 20 | 41 | failure_limit: 20 |
20 | }); | 42 | }); |
43 | +qs = window.queryString(); | ||
44 | +commonParams = { | ||
45 | + PAGE_NUM: qs.pager || 1, | ||
46 | + FILTER_VALUE: filterValue, | ||
47 | + L1_SORT: $leftLi.length > 0 ? $leftLi.parent().prev().attr('title') : '', | ||
48 | + L2_SORT: $leftLi.find('a').attr('title') || '', | ||
49 | + SORT_TYPE: qs.order || 's_n_desc' | ||
50 | +}; | ||
51 | + | ||
52 | +// 时间戳格式化 | ||
53 | +function getLocalTime(nS) { | ||
54 | + return new Date(parseInt(nS, 10) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' '); | ||
55 | +} | ||
56 | + | ||
57 | +/* | ||
58 | + * 页面加载完 | ||
59 | + */ | ||
60 | +$(function() { | ||
61 | + var sto = setInterval(function() { | ||
62 | + var loadYas = {}; | ||
63 | + | ||
64 | + if (window._yas && window._yas.sendCustomInfo) { | ||
65 | + loadYas = { | ||
66 | + RES_QTY: $footPage || 0, | ||
67 | + PRD_LIST: $productIdArr.join(',') | ||
68 | + }; | ||
69 | + switch (listType) { | ||
70 | + case 'search': | ||
71 | + loadYas.KEYWORD = qs.query || ''; | ||
72 | + break; | ||
73 | + case 'brand': | ||
74 | + loadYas.BRAND_ID = brandId; | ||
75 | + break; | ||
76 | + case 'new': | ||
77 | + loadYas.SHELF_TIME = 'ALL'; | ||
78 | + break; | ||
79 | + default:// 品类查找sort | ||
80 | + loadYas.CATEGORY_ID = qs.misort || qs.msort || ''; | ||
81 | + break; | ||
82 | + } | ||
83 | + loadYas = $.extend(loadYas, commonParams); | ||
84 | + | ||
85 | + // 关键词搜索结果页展示时 | ||
86 | + yas.givePoint('YB_KEYWORD_GOODS_LIST_L', loadYas); | ||
87 | + clearInterval(sto); | ||
88 | + } | ||
89 | + }, 100); | ||
90 | + | ||
91 | + // 点击搜索列表商品 | ||
92 | + $('.good-item-wrapper').click(function() { | ||
93 | + var $this = $(this), | ||
94 | + proId = $this.find('.product-id').html(), | ||
95 | + aIndex = $this.attr('activeIndex'), | ||
96 | + pageNum = qs.pager || 1, | ||
97 | + limit = qs.limit || 60, | ||
98 | + proNum = (parseInt(pageNum, 10) - 1) * limit + parseInt(aIndex, 10), | ||
99 | + shelveTime = $this.find('.shelve-time').html(); | ||
100 | + | ||
101 | + var loadYas = { | ||
102 | + PRD_ID: proId, | ||
103 | + PRD_NUM: proNum | ||
104 | + }; | ||
105 | + | ||
106 | + switch (listType) { | ||
107 | + case 'search': | ||
108 | + loadYas.KEYWORD = qs.query || ''; | ||
109 | + break; | ||
110 | + case 'brand': | ||
111 | + loadYas.BRAND_ID = brandId; | ||
112 | + break; | ||
113 | + case 'new': | ||
114 | + loadYas.SHELF_TIME = getLocalTime(shelveTime); | ||
115 | + break; | ||
116 | + default:// 品类查找sort | ||
117 | + loadYas.CATEGORY_ID = qs.misort || qs.msort || ''; | ||
118 | + break; | ||
119 | + } | ||
120 | + loadYas = $.extend(loadYas, commonParams); | ||
121 | + | ||
122 | + // 点击搜索列表商品埋点 | ||
123 | + yas.givePoint('YB_KEYWORD_GOODS_LIST_C', loadYas); | ||
124 | + }); | ||
125 | +}); | ||
126 | + | ||
127 | + |
-
Please register or login to post a comment