...
|
...
|
@@ -6,7 +6,8 @@ var $ = require('yoho-jquery'), |
|
|
|
|
|
var Swiper = require('yoho-swiper');
|
|
|
var yas = require('../common/data-yas');
|
|
|
var $goodInfo = $('.new-arrive-list .good-info');
|
|
|
var $arriveList = $('.new-arrive-list');
|
|
|
var $goodInfo = $arriveList.find('.good-info');
|
|
|
|
|
|
require('../common');
|
|
|
require('../plugins/slider');
|
...
|
...
|
@@ -15,6 +16,87 @@ require('yoho-jquery-pjax'); |
|
|
$('.slide-container').slider();
|
|
|
$('.left-one').slider();
|
|
|
|
|
|
// 获取最新上架,列表埋点数据
|
|
|
function getProListData() {
|
|
|
var goodsData = [];
|
|
|
|
|
|
$goodInfo.each(function() {
|
|
|
var $good = $(this),
|
|
|
recType = $good.attr('recommend-type'),
|
|
|
goodObj = {
|
|
|
I_INDEX: parseInt($good.index(), 10) + 1,
|
|
|
RECOMMEND_TYPE: recType
|
|
|
},
|
|
|
cateIds = [],
|
|
|
keys = [];
|
|
|
|
|
|
// 文章
|
|
|
if (recType === 'fashionArticle') {
|
|
|
goodObj.ARTICLE_ID = $good.data('articalid');
|
|
|
}
|
|
|
|
|
|
// 热门品类
|
|
|
if (recType === 'seasonSort') {
|
|
|
$good.find('.list-box li').each(function() {
|
|
|
cateIds.push($(this).data('cateid'));
|
|
|
});
|
|
|
goodObj.CATE_ID = cateIds.join(',');
|
|
|
}
|
|
|
|
|
|
// 店铺
|
|
|
if (recType === 'hotShop') {
|
|
|
|
|
|
goodObj.SHOP_ID = $good.data('shopid');
|
|
|
}
|
|
|
|
|
|
// 热门搜索
|
|
|
if (recType === 'hotSearchTerm') {
|
|
|
$good.find('.list-box li').each(function() {
|
|
|
keys.push($(this).find('a').html());
|
|
|
});
|
|
|
goodObj.KEYWORD_WORD = keys.join(',');
|
|
|
}
|
|
|
|
|
|
// 普通商品
|
|
|
if (!recType) {
|
|
|
goodObj.PRD_SKN = $good.data('skn');
|
|
|
delete goodObj.RECOMMEND_TYPE;
|
|
|
}
|
|
|
goodsData.push(goodObj);
|
|
|
});
|
|
|
return goodsData;
|
|
|
}
|
|
|
|
|
|
// 获取最新上架,点击埋点数据
|
|
|
function getProData($good) {
|
|
|
var recType = $good.attr('recommend-type'),
|
|
|
goodObj = {
|
|
|
I_INDEX: parseInt($good.index(), 10) + 1,
|
|
|
RECOMMEND_TYPE: recType
|
|
|
};
|
|
|
|
|
|
// 文章
|
|
|
if (recType === 'fashionArticle') {
|
|
|
goodObj.ARTICLE_ID = $good.data('articalid');
|
|
|
goodObj.F_URL = $good.find('.msg-title').attr('href');
|
|
|
}
|
|
|
|
|
|
// 店铺
|
|
|
if (recType === 'hotShop') {
|
|
|
goodObj.SHOP_ID = $good.data('shopid');
|
|
|
goodObj.F_URL = $good.find('.btn-tag > a').attr('href');
|
|
|
}
|
|
|
|
|
|
// 普通商品
|
|
|
if (!recType) {
|
|
|
goodObj.PRD_SKN = $good.data('skn');
|
|
|
goodObj.F_URL = $good.find('.good-detail-text > a').attr('href');
|
|
|
delete goodObj.RECOMMEND_TYPE;
|
|
|
}
|
|
|
|
|
|
return goodObj;
|
|
|
}
|
|
|
|
|
|
new Swiper('.rec-swiper', {
|
|
|
pagination: '.swiper-pagination',
|
|
|
paginationClickable: true,
|
...
|
...
|
@@ -50,8 +132,20 @@ $(document).pjax('.catagory-navs li:not(.active) > a', '#pjax-container', { |
|
|
});
|
|
|
|
|
|
$(document).on('pjax:complete', function() {
|
|
|
/* 加载页面数据埋点 */
|
|
|
var loadData = {
|
|
|
DATE: [{
|
|
|
F_ID: 1005,
|
|
|
F_NM: '最新上架',
|
|
|
F_INDEX: 5,
|
|
|
LIST: getProListData()
|
|
|
}]
|
|
|
};
|
|
|
|
|
|
$('html,body').scrollTop($('#new-product-floor').offset().top);
|
|
|
lazyLoad($('img.lazy'));
|
|
|
|
|
|
yas.givePoint('YB_SHOW_NEW_ARRIVAL', loadData);
|
|
|
});
|
|
|
|
|
|
$('#new-product-floor').on('click', '.catagory-navs li', function() {
|
...
|
...
|
@@ -83,49 +177,9 @@ $(function() { |
|
|
$brandSwiper.find('.prev,.next').addClass('hide');
|
|
|
}
|
|
|
});
|
|
|
function getProListData() {
|
|
|
var goodsData = [];
|
|
|
|
|
|
$goodInfo.each(function () {
|
|
|
var $good = $(this),
|
|
|
recType = $good.attr('recommend-type'),
|
|
|
goodObj = {
|
|
|
I_INDEX: parseInt($good.index(), 10) + 1,
|
|
|
RECOMMEND_TYPE: recType
|
|
|
},
|
|
|
cateIds = [],
|
|
|
keys = [];
|
|
|
//文章
|
|
|
if (recType === 'fashionArticle') {
|
|
|
goodObj.ARTICLE_ID = $good.data('articalid');
|
|
|
}
|
|
|
//热门品类
|
|
|
if (recType === 'seasonSort') {
|
|
|
$good.find('.list-box li').each(function () {
|
|
|
cateIds.push($(this).data('cateid'));
|
|
|
});
|
|
|
goodObj.CATE_ID = cateIds.join(',');
|
|
|
}
|
|
|
//店铺
|
|
|
if (recType === 'hotShop') {
|
|
|
|
|
|
goodObj.SHOP_ID = $good.data('shopid');
|
|
|
}
|
|
|
//热门搜索
|
|
|
if (recType === 'hotSearchTerm') {
|
|
|
$good.find('.list-box li').each(function () {
|
|
|
keys.push($(this).find('a').html());
|
|
|
});
|
|
|
goodObj.KEYWORD_WORD = keys.join(',');
|
|
|
}
|
|
|
if (!recType) {
|
|
|
goodObj.PRD_SKN = $good.data('skn')
|
|
|
}
|
|
|
goodsData.push(goodObj);
|
|
|
});
|
|
|
return goodsData;
|
|
|
}
|
|
|
$(function() {
|
|
|
|
|
|
var $bannerSlider = $('.slide-container .slide-wrapper li > a'),
|
|
|
$recSlider = $('#rec-swiper .swiper-slide > a'),
|
|
|
$brandSlider = $('#brand-swiper .swiper-slide > a'),
|
...
|
...
|
@@ -137,89 +191,92 @@ $(function() { |
|
|
brandData = [],
|
|
|
lookData = [];
|
|
|
|
|
|
$bannerSlider.each(function () {
|
|
|
/* 加载页面数据埋点 */
|
|
|
var loadData = {
|
|
|
DATE: [{
|
|
|
F_ID: 1001,
|
|
|
F_NM: 'banner',
|
|
|
F_INDEX: 1,
|
|
|
LIST: bannerData
|
|
|
}, {
|
|
|
F_ID: 1002,
|
|
|
F_NM: '为您推荐',
|
|
|
F_INDEX: 2,
|
|
|
LIST: recData
|
|
|
}, {
|
|
|
F_ID: 1003,
|
|
|
F_NM: '新品牌入驻',
|
|
|
F_INDEX: 3,
|
|
|
LIST: brandData
|
|
|
}, {
|
|
|
F_ID: 1004,
|
|
|
F_NM: '精彩抢先看',
|
|
|
F_INDEX: 4,
|
|
|
LIST: lookData
|
|
|
}, {
|
|
|
F_ID: 1005,
|
|
|
F_NM: '最新上架',
|
|
|
F_INDEX: 5,
|
|
|
LIST: getProListData()
|
|
|
}]
|
|
|
};
|
|
|
|
|
|
$bannerSlider.each(function() {
|
|
|
var $a = $(this),
|
|
|
index = $a.parent().index();
|
|
|
|
|
|
bannerData.push({
|
|
|
I_INDEX: parseInt(index, 10) + 1,
|
|
|
IMAGE_URL: $a.find('img').attr('src'),
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$recSlider.each(function () {
|
|
|
$recSlider.each(function() {
|
|
|
var $slider = $(this).parent();
|
|
|
|
|
|
recData.push({
|
|
|
I_INDEX: parseInt($slider.index(), 10) + 1,
|
|
|
BRAND_ID: $slider.data('brandid'),
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$brandSlider.each(function () {
|
|
|
$brandSlider.each(function() {
|
|
|
var $slider = $(this).parent();
|
|
|
|
|
|
brandData.push({
|
|
|
I_INDEX: parseInt($slider.index(), 10) + 1,
|
|
|
BRAND_ID: $slider.data('brandid'),
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$lookSlider.each(function () {
|
|
|
$lookSlider.each(function() {
|
|
|
var $a = $(this),
|
|
|
index = $a.parent().index();
|
|
|
|
|
|
lookData.push({
|
|
|
I_INDEX: parseInt(index, 10) + 1,
|
|
|
IMAGE_URL: $a.find('img').attr('src'),
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$lookRight.each(function () {
|
|
|
$lookRight.each(function() {
|
|
|
var $a = $(this),
|
|
|
index = $a.index();
|
|
|
|
|
|
lookData.push({
|
|
|
I_INDEX: parseInt(index, 10) + 1 + $lookSlider.length,
|
|
|
IMAGE_URL: $a.find('img').attr('src'),
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
ACTION_URL: $a.attr('href')
|
|
|
});
|
|
|
});
|
|
|
|
|
|
/* 加载页面数据埋点 */
|
|
|
var loadData = {
|
|
|
DATE: [{
|
|
|
F_ID: 1001,
|
|
|
F_NM: 'banner',
|
|
|
F_INDEX: 1,
|
|
|
LIST: bannerData
|
|
|
},{
|
|
|
F_ID: 1002,
|
|
|
F_NM: '为您推荐',
|
|
|
F_INDEX: 2,
|
|
|
LIST: recData
|
|
|
},{
|
|
|
F_ID: 1003,
|
|
|
F_NM: '新品牌入驻',
|
|
|
F_INDEX: 3,
|
|
|
LIST: brandData
|
|
|
},{
|
|
|
F_ID: 1004,
|
|
|
F_NM: '精彩抢先看',
|
|
|
F_INDEX: 4,
|
|
|
LIST: lookData
|
|
|
},{
|
|
|
F_ID: 1005,
|
|
|
F_NM: '最新上架',
|
|
|
F_INDEX: 5,
|
|
|
LIST: getProListData()
|
|
|
}]
|
|
|
};
|
|
|
|
|
|
yas.givePoint('YB_SHOW_NEW_ARRIVAL', loadData);
|
|
|
|
|
|
/* banner点击埋点*/
|
|
|
$bannerSlider.click(function() {
|
|
|
var $a = $(this),
|
...
|
...
|
@@ -247,7 +304,7 @@ $(function() { |
|
|
F_INDEX: 2,
|
|
|
I_INDEX: parseInt(index, 10) + 1,
|
|
|
BRAND_ID: $slider.data('brandid'),
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
};
|
|
|
|
|
|
yas.givePoint('YB_NEW_ARRIVAL_FLR_C', option);
|
...
|
...
|
@@ -265,7 +322,7 @@ $(function() { |
|
|
F_INDEX: 3,
|
|
|
I_INDEX: parseInt(index, 10) + 1,
|
|
|
BRAND_ID: $slider.data('brandid'),
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
SHOP_ID: $slider.data('shopid')
|
|
|
};
|
|
|
|
|
|
yas.givePoint('YB_NEW_ARRIVAL_FLR_C', option);
|
...
|
...
|
@@ -300,6 +357,43 @@ $(function() { |
|
|
|
|
|
yas.givePoint('YB_NEW_ARRIVAL_FLR_C', option);
|
|
|
});
|
|
|
|
|
|
/* 最新上架商品点击埋点*/
|
|
|
|
|
|
$arriveList.on('click', '.good-detail-img,.good-detail-text,.brand-box,.guang-box', function() {
|
|
|
var goodData = {
|
|
|
F_ID: 1005,
|
|
|
F_NM: '最新上架',
|
|
|
F_INDEX: 5
|
|
|
};
|
|
|
|
|
|
$.extend(goodData, getProData($(this).closest('.good-info')));
|
|
|
yas.givePoint('YB_NEW_ARRIVAL_FLR_C', goodData);
|
|
|
});
|
|
|
|
|
|
/* 最新上架商品点击埋点*/
|
|
|
$arriveList.on('click', '.list-box a', function() {
|
|
|
var goodData = {
|
|
|
F_ID: 1005,
|
|
|
F_NM: '最新上架',
|
|
|
F_INDEX: 5
|
|
|
};
|
|
|
var $good = $(this).closest('.good-info'),
|
|
|
recType = $good.attr('recommend-type'),
|
|
|
$li = $(this).parent();
|
|
|
|
|
|
goodData.F_URL = $(this).attr('href');
|
|
|
goodData.L_INDEX = parseInt($li.index(), 10) + 1;
|
|
|
|
|
|
// 应季品类
|
|
|
if (recType === 'seasonSort') {
|
|
|
goodData.CATE_ID = $li.data('cateid');
|
|
|
}
|
|
|
|
|
|
// 热门搜索
|
|
|
if (recType === 'hotSearchTerm') {
|
|
|
goodData.KEYWORD_WORD = $(this).html();
|
|
|
}
|
|
|
$.extend(goodData, getProData($good));
|
|
|
yas.givePoint('YB_NEW_ARRIVAL_FLR_C', goodData);
|
|
|
});
|
|
|
}); |
...
|
...
|
|