From 883630c60e9a941d6cf721cfb4b9160ab406a7dd Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 30 九月 2025 10:26:44 +0800
Subject: [PATCH] 商品行为分析

---
 pages/tabbar/index/home.vue |   80 +++++++++++++++++++++++++++++++++-------
 1 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index 8a4ae99..bd05123 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -265,14 +265,15 @@
 import { mapState, mapMutations } from 'vuex'
 import { setPopupRedisTime, getPopupAcitivty } from '@/api/popup.js'
 import { changeCollect } from "@/api/collect.js";
-import { saveShare, saveShareClickRecord } from "@/api/share.js";
-import { getSessionId, userAction } from "@/api/userAction.js";
+import { saveShare, saveShareClickRecord} from "@/api/share.js";
+import { getSessionId, userAction,userShare  } from "@/api/userAction.js";
 import { silentLogin } from "@/api/connect.js";
 import { getUserInfo } from "@/api/members";
 import storage from "@/utils/storage.js";
 import TopBar from "@/components/TopBar.vue";
 import { nextTick } from "vue";
 import { getVideoCover } from "@/api/common.js"
+import {addPrizeNum} from '@/api/prize.js'
 export default {
 	components: { TopBar, ActivityPopup },
 	computed: {
@@ -371,6 +372,7 @@
 			similarlyLoading: false, // 鐩镐技瑙嗛鍔犺浇
 			marginBottom: 0 ,// 搴曢儴瀹夊叏鍖哄煙
 			pageSessionNo:"",
+			shareId:"",
 			actionParam:{
 					sessionId:'',
 					actionType:"PAGE",
@@ -379,15 +381,22 @@
 					pageParams:"{}",
 					pageStatus:"JOIN",
 					pageType:"LIST"
-				}
+				},
+				shareParam:{
+					pageCode:"RECOMMEND_VIDEO",
+					shareOption:"{}",
+					pageType:"LIST"
+				},
 		}
 	},
 	onShow() {
 		getSessionId().then(res=>{
+			console.log('res',JSON.stringify(res))
 			this.pageSessionNo = res.data.data
 			if(this.pageSessionNo){
-			let	param = this.actionParam;
-				param.sessionId = this.pageSessionNo
+			let	param = Object.assign({},this.actionParam);
+			this.actionParam.sessionId = this.pageSessionNo
+			param.sessionId = this.pageSessionNo
 				userAction(param)
 			}
 		})
@@ -419,20 +428,31 @@
 		}
 	},
   onUnload() {
-    let	param = this.actionParam;
+    let	param = Object.assign({},this.actionParam);
     if (this.sendOnShow)return
     param.pageStatus = "LEAVE"
     userAction(param)
   },
   onHide() {
     this.startHidenTime = Date.now()
-    let	param = this.actionParam;
+    let	param = Object.assign({},this.actionParam);
     this.sendOnShow = true;
     param.pageStatus = "LEAVE"
     userAction(param)
   },
 	onLoad(option) {
-
+		if(option.shareId){
+			console.log('瑙﹀彂onLoad')
+			this.actionParam.shareId = option.shareId;
+			this.actionParam.joinType = 'SHARE'
+			uni.setStorage({
+				key: 'shareId',
+				data: option.shareId,
+				success: function () {
+					console.log('缂撳瓨shareId鎴愬姛');
+				}
+			});
+		}
 		console.log('-----------鍒嗕韩鍑虹殑鏁版嵁---------->', option)
 		//澶勭悊鎵爜鍑烘潵鐨勮棰�
 		this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
@@ -503,13 +523,45 @@
 		// 	}
 
 		// })
-		console.log(videoInfo)
-		return {
-			title: videoInfo.title,
-			path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
-			imageUrl: videoInfo.coverUrl
-		}
 		// 淇濆瓨鍒嗕韩璁板綍
+
+		// 杩斿洖涓�涓狿romise
+		return new Promise((resolve) => {
+					this.shareId = '';
+					this.shareParam.shareOption = JSON.stringify({
+						id:this.activityId
+					})
+					userShare(this.shareParam).then(res => {
+					  this.shareId = res.data.data;
+					  let param = {
+					  	addType:"SHARE_GOODS_VIDEO",
+					  	extend:"",
+					  }
+					  let extend = {shareId:this.shareId}
+					  param.extend = JSON.stringify(extend)
+					  addPrizeNum(param);
+					  // 褰撹幏鍙栧埌shareId鍚庯紝鍐峳esolve鍒嗕韩閰嶇疆
+					  resolve({
+						title: videoInfo.title,
+						path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}&shareId=${this.shareId}`,
+						imageUrl: videoInfo.coverUrl,
+						success(e) {
+						  console.log("鍒嗕韩鎴愬姛", e);
+						},
+						fail(e) {
+						  console.log('鍒嗕韩澶辫触', e);
+						}
+					  });
+					}).catch(err => {
+					  // 澶勭悊閿欒鎯呭喌锛屼緥濡備娇鐢ㄩ粯璁ゅ弬鏁�
+					  console.error('鑾峰彇鍒嗕韩ID澶辫触', err);
+					  resolve({
+							title: videoInfo.title,
+							path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
+							imageUrl: videoInfo.coverUrl
+					  });
+					});
+		});
 	},
 	methods: {
 		async openActivityPopup() {

--
Gitblit v1.8.0