Merge branch 'feature/collectListYas' into release/5.2
Showing
1 changed file
with
17 additions
and
44 deletions
@@ -48,8 +48,7 @@ var $saleReturn = $('#saleReturn'); | @@ -48,8 +48,7 @@ var $saleReturn = $('#saleReturn'); | ||
48 | 48 | ||
49 | var dialogTpl = require('hbs/product/coupon-dialog.hbs'); | 49 | var dialogTpl = require('hbs/product/coupon-dialog.hbs'); |
50 | 50 | ||
51 | -var $goodsIdArr = [], | ||
52 | - pageNum = 1; | 51 | +var $goodsIdArr = []; |
53 | 52 | ||
54 | function limitedProductUrl(s) { | 53 | function limitedProductUrl(s) { |
55 | return window.location.href + '?openby:yohobuy={"action":"go.limitpurchase","params":{"lp":"' + s + '"}}'; | 54 | return window.location.href + '?openby:yohobuy={"action":"go.limitpurchase","params":{"lp":"' + s + '"}}'; |
@@ -1058,43 +1057,21 @@ function randomString(len) { | @@ -1058,43 +1057,21 @@ function randomString(len) { | ||
1058 | /* | 1057 | /* |
1059 | * 页面加载完 | 1058 | * 页面加载完 |
1060 | */ | 1059 | */ |
1061 | -function initPageYas(pNum) { | ||
1062 | - var loadYas = {}, | ||
1063 | - starIndex = (parseInt(pNum, 10) - 1) * 5, | ||
1064 | - endIndex = parseInt(pNum, 10) * 5; | ||
1065 | - | ||
1066 | - var pageGoods = $goodsIdArr.slice(starIndex, endIndex); | ||
1067 | - | ||
1068 | - loadYas = { | 1060 | +function initPageYas() { |
1061 | + var loadYas = { | ||
1069 | REC_POSE: 100013, | 1062 | REC_POSE: 100013, |
1070 | REC_ID: randomString(40), | 1063 | REC_ID: randomString(40), |
1071 | - PRD_ID: pageGoods.join(','), | ||
1072 | - PRD_NUM: pageGoods.length, | 1064 | + PRD_ID: $goodsIdArr.join(','), |
1065 | + PRD_NUM: $goodsIdArr.length, | ||
1073 | ORDER_CODE: '', | 1066 | ORDER_CODE: '', |
1074 | ACTION_ID: 0, | 1067 | ACTION_ID: 0, |
1075 | - PAGE_NUM: pNum | 1068 | + PAGE_NUM: 1 |
1076 | }; | 1069 | }; |
1077 | 1070 | ||
1078 | // 关键词搜索结果页展示时 | 1071 | // 关键词搜索结果页展示时 |
1079 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); | 1072 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); |
1080 | } | 1073 | } |
1081 | 1074 | ||
1082 | -/* | ||
1083 | - * 左右箭头埋点 | ||
1084 | - */ | ||
1085 | -function arrowYas($arrow) { | ||
1086 | - var totalPage = Math.ceil($goodsIdArr.length / 5); | ||
1087 | - | ||
1088 | - if ($arrow.hasClass('prev') && pageNum > 1) { | ||
1089 | - pageNum--; | ||
1090 | - } | ||
1091 | - if ($arrow.hasClass('next') && pageNum < totalPage) { | ||
1092 | - pageNum++; | ||
1093 | - } | ||
1094 | - | ||
1095 | - initPageYas(pageNum); | ||
1096 | -} | ||
1097 | - | ||
1098 | // 店铺推荐 | 1075 | // 店铺推荐 |
1099 | function loadRecommend() { | 1076 | function loadRecommend() { |
1100 | $.ajax({ | 1077 | $.ajax({ |
@@ -1126,8 +1103,7 @@ function loadRecommend() { | @@ -1126,8 +1103,7 @@ function loadRecommend() { | ||
1126 | $('#recommend-content').append(html); | 1103 | $('#recommend-content').append(html); |
1127 | $('.recommend-slider').slider2({ | 1104 | $('.recommend-slider').slider2({ |
1128 | shownum: 5, | 1105 | shownum: 5, |
1129 | - isCircle: true, | ||
1130 | - yasFun: arrowYas | 1106 | + isCircle: true |
1131 | }); | 1107 | }); |
1132 | 1108 | ||
1133 | $('.recommend-slider .img-item .goods-id').each(function() { | 1109 | $('.recommend-slider .img-item .goods-id').each(function() { |
@@ -1140,32 +1116,29 @@ function loadRecommend() { | @@ -1140,32 +1116,29 @@ function loadRecommend() { | ||
1140 | } | 1116 | } |
1141 | 1117 | ||
1142 | // 页面加载完,埋点 | 1118 | // 页面加载完,埋点 |
1143 | - initPageYas(pageNum); | 1119 | + initPageYas(); |
1120 | + }); | ||
1121 | +} | ||
1144 | 1122 | ||
1145 | - // 点击为您推荐商品埋点 | ||
1146 | - $('.recommend-slider .img-item').click(function() { | 1123 | +// 点击为您推荐商品埋点 |
1124 | +$('.recommend-slider').on('click', '.img-item', function() { | ||
1147 | var $this = $(this); | 1125 | var $this = $(this); |
1148 | - var index = parseInt($this.index(), 10) + 1; | ||
1149 | - var page = index / 5 <= 1 ? '' : Math.ceil(index / 5) + ''; | ||
1150 | - var num = index % 5 ? index % 5 + '' : '5'; | 1126 | + var proId = $this.find('.goods-id').html(); |
1151 | 1127 | ||
1152 | var loadYas = { | 1128 | var loadYas = { |
1153 | REC_POSE: 100013, | 1129 | REC_POSE: 100013, |
1154 | REC_ID: randomString(40), | 1130 | REC_ID: randomString(40), |
1155 | - PRD_ID: $this.find('.goods-id').html(), | ||
1156 | - PRD_NUM: page + num, | 1131 | + PRD_ID: proId, |
1132 | + PRD_NUM: $goodsIdArr.indexOf(proId) + 1, | ||
1157 | ORDER_CODE: '', | 1133 | ORDER_CODE: '', |
1158 | ACTION_ID: 1, | 1134 | ACTION_ID: 1, |
1159 | - PAGE_NUM: page === '' ? 1 : page | 1135 | + PAGE_NUM: 1 |
1160 | }; | 1136 | }; |
1161 | 1137 | ||
1162 | 1138 | ||
1163 | // 关键词搜索结果页展示时 | 1139 | // 关键词搜索结果页展示时 |
1164 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); | 1140 | yas.givePoint('YB_CHOOSE_FOR_YOU_Y', loadYas); |
1165 | - }); | ||
1166 | - | ||
1167 | - }); | ||
1168 | -} | 1141 | +}); |
1169 | 1142 | ||
1170 | window.loadRecommend = loadRecommend; | 1143 | window.loadRecommend = loadRecommend; |
1171 | 1144 |
-
Please register or login to post a comment