Authored by baoss

替换猜你喜欢上报参数,优化列表上报

... ... @@ -35,7 +35,7 @@
</template>
<script>
import { get, find } from 'lodash';
import { get, find, findIndex } from 'lodash';
import { Style, Scroll, Sticky } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import queryString from 'querystring';
... ... @@ -58,6 +58,7 @@ export default {
PAGE_URL: '',
listYasParams: {},
homeYasParams: [],
listScrollY: 0,
options: {
pullUpLoad: true,
},
... ... @@ -106,10 +107,19 @@ export default {
};
},
computed: {
...mapState(['channelList']),
...mapState(['channelList','contentCode']),
navList() {
return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || [];
},
navInfo() {
let index = findIndex(this.channelList.list, ['template_name', 'guessLike'])
let id = get(find(this.channelList.list, ['template_name', 'guessLike']), 'template_id')
return {
F_ID: id,
F_NAME: 'guessLike',
F_INDEX: index + 1
}
},
noItemStyle() {
return {
height: this.total + 'px'
... ... @@ -270,16 +280,36 @@ export default {
// console.log(this.listYasParams)
}
},
guessLikeListParams(params) {
if (params && typeof params === 'object' && Object.keys(params).length) {
this.listYasParams = Object.assign({}, {
P_NAME: 'XY_UFOHome',
P_PARAM: this.contentCode,
PAGE_URL: this.PAGE_URL,
...this.navInfo,
I_INDEX: Number(params.index) + 1,
TAB_ID: Number(params.index) + 1,
TAB_NAME: params.title});
console.log(this.listYasParams)
}
},
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});
this.guessLikeListParams({index, ...params});
// 商品列表曝光
this.listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(this.listScrollY);
},
scrollEndHandler({y}) {
let scrollHeight = Math.abs(y);
this.$refs.product && this.$refs.product.yasShowEvent(scrollHeight + this.navTop);
let viewHeight = this.$refs.scroll.$el.offsetHeight;
let productListTop = this.$refs.product && this.$refs.product.$el.offsetTop || this.navTop + this.navHeight;
let listScrollY = scrollHeight + viewHeight - productListTop;
this.listScrollY = listScrollY
// 商品列表曝光
listScrollY > 0 && this.$refs.product && this.$refs.product.yasShowEvent(listScrollY);
if (scrollHeight >= this.navTop) {
return;
}
... ... @@ -307,7 +337,8 @@ export default {
await this.fetchList(this.searchParams);
// 列表上报数据
this.setYasParam({index: 0, ...this.searchParams});
// this.setYasParam({index: 0, ...this.searchParams});
this.guessLikeListParams({index: 0, ...this.searchParams});
},
async onPullingUp() {
... ...
... ... @@ -18,6 +18,7 @@ export default function() {
// scrollnavidList: [], // 导航菜单
current: 0,
},
contentCode: contentCode,
showMsg: false,
},
mutations: {
... ...