Commit 954d8d21 by 侯体倬

feat: 埋点优化

parent cecaf436
......@@ -54,4 +54,8 @@ export default {
uncollect_goods(data) {
return requestPOST(`${process.env.OLSHOP_URL}/product/uncollect_goods?productId=${data.productId}&terminalProductId=${data.terminalProductId}`, data)
},
// 根据 productId 查询商品信息
queryProductInformation(productId) {
return requestGET(`${process.env.OLSHOP_URL}/product/queryProductInformation?productId=${productId}`)
},
};
......@@ -3,7 +3,10 @@
<div class="livedSelectionSpe">
<div class="aaa" :style="{ 'z-index': show ? 999 : -999 }">
<div class="bg" v-if="show" @click="close"></div>
<div class="goodsMess" :style="{'bottom':show?0:''}">
<div class="goodsMess" :style="{
'bottom': show ? 0 : '',
'padding-bottom': isIphonex ? '34px' : 0
}">
<div class="sku">
<!-- 关闭按钮 -->
<div class="close" @click="closeDia">
......@@ -86,6 +89,7 @@
<script type="text/ecmascript-6">
import { DFSImg } from "@/utils/index";
import live from "@/api/live";
import goods from "@/api/goods";
const app = getApp();
export default {
name: "",
......@@ -149,7 +153,12 @@ export default {
};
},
components: {},
computed: {},
computed: {
isIphonex() {
const res = wx.getSystemInfoSync();
return res.model.search('iPhone') != -1 && res.screenHeight >= 812;
}
},
created() { },
onLoad() { },
mounted() {
......@@ -391,9 +400,15 @@ export default {
})
// 新华优选埋点
if (app.trackEvent) {
goods.queryProductInformation(this.getProductInfos[0].productId).then(res => {
if (res.data.code == 200) {
let productCode = res.data.data.productCode;
if (typeof productCode === 'string') productCode = productCode.trim();
app.trackEvent('resourceCartClick', {
resourceId: this.getProductInfos[0].productId,
resourceName: this.getProductInfos[0].pdtName
resourceId: productCode,
resourceName: res.data.data.productName
});
}
})
}
this.show = false;
......@@ -678,6 +693,10 @@ export default {
</script>
<style lang="scss" scoped>
.is-iphonex {
padding-bottom: 34px;
}
.aaa {
position: fixed;
width: 100%;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment