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
+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'
}
});
})
}
}
}