...
|
...
|
@@ -38,7 +38,7 @@ |
|
|
import { get, find } from 'lodash';
|
|
|
import { Style, Scroll, Sticky } from 'cube-ui';
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
import queryString from 'query-string';
|
|
|
import queryString from 'querystring';
|
|
|
import Swiper from './components/swiper';
|
|
|
import Banner from './components/banner';
|
|
|
import TwoBanner from './components/twoBanner';
|
...
|
...
|
@@ -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: {
|
...
|
...
|
@@ -136,6 +136,7 @@ export default { |
|
|
this.getAllInboxCatInfo();
|
|
|
|
|
|
this.PAGE_URL = window.location.href;
|
|
|
|
|
|
// 首页进入上报
|
|
|
this.$store.dispatch('reportYas', {
|
|
|
params: {
|
...
|
...
|
@@ -158,9 +159,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 = [];
|
...
|
...
|
@@ -169,42 +171,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 = {};
|
|
|
|
|
|
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 (item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({}, reportParams, {I_INDEX: 0});
|
|
|
}
|
|
|
});
|
|
|
Object.keys(reportMoreParams).length && this.homeYasParams.push(reportMoreParams);
|
|
|
}
|
|
|
} else { // 默认进入时
|
|
|
if(eleTop < scrollHeight) { // 获取每个元素距顶部高度 小于可视区高度即曝光
|
|
|
if (eleTop < scrollHeight) { // 获取每个元素距顶部高度 小于可视区高度即曝光
|
|
|
// console.log(item.template_name)
|
|
|
let reportMoreParams = {};
|
|
|
|
|
|
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 (item.template_name === 'image_list') {
|
|
|
reportMoreParams = Object.assign({}, reportParams, {I_INDEX: 0});
|
|
|
}
|
|
|
});
|
|
|
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: {
|
...
|
...
|
@@ -214,11 +231,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);
|
|
|
}
|
...
|
...
|
@@ -226,44 +244,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;
|
...
|
...
|
@@ -271,9 +291,11 @@ export default { |
|
|
if (this.navTop) {
|
|
|
if (this.scrollY >= this.navTop) {
|
|
|
this.isShow = true;
|
|
|
|
|
|
// this.isA = false;
|
|
|
} else {
|
|
|
this.isShow = false;
|
|
|
|
|
|
// this.isA = true;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -283,8 +305,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() {
|
...
|
...
|
@@ -324,7 +347,7 @@ export default { |
|
|
delete searchParams[key];
|
|
|
}
|
|
|
}
|
|
|
try{
|
|
|
try {
|
|
|
let result = await this.fetchProductList({
|
|
|
...searchParams,
|
|
|
page,
|
...
|
...
|
@@ -347,15 +370,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() {
|
...
|
...
|
|