Authored by Tao

add report

... ... @@ -8,8 +8,20 @@
export default {
name: 'LayoutLink',
props: {
href: String
href: String,
report: {
type: Object,
}
},
watch: {
'report': function(newVal) {
console.log(newVal);
}
},
// activated() {
// console.log(this.report);
// console.log("this.report");
// },
methods: {
jumpTo() {
if (!this.href) {
... ...
... ... @@ -17,7 +17,7 @@
<input class="search-input" type="search" disabled="true" placeholder="搜索商品名称或货号"/>
</div>
<template v-for="(item, index) in channelList.list">
<Swiper @click="getParams" :list="item.data" :key="index" v-if="item.template_name == 'threePicture'"/>
<Swiper :list="item" :index="index" :key="index" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data" :key="index" v-if="item.template_name == 'image_list'"/>
<Banner :list="item.data" :key="index" v-if="item.template_name == 'single_image'"/>
<TwoBanner :list="item.data" :key="index" v-if="item.template_name == 'twoPicture'"/>
... ... @@ -56,6 +56,7 @@ export default {
props: ['hideHeader'],
data() {
return {
reportParams: {},
options: {
pullUpLoad: true,
// pullDownRefresh: true,
... ... @@ -73,7 +74,6 @@ export default {
listBaseParams: {
isHome: true,
},
productList: {
showErrorPage: false,
isFetching: false,
... ... @@ -118,13 +118,11 @@ export default {
if (!this.channelList.list || !this.channelList.list.length) {
this.fetchChannelList();
}
this.init();
},
async serverPrefetch() {
return this.fetchChannelList();
},
mounted() {
this.init();
},
methods: {
...mapActions(['fetchChannelList']),
...mapActionsList(['fetchProductList']),
... ... @@ -225,9 +223,26 @@ export default {
});
},
getParams() {
console.log("2222");
getParams(params) {
this.reportParams = params;
console.log(this.reportParams);
}
// getReportParams(item, index) {
// let { template_id, template_name } = item;
// let PAGE_URL = window.location.href;
// this.searchParams = {
// F_ID: template_id,
// PAGE_URL,
// F_INDEX: index + 1,
// F_NAME: template_name,
// I_INDEX: '',
// F_URL: '',
// }
// console.log(item);
// console.log(this.searchParams);
// }
// onPullingDown() {
// let params = this.searchParams;
... ...
<template>
<div v-if="list.length" class="swiper">
<div class="swiper" v-if="list.data && list.data.length > 0">
<div class="swiper-item swiper-item-left">
<LayoutLink :href="list[0].url" :report="reportParams" class="img-link">
<ImageFormat :lazy="false" class="item-imge" :src="list[0].src" :width="310" :height="402"></ImageFormat>
<LayoutLink :href="list.data[0].url" class="img-link" :report="{...params, I_INDEX: 1}">
<ImageFormat :lazy="false" class="item-imge" :src="list.data[0].src" :width="310" :height="402"></ImageFormat>
</LayoutLink>
</div>
<div class="swiper-item swiper-item-right">
<LayoutLink :href="list[1].url" class="img-link">
<ImageFormat :lazy="false" class="item-imge" :src="list[1].src" :width="380" :height="196"></ImageFormat>
<LayoutLink :href="list.data[1].url" class="img-link" :report="{...params, I_INDEX: 2}">
<ImageFormat :lazy="false" class="item-imge" :src="list.data[1].src" :width="380" :height="196"></ImageFormat>
</LayoutLink>
<LayoutLink :href="list[2].url" class="img-link">
<ImageFormat :lazy="false" class="item-imge" :src="list[2].src" :width="380" :height="196"></ImageFormat>
<LayoutLink :href="list.data[2].url" class="img-link" :report="{...params, I_INDEX: 3}">
<ImageFormat :lazy="false" class="item-imge" :src="list.data[2].src" :width="380" :height="196"></ImageFormat>
</LayoutLink>
</div>
</div>
... ... @@ -21,24 +21,38 @@ export default {
name: 'swiper',
props: {
list: {
type: Array,
default: []
type: Object,
},
index: {
type: Number,
}
},
data() {
return {
reportParams: {
P_NAME: 'XY_UFOHome',
P_PARAM: 'f788335b57b67c1711f255648c744dab',
PAGE_URL: '当前页面URL',
F_ID: '楼层唯一id',
F_NAME: '楼层名称',
F_INDEX: '楼层顺序号',
I_INDEX: '楼层内部顺序号,从1开始,所有more按钮传0',
ACTION_URL: '跳转URL',
},
params: {},
}
}
},
mounted() {
// console.log(this.list)
},
activated() {
let { template_id, template_name } = this.list;
let PAGE_URL = window.location.href;
let F_INDEX = this.index + 1;
let params = {
P_NAME: 'XY_UFOHome',
P_PARAM: 'cfcd8de156d3edc26c84091804c43e23',
F_ID: template_id,
PAGE_URL,
F_INDEX,
F_NAME: template_name,
F_URL: 'F_URL',
}
this.params = params;
},
methods: {
},
};
</script>
... ...
... ... @@ -51,7 +51,7 @@ export default function() {
},
async fetchChannelList({ commit }) {
const result = await this.$api.get('/api/ufo/channel/channelList', {
content_code: 'cfcd8de156d3edc26c84091804c43e23',
content_code: 'f788335b57b67c1711f255648c744dab',
});
if (result.code === 200) {
commit(Types.FETCH_CHANNEL, { list: result.data });
... ...