From d50a3ed44e2edab2a7a661c43491c3aa42c57794 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期四, 25 九月 2025 14:17:05 +0800 Subject: [PATCH] 用户行为分享基础埋点 --- pages/cart/coupon/couponCenter.vue | 41 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 39 insertions(+), 2 deletions(-) diff --git a/pages/cart/coupon/couponCenter.vue b/pages/cart/coupon/couponCenter.vue index dc45b67..78a8618 100644 --- a/pages/cart/coupon/couponCenter.vue +++ b/pages/cart/coupon/couponCenter.vue @@ -54,6 +54,7 @@ import { getAllCoupons } from "@/api/promotions.js"; + import { getSessionId, userAction } from "@/api/userAction.js"; export default { data() { return { @@ -65,10 +66,45 @@ pageSize: 10, }, storeId: "", //搴楅摵 id, - couponData: "" + couponData: "", + sendOnShow:false, + pageSessionNo:"", + actionParam:{ + sessionId:'', + actionType:"PAGE", + joinType:"SELF", + pageCode:"COUPON_CENTER", + pageParams:"{}", + pageStatus:"JOIN", + pageType:"LIST" + } }; }, + onUnload() { + let param = this.actionParam; + if (this.sendOnShow)return + param.pageStatus = "LEAVE" + userAction(param) + }, + onHide() { + this.startHidenTime = Date.now() + let param = this.actionParam; + this.sendOnShow = true; + param.pageStatus = "LEAVE" + userAction(param) + }, + onShow() { + getSessionId().then(res=>{ + this.pageSessionNo = res.data.data + if(this.pageSessionNo){ + let param = this.actionParam; + param.sessionId = this.pageSessionNo + userAction(param) + } + }) + }, onLoad(option) { + this.actionParam.pageParams = JSON.stringify(option) this.storeId = option.storeId; this.getCoupon(); }, @@ -132,7 +168,8 @@ receiveCoupons(val.id).then((res) => { if (res.data.code == 200) { //淇敼鐐瑰嚮鐨勪紭鎯犲嵎褰撳墠鐨勯鍙栫姸鎬� - val.owned = true; + val.owned = res.data.result.owned; + console.log(res.data) uni.showToast({ title: "棰嗗彇鎴愬姛", icon: "none", -- Gitblit v1.8.0