Feat(页面):页面埋点配置

This commit is contained in:
lifizer
2024-06-17 23:13:22 +08:00
parent 19914b5b0d
commit cef0177716
55 changed files with 552 additions and 377 deletions
+19 -8
View File
@@ -16,7 +16,7 @@
<image class="title" :src="webUrl+'/20230220023931078168.png'" mode="scaleToFill"/>
<view class="item flex" :style="{'backgroundImage':`url(${webUrl}/20230224102624521679.png)`}"
v-for="(item,index) in products" :key="index" @click="$global.navToGoods(item.id)">
v-for="(item,index) in products" :key="index" @click="goGoods(item.id)">
<image class="cover flex-0" style="margin-right: 20rpx" :src="item.image"
mode="scaleToFill" v-if="index%2===0"/>
@@ -42,24 +42,35 @@
</template>
<script>
import {getStoryDetail} from "@/api/product";
import {getStoryDetail} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "famousHot",
name: 'FamousHot',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
products: [],
id: null,
story: null
story: null,
pageKeyId: ''
}
},
onLoad(option) {
this.id = option.id;
const id = option.id
this.id = option.id
this.pageKeyId = `countyFamousContent_id_${id}`
getStoryDetail(this.id).then(({data}) => {
this.story = data;
this.products = data.products;
this.story = data
this.products = data.products
})
},
methods: {
goGoods(id) {
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${id}&from=famous`
})
}
}
}
</script>
+17 -14
View File
@@ -39,29 +39,32 @@
</template>
<script>
import {countyFamous} from "@/api/product";
import {getProducts} from "@/api/store";
import {famousShareImage} from "@/api/share";
import {mapGetters} from "vuex";
import cookie from "@/utils/store/cookie";
import {userBindParent} from "@/api/user";
import {getUrlParam} from "@/utils/common.js";
import {countyFamous} from '@/api/product'
import {getProducts} from '@/api/store'
import {famousShareImage} from '@/api/share'
import {mapGetters} from 'vuex'
import cookie from '@/utils/store/cookie'
import {userBindParent} from '@/api/user'
import {getUrlParam} from '@/utils/common.js'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "famousList",
name: 'FamousList',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
keyword: "",
keyword: '',
page: 1,
bannerList: [],
dataList: [],
navList: [],
navIndex: 0,
partnerId: null
partnerId: null,
pageKeyId: Object.freeze('countyFamousIndex')
}
},
computed: mapGetters(["userInfo", "isLogin"]),
computed: mapGetters(['userInfo', 'isLogin']),
onShareAppMessage() {
return new Promise(async (resolve, reject) => {
const {status, data} = await famousShareImage();
@@ -81,11 +84,11 @@ export default {
let obj = uni.getEnterOptionsSync();
if (options.scene != null || obj.query.scene != null) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.partnerId = getUrlParam(query, "partnerId") || null;
this.partnerId = getUrlParam(query, 'partnerId') || null;
}
}
if (this.partnerId) {
cookie.set("spread", this.partnerId);
cookie.set('spread', this.partnerId);
userBindParent({spread: parseInt(this.partnerId)});
}
@@ -132,7 +135,7 @@ export default {
},
goStory() {
uni.navigateTo({
url: "/pkg_product/views/famousStory"
url: '/pkg_product/views/famousStory'
})
}
}
+10 -7
View File
@@ -6,39 +6,42 @@
<script>
import {getStoryList} from "@/api/product";
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "famousStory",
mixins: [pageListenMixins],
data() {
return {
page: 1, // 当前页
pages: 1, // 总页数
list: []
list: [],
pageKeyId: Object.freeze('countyFamousContentList')
}
},
onLoad() {
this.fetchData();
this.fetchData()
},
onReachBottom() {
if (this.page < this.pages) {
this.page++;
this.fetchData();
this.page++
this.fetchData()
}
},
methods: {
fetchData() {
getStoryList(this.page).then(({data}) => {
this.pages = data.pages;
this.pages = data.pages
if (data.records.length > 0) {
for (let i = 0; i < data.records.length; i++) {
this.list.push(data.records[i]);
this.list.push(data.records[i])
}
}
})
},
goHot(item) {
uni.navigateTo({
url: "/pkg_product/views/famousHot?id=" + item.id
url: '/pkg_product/views/famousHot?id=' + item.id
})
}
}
+13 -3
View File
@@ -35,7 +35,7 @@
:class="cIndex === 0 ? 'span12' : 'span8'"
:src="item.image"
mode="scaleToFill"
@click="$global.navToGoods(item.id)"
@click="goGoods(item.id)"
/>
</view>
</view>
@@ -46,13 +46,16 @@
<script>
// 节日专题
import { getFestival } from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'Festival',
name: 'FestivalPage',
mixins: [pageListenMixins],
data() {
return {
isLoad: false,
topImage: '',
contents: []
contents: [],
pageKeyId: Object.freeze('appContentFestival')
}
},
onLoad() {
@@ -61,6 +64,13 @@ export default {
this.topImage = data.topImage
this.contents = data.contents
})
},
methods: {
goGoods(id) {
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${id}&from=festival`
})
}
}
}
</script>
+7 -2
View File
@@ -43,8 +43,10 @@
import {
customizedGiftContent
} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'GiftContent',
mixins: [pageListenMixins],
data() {
return {
data: {
@@ -55,6 +57,7 @@ export default {
mainImage: '',
productList1: [],
productList2: [],
pageKeyId: ''
}
}
},
@@ -62,7 +65,9 @@ export default {
uni.setNavigationBarTitle({
title: options.name + '-' + '特色礼品'
})
this.getPageDataReq(options.id)
const id = options.id
this.pageKeyId = `customizedGiftContent_id_${id}`
this.getPageDataReq(id)
},
methods: {
getPageDataReq(id) {
@@ -90,7 +95,7 @@ export default {
return
}
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${productId}`
url: `/pages/shop/GoodsCon/index?id=${productId}&from=gift`
})
}
}
+5 -2
View File
@@ -90,14 +90,17 @@
import {
customizedGift
} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'GiftList',
mixins: [pageListenMixins],
data() {
return {
provinceList: [],
topBannerHtml: '',
topBannerUrl: '',
toggleStatus: false
toggleStatus: false,
pageKeyId: Object.freeze('customizedGiftIndex')
}
},
onLoad() {
@@ -148,7 +151,7 @@ export default {
return
}
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${productId}`
url: `/pages/shop/GoodsCon/index?id=${productId}&from=gift`
})
},
toggleHandle(value) {
+10 -12
View File
@@ -1,23 +1,26 @@
<script>
import {getICH} from "@/api/product";
import {getICH} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "heritage",
name: 'HeritagePage',
mixins: [pageListenMixins],
data() {
return {
contents: [],
topImage: '',
backgroundImage: '',
bgImgWidth: 0,
pageKeyId: Object.freeze('ichIndex')
}
},
computed: {
scale() {
return 750 / this.bgImgWidth;
return 750 / this.bgImgWidth
}
},
onLoad() {
this.init();
this.init()
},
methods: {
init() {
@@ -29,17 +32,15 @@ export default {
this.calcPosition();
})
},
// 计算位置
calcPosition() {
this.contents?.forEach(item => {
item.gx = item.x * this.scale;
item.gy = item.y * this.scale;
item.gx = item.x * this.scale
item.gy = item.y * this.scale
})
},
goDetails(item) {
if (!item.isLink) return;
if (!item.isLink) return
if (item.type === 1) {
uni.navigateTo({
url: '/pkg_product/views/heritageVideo?id=' + item.id
@@ -57,16 +58,13 @@ export default {
<template>
<view class="pkg-product-heritage">
<image style="width: 100%" :src="topImage" mode="widthFix"/>
<view class="main-box">
<image style="width: 100%" :src="backgroundImage" mode="widthFix"/>
<view class="item" :style="{'left':item.gx+'rpx','top':item.gy+'rpx'}" v-for="(item,index) in contents"
:key="index" @click="goDetails(item)">
<image class="img-item" :src="item.image"/>
<view class="title flex jc-center">{{ item.title }}</view>
</view>
</view>
</view>
</template>
+10 -7
View File
@@ -1,28 +1,32 @@
<script>
import {getICHDetails} from "@/api/product";
import {getICHDetails} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "heritageGoods",
name: 'HeritageGoods',
mixins: [pageListenMixins],
data() {
return {
id: null,
info: null,
pageKeyId: ''
}
},
onLoad(options) {
this.id = options.id;
const id = options.id
this.id = id
this.pageKeyId = `ichContent_id_${id}`
this.getDetails();
},
methods: {
getDetails() {
getICHDetails(this.id).then(({data}) => this.info = data);
},
goGoods(id) {
uni.navigateTo({
url: "/pages/shop/GoodsCon/index?id=" + id
url: '/pages/shop/GoodsCon/index?id=' + id + '&from=ich'
})
},
}
}
}
</script>
@@ -30,7 +34,6 @@ export default {
<template>
<view class="heritage-goods" v-if="info">
<image class="page-bg" :src="info.backgroundImage" mode="widthFix"/>
<view class="list-box flex flex-wrap">
<view class="item flex flex-col jc-between" v-for="(item,index) in info.products" :key="index"
@click="goGoods(item.productId)">
+10 -9
View File
@@ -1,21 +1,25 @@
<script>
import {getICHDetails} from "@/api/product";
import {getICHDetails} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "heritageVideo",
name: 'HeritageVideo',
mixins: [pageListenMixins],
data() {
return {
id: null,
info: null,
pageKeyId: ''
}
},
onLoad(options) {
this.id = options.id;
this.getDetails();
const id = options.id
this.id = id
this.pageKeyId = `ichContent_id_${id}`
this.getDetails()
},
methods: {
getDetails() {
getICHDetails(this.id).then(({data}) => this.info = data);
getICHDetails(this.id).then(({data}) => this.info = data)
}
}
}
@@ -25,9 +29,6 @@ export default {
<view class="heritage-video" v-if="info">
<image class="page-bg" :src="info.backgroundImage" mode="widthFix"/>
<video :src="info.video" autoplay show-center-play-btn/>
<!-- <video id="myVideo" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"-->
<!-- autoplay controls></video>-->
</view>
</template>
+14 -10
View File
@@ -1,30 +1,34 @@
<script>
import {getHomestay} from "@/api/product";
// 民宿专题
import {getHomestay} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "homestay", // 民宿专题
name: 'HomestayPage',
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
topImage: '',
contents: [],
id: null
id: null,
pageKeyId: ''
}
},
onLoad(options) {
this.id = options.id;
const id = options.id
this.id = id
this.pageKeyId = `appContentHomestay_id_${id}`
getHomestay(this.id).then(({data}) => {
this.topImage = data.topImage;
this.contents = data.contents;
this.topImage = data.topImage
this.contents = data.contents
})
},
methods: {
goInnDetail(item) {
uni.navigateTo({
url: `/pagesInn/inn/innHome?id=${item.id}`
url: `/pagesInn/inn/innHome?id=${item.id}&from=homestay`
})
},
}
}
}
</script>
+20 -10
View File
@@ -1,9 +1,11 @@
<script>
import {getSeason, getSeasonPoster} from "@/api/product";
import cookie from "@/utils/store/cookie";
import {getUrlParam} from "@/utils/common.js";
import {getSeason, getSeasonPoster} from '@/api/product'
import cookie from '@/utils/store/cookie'
import {getUrlParam} from '@/utils/common.js'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
@@ -12,15 +14,18 @@ export default {
info: null,
current: 0,
showShare: false,
posterUrl: "", // 分享海报
posterUrl: '', // 分享海报
pageKeyId: ''
}
},
onLoad(options) {
if (options.id) {
this.id = options.id || null;
this.partnerId = options.partnerId || null;
const id = options.id
if (id) {
this.id = id || null
this.pageKeyId = `seasonalFoodContent_id_${id}`
this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync();
const obj = uni.getEnterOptionsSync()
if (options.scene || obj.query.scene) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.id = getUrlParam(query, "id") || null;
@@ -131,7 +136,12 @@ export default {
}
})
},
},
goGoods(id) {
uni.navigateTo({
url: `/pages/shop/GoodsCon/index?id=${id}&from=season`
})
}
}
}
</script>
@@ -168,7 +178,7 @@ export default {
<image class="bg-img" :src="info.productImage" mode="widthFix"/>
<!-- <scroll-view scroll-y class="product-list" :style="{backgroundImage:'url(' + info.productImage + ')'}">-->
<scroll-view scroll-y class="product-list">
<image class="item" :src="item.image" mode="widthFix" @click="$global.navToGoods(item.id)"
<image class="item" :src="item.image" mode="widthFix" @click="goGoods(item.id)"
v-for="(item,index) in info.products" :key="index"/>
</scroll-view>
</view>
+9 -6
View File
@@ -1,31 +1,34 @@
<script>
import {seasonHomeData} from "@/api/product";
import {seasonHomeData} from '@/api/product'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
typeList: ["时令果蔬", "水产海鲜", "肉禽蛋白", "全部分类"],
typeList: ['时令果蔬', '水产海鲜', '肉禽蛋白', '全部分类'],
list: [],
typeIndex: 0
typeIndex: 0,
pageKeyId: Object.freeze('seasonalFoodIndex')
}
},
onLoad() {
this.init();
this.init()
},
methods: {
changeType(index){
this.typeIndex=index
},
init() {
seasonHomeData().then(({data}) => this.list = data.seasonalFoodType || []);
seasonHomeData().then(({data}) => this.list = data.seasonalFoodType || [])
},
goDetail() {
uni.navigateTo({
url: "/pkg_product/views/season?id=" + this.list[this.typeIndex].contents[0].id
})
}
},
}
}
</script>
+48 -59
View File
@@ -156,26 +156,27 @@
</template>
<script>
import CountDownUnit from "@/pkg_product/components/CountDownUnit.vue";
import {getSeckillRule, getSeckillTopList, getYxStoreSeckillIndex, getYxStoreSeckillPageList} from "@/api/goods";
import {secKillShareImage} from "@/api/share";
import {mapGetters} from "vuex";
import cookie from "@/utils/store/cookie";
import {userBindParent} from "@/api/user";
import {getUrlParam} from "@/utils/common.js";
import CountDownUnit from '@/pkg_product/components/CountDownUnit.vue'
import {getSeckillRule, getSeckillTopList, getYxStoreSeckillIndex, getYxStoreSeckillPageList} from '@/api/goods'
import {secKillShareImage} from '@/api/share'
import {mapGetters} from 'vuex'
import cookie from '@/utils/store/cookie'
import {userBindParent} from '@/api/user'
import {getUrlParam} from '@/utils/common.js'
import NoGoodData from '@/components/good/NoData'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "seckill",
name: 'Seckill',
components: {
CountDownUnit,
NoGoodData
},
mixins: [pageListenMixins],
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
showRule: false,
seckillTime: [],
seckillTimeIndex: 0,
page: 1,
@@ -185,13 +186,14 @@ export default {
timeId: null,
nextList: [],
ruleContent: null,
partnerId: null
partnerId: null,
pageKeyId: Object.freeze('seckillIndex')
}
},
computed: mapGetters(["userInfo", "isLogin"]),
computed: mapGetters(['userInfo', 'isLogin']),
onShareAppMessage() {
return new Promise(async (resolve, reject) => {
const {status, data} = await secKillShareImage();
const {status, data} = await secKillShareImage()
if (status === 200) {
resolve({
title: '探寻有趣有味的生活方式',
@@ -203,91 +205,78 @@ export default {
},
onLoad(options) {
if (options.partnerId) {
this.partnerId = options.partnerId || null;
this.partnerId = options.partnerId || null
} else {
let obj = uni.getEnterOptionsSync();
let obj = uni.getEnterOptionsSync()
if (options.scene != null || obj.query.scene != null) {
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene);
this.partnerId = getUrlParam(query, "partnerId") || null;
let query = options ? decodeURIComponent(options.scene) : decodeURIComponent(obj.query.scene)
this.partnerId = getUrlParam(query, 'partnerId') || null
}
}
if (this.partnerId) {
cookie.set("spread", this.partnerId);
userBindParent({spread: parseInt(this.partnerId)});
cookie.set('spread', this.partnerId)
userBindParent({spread: parseInt(this.partnerId)})
}
this.fetchSession();
getSeckillRule().then(({data}) => this.ruleContent = data);
getSeckillTopList(1, 10).then(({data}) => this.topList = data.records);
this.fetchSession()
getSeckillRule().then(({data}) => this.ruleContent = data)
getSeckillTopList(1, 10).then(({data}) => this.topList = data.records)
},
onReachBottom() {
if (this.endReach) return;
this.page++;
this.fetchList();
if (this.endReach) return
this.page++
this.fetchList()
},
methods: {
changeRule(){
this.showRule=!this.showRule
},
navChange(index) {
if (this.seckillTimeIndex === index) return;
this.seckillTimeIndex = index;
this.page = 1;
this.list = [];
this.timeId = this.seckillTime[this.seckillTimeIndex].id;
this.endReach = false;
if (this.seckillTimeIndex === index) return
this.seckillTimeIndex = index
this.page = 1
this.list = []
this.timeId = this.seckillTime[this.seckillTimeIndex].id
this.endReach = false
this.fetchList()
},
fetchSession() {
getYxStoreSeckillIndex().then(({
data
}) => {
if (data.seckillTime.length === 0) return;
this.seckillTime = data.seckillTime.filter(item => item.status > 0);
this.timeId = this.seckillTime[this.seckillTimeIndex].id;
this.fetchList();
getYxStoreSeckillIndex().then(({ data }) => {
if (data.seckillTime.length === 0) return
this.seckillTime = data.seckillTime.filter(item => item.status > 0)
this.timeId = this.seckillTime[this.seckillTimeIndex].id
this.fetchList()
if (this.seckillTime.length > this.seckillTimeIndex) {
getYxStoreSeckillPageList(1, 10, this.seckillTime[this.seckillTimeIndex + 1].id).then(({
data
}) => {
this.nextList = data;
getYxStoreSeckillPageList(1, 10, this.seckillTime[this.seckillTimeIndex + 1].id).then(({ data }) => {
this.nextList = data
})
}
});
})
},
fetchList() {
getYxStoreSeckillPageList(this.page, 10, this.timeId).then(({
data
}) => {
getYxStoreSeckillPageList(this.page, 10, this.timeId).then(({ data }) => {
if (data.length > 0) {
data.map(item => this.list.push(item));
} else {
this.endReach = true;
this.endReach = true
}
});
})
},
goGoodsConByProductID(item, status) {
if (status > 1) {
uni.showToast({
title: "此商品秒杀活动还未开始哦",
icon: "none"
title: '此商品秒杀活动还未开始哦',
icon: 'none'
})
return;
return
}
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: item.productId,
activityId: item.id,
from: "kill"
from: 'kill'
}
});
})
}
}
}