...
|
...
|
@@ -61,8 +61,8 @@ export default { |
|
|
options: {
|
|
|
pullUpLoad: true,
|
|
|
},
|
|
|
scrollEvents: ['scroll','scroll-end'],
|
|
|
title:'闲鱼潮',
|
|
|
scrollEvents: ['scroll', 'scroll-end'],
|
|
|
title: '闲鱼潮',
|
|
|
scrollY: 0,
|
|
|
navTop: 0,
|
|
|
navHeight: 0,
|
...
|
...
|
@@ -113,7 +113,7 @@ export default { |
|
|
noItemStyle() {
|
|
|
return {
|
|
|
height: this.total + 'px'
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -135,6 +135,7 @@ export default { |
|
|
this.init();
|
|
|
|
|
|
this.PAGE_URL = window.location.href;
|
|
|
|
|
|
// 首页进入上报
|
|
|
this.$store.dispatch('reportYas', {
|
|
|
params: {
|
...
|
...
|
@@ -157,9 +158,10 @@ export default { |
|
|
this.navTop = this.$refs.topSource.offsetHeight;
|
|
|
this.navHeight = get(this.$refs, 'scrollNav.offsetHeight') || 0;
|
|
|
this.total = this.$refs.scroll.$el.offsetHeight - this.navHeight;
|
|
|
this.reportYas()
|
|
|
this.reportYas();
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 曝光上报
|
|
|
getReportEle(scrollY) {
|
|
|
this.homeYasParams = [];
|
...
|
...
|
@@ -168,53 +170,57 @@ export default { |
|
|
let eleHeight = 0;
|
|
|
let eleTop = 0;
|
|
|
let reportParams = {};
|
|
|
if(item.template_name !== 'guessLike') {
|
|
|
|
|
|
if (item.template_name !== 'guessLike') {
|
|
|
eleHeight = this.$refs[index][0].$el.offsetHeight;
|
|
|
eleTop = this.$refs[index][0].$el.offsetTop;
|
|
|
} else {
|
|
|
eleHeight = this.navHeight;
|
|
|
eleTop = this.navTop;
|
|
|
}
|
|
|
if(scrollY) { // 滚动时
|
|
|
if(scrollHeight + scrollY > eleTop && item.template_name === 'guessLike') {
|
|
|
if (scrollY) { // 滚动时
|
|
|
if (scrollHeight + scrollY > eleTop && item.template_name === 'guessLike') {
|
|
|
// console.log('guessLike report')
|
|
|
item.data.forEach((val, i) => {
|
|
|
reportParams = {...val.reportParams,PAGE_URL: this.PAGE_URL}
|
|
|
this.homeYasParams.push(reportParams)
|
|
|
})
|
|
|
reportParams = {...val.reportParams, PAGE_URL: this.PAGE_URL};
|
|
|
this.homeYasParams.push(reportParams);
|
|
|
});
|
|
|
|
|
|
}
|
|
|
if(scrollY < (eleTop + eleHeight) && item.template_name !== 'guessLike') {
|
|
|
if (scrollY < (eleTop + eleHeight) && item.template_name !== 'guessLike') {
|
|
|
// console.log(item.template_name)
|
|
|
let reportMoreParams = {}
|
|
|
let reportMoreParams = {};
|
|
|
|
|
|
item.data.forEach((val, i) => {
|
|
|
reportParams = {...val.reportParams,PAGE_URL: this.PAGE_URL}
|
|
|
reportParams = {...val.reportParams, PAGE_URL: this.PAGE_URL};
|
|
|
|
|
|
this.homeYasParams.push(reportParams)
|
|
|
if(item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({},reportParams,{I_INDEX: 0})
|
|
|
this.homeYasParams.push(reportParams);
|
|
|
if (item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({}, reportParams, {I_INDEX: 0});
|
|
|
}
|
|
|
})
|
|
|
Object.keys(reportMoreParams).length && this.homeYasParams.push(reportMoreParams)
|
|
|
});
|
|
|
Object.keys(reportMoreParams).length && this.homeYasParams.push(reportMoreParams);
|
|
|
}
|
|
|
} else { // 默认进入时
|
|
|
if(eleTop < scrollHeight) { // 获取每个元素距顶部高度 小于可视区高度即曝光
|
|
|
if (eleTop < scrollHeight) { // 获取每个元素距顶部高度 小于可视区高度即曝光
|
|
|
// console.log(item.template_name)
|
|
|
let reportMoreParams = {}
|
|
|
let reportMoreParams = {};
|
|
|
|
|
|
item.data.forEach((val, i) => {
|
|
|
reportParams = {...val.reportParams,PAGE_URL: this.PAGE_URL}
|
|
|
this.homeYasParams.push(reportParams)
|
|
|
if(item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({},reportParams,{I_INDEX: 0})
|
|
|
reportParams = {...val.reportParams, PAGE_URL: this.PAGE_URL};
|
|
|
this.homeYasParams.push(reportParams);
|
|
|
if (item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({}, reportParams, {I_INDEX: 0});
|
|
|
}
|
|
|
})
|
|
|
Object.keys(reportMoreParams).length && this.homeYasParams.push(reportMoreParams)
|
|
|
});
|
|
|
Object.keys(reportMoreParams).length && this.homeYasParams.push(reportMoreParams);
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
},
|
|
|
reportYas(scrollY) {
|
|
|
this.getReportEle(scrollY)
|
|
|
this.getReportEle(scrollY);
|
|
|
|
|
|
// console.log(this.homeYasParams)
|
|
|
this.$store.dispatch('reportYas', {
|
|
|
params: {
|
...
|
...
|
@@ -224,11 +230,12 @@ export default { |
|
|
});
|
|
|
},
|
|
|
setYasParam: function(params) {
|
|
|
console.log('setYas')
|
|
|
console.log('setYas');
|
|
|
let {total, list} = this.productList;
|
|
|
|
|
|
if (params && typeof params === 'object' && Object.keys(params).length) {
|
|
|
let P_NAME = 'XY_UFOSearchList', TYPE_ID = 1, P_PARAM = '', PRD_LIST = [];
|
|
|
|
|
|
for (let item of list) {
|
|
|
PRD_LIST.push(item.id);
|
|
|
}
|
...
|
...
|
@@ -236,44 +243,46 @@ export default { |
|
|
if (key === 'brand') {
|
|
|
P_NAME = 'XY_UFOBrandList';
|
|
|
TYPE_ID = 3;
|
|
|
P_PARAM = params[key]
|
|
|
P_PARAM = params[key];
|
|
|
}
|
|
|
if (key === 'series') {
|
|
|
P_NAME = 'XY_UFOSeriesList';
|
|
|
TYPE_ID = 2;
|
|
|
P_PARAM = params[key]
|
|
|
P_PARAM = params[key];
|
|
|
}
|
|
|
if (key === 'productPool') {
|
|
|
P_NAME = 'XY_UFOProductPoolList';
|
|
|
TYPE_ID = 4;
|
|
|
P_PARAM = params[key]
|
|
|
P_PARAM = params[key];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
this.listYasParams = Object.assign({},{
|
|
|
this.listYasParams = Object.assign({}, {
|
|
|
P_NAME,
|
|
|
P_PARAM,
|
|
|
TYPE_ID,
|
|
|
TAB_ID: Number(params.index) + 1,
|
|
|
TAB_NAME: params.title,
|
|
|
PRD_LIST: PRD_LIST.toString(),
|
|
|
TOTAL: total})
|
|
|
TOTAL: total});
|
|
|
|
|
|
// console.log(this.listYasParams)
|
|
|
}
|
|
|
},
|
|
|
getIndex({index,params}) {
|
|
|
getIndex({index, params}) {
|
|
|
this.selectedCategory = params;
|
|
|
this.active = Number(index);
|
|
|
this.isShow && this.$refs.scroll.scrollTo(this.navTop);
|
|
|
this.setYasParam({index,...params});
|
|
|
this.setYasParam({index, ...params});
|
|
|
},
|
|
|
scrollEndHandler({y}) {
|
|
|
let scrollHeight = Math.abs(y)
|
|
|
this.$refs.product && this.$refs.product.yasShowEvent(scrollHeight+this.navTop);
|
|
|
if(scrollHeight >= this.navTop) {
|
|
|
return
|
|
|
let scrollHeight = Math.abs(y);
|
|
|
|
|
|
this.$refs.product && this.$refs.product.yasShowEvent(scrollHeight + this.navTop);
|
|
|
if (scrollHeight >= this.navTop) {
|
|
|
return;
|
|
|
}
|
|
|
this.reportYas(scrollHeight)
|
|
|
this.reportYas(scrollHeight);
|
|
|
},
|
|
|
scrollHandler({ y }) {
|
|
|
this.scrollY = -y;
|
...
|
...
|
@@ -281,9 +290,11 @@ export default { |
|
|
if (this.navTop) {
|
|
|
if (this.scrollY >= this.navTop) {
|
|
|
this.isShow = true;
|
|
|
|
|
|
// this.isA = false;
|
|
|
} else {
|
|
|
this.isShow = false;
|
|
|
|
|
|
// this.isA = true;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -293,8 +304,9 @@ export default { |
|
|
|
|
|
this.searchParams = Object.assign({}, queryString.parse(str), this.listBaseParams);
|
|
|
await this.fetchList(this.searchParams);
|
|
|
|
|
|
// 列表上报数据
|
|
|
this.setYasParam({index: 0, ...this.searchParams})
|
|
|
this.setYasParam({index: 0, ...this.searchParams});
|
|
|
},
|
|
|
|
|
|
async onPullingUp() {
|
...
|
...
|
@@ -334,7 +346,7 @@ export default { |
|
|
delete searchParams[key];
|
|
|
}
|
|
|
}
|
|
|
try{
|
|
|
try {
|
|
|
let result = await this.fetchProductList({
|
|
|
...searchParams,
|
|
|
page,
|
...
|
...
|
@@ -357,15 +369,14 @@ export default { |
|
|
list[key] = data[key];
|
|
|
}
|
|
|
}
|
|
|
if(!Object.keys(data).includes('product_list')) {
|
|
|
list.list = []
|
|
|
}
|
|
|
this.productList = list;
|
|
|
}
|
|
|
}catch(e) {
|
|
|
} catch (e) {
|
|
|
// console.log(e);
|
|
|
if (this.productList.page <= 1) {
|
|
|
this.productList.list = [];
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
|
|
|
goSearch() {
|
...
|
...
|
|