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

---
 pages/video/video-goods-detail-swiper.vue |  101 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 80 insertions(+), 21 deletions(-)

diff --git a/pages/video/video-goods-detail-swiper.vue b/pages/video/video-goods-detail-swiper.vue
index da58270..a50b6da 100644
--- a/pages/video/video-goods-detail-swiper.vue
+++ b/pages/video/video-goods-detail-swiper.vue
@@ -95,10 +95,18 @@
 													</span>
 												</view>
 
-												<view class="icons share" @click="shareChange()">
+										<!-- 		<view class="icons share" @click="shareChange()">
 													<u-icon size="30" name="share-fill"></u-icon>
 													<view>鍒嗕韩</view>
-												</view>
+												</view> -->
+												<view class="icons share"  style="margin-top: -15px;">
+												       <button open-type="share" class="custom-share-btn" plain="true" style="border: none;">
+												            <u-icon size="30" name="share-fill" :data-obj="item"></u-icon>
+												       </button>
+												        <view style="margin-top: -14px;">鍒嗕韩</view>
+												      </view>
+												
+												
 												<view class="icons" @click="clickFavorite(goodsDetail.id)">
 													<u-icon size="30" :color="favorite ? '#f2270c' : '#262626'"
 														:name="favorite ? 'heart-fill' : 'heart'"></u-icon>
@@ -293,7 +301,7 @@
 import popups from "@/pages/product/popups/popups.vue"; //姘旀场妗�
 import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //涓嬫灦妗�
 import setup from "@/pages/product/product/popup/popup.js";
-import { getSessionId, userAction } from "@/api/userAction.js";
+import { getSessionId, userAction,userShare } from "@/api/userAction.js";
 
 import { getGoodsDetail } from "@/api/video.js"
 import {
@@ -440,16 +448,22 @@
 			touchStartX: 0,
 			touchEndX: 0,
 			minSwipeDistance: 100, // 鏈�灏忔粦鍔ㄨ窛绂伙紝鐢ㄤ簬鍒ゆ柇鏄惁涓烘湁鏁堟粦鍔�
-			  pageSessionNo:"",
-			  actionParam:{
-					sessionId:'',
-					actionType:"PAGE",
-					joinType:"SELF",
-					pageCode:"SWIPER_GOODS",
-					pageParams:"{}",
-					pageStatus:"JOIN",
-					pageType:"DETAIL"
-				}
+			pageSessionNo:"",
+			actionParam:{
+				sessionId:'',
+				actionType:"PAGE",
+				joinType:"SELF",
+				pageCode:"RECOMMEND_VIDEO_LEFT_GOODS",
+				pageParams:"{}",
+				pageStatus:"JOIN",
+				pageType:"DETAIL"
+			},
+			shareParam:{
+				pageCode:"RECOMMEND_VIDEO_LEFT_GOODS",
+				shareOption:"{}",
+				pageType:"DETAIL"
+			},
+			shareId:'',
 		};
 	},
 
@@ -492,6 +506,18 @@
 		this.productRefHeight = windowHeight - bottomHeight + "px";
 	},
 	async onLoad(options) {
+		if(options.shareId){
+			this.actionParam.shareId = options.shareId;
+			this.actionParam.joinType = 'SHARE';
+			uni.setStorage({
+				key: 'shareId',
+				data: options.shareId,
+				success: function () {
+					console.log('缂撳瓨shareId鎴愬姛');
+				}
+			});
+			console.log('瑙﹀彂onLoad')
+		}
 		this.actionParam.pageParams = JSON.stringify(options)
 
 		this.videoId = options.videoId;
@@ -499,21 +525,21 @@
 
 		// #ifdef MP-WEIXIN
 		// 灏忕▼搴忛粯璁ゅ垎浜�
-		uni.showShareMenu({
-			withShareTicket: true,
-			menus: ["shareAppMessage", "shareTimeline"],
-		});
+		// uni.showShareMenu({
+		// 	withShareTicket: true,
+		// 	menus: ["shareAppMessage", "shareTimeline"],
+		// });
 		// #endif
 	},
   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)
@@ -522,7 +548,7 @@
 	  getSessionId().then(res=>{
 		this.pageSessionNo = res.data.data
 		if(this.pageSessionNo){
-		let	param = this.actionParam;
+		let param = Object.assign({}, this.actionParam);
 			param.sessionId = this.pageSessionNo
 			userAction(param)
 		}
@@ -541,7 +567,40 @@
 		// 	this.init(this.routerVal.id, this.routerVal.goodsId, this.routerVal.distributionId);
 		// }
 	},
-
+	onShareAppMessage(e){
+		console.log(e)
+		return new Promise((resolve) => {
+					this.shareId = '';
+					let shareObj ={
+						id:e.id,
+						goodsId:e.goodsId
+					}
+					this.shareParam.shareOption = JSON.stringify(shareObj)
+					userShare(this.shareParam).then(res => {
+					  this.shareId = res.data.data;
+					  // 褰撹幏鍙栧埌shareId鍚庯紝鍐峳esolve鍒嗕韩閰嶇疆
+					  resolve({
+						title: this.goodsDetail.goodsName,
+						path: '/pages/product/goods' +'?id='+ e.id + '&goodsId=' + e.goodsId +'&shareId=' + this.shareId,
+						imageUrl: this.goodsDetail.goodsGalleryList[0],
+						success(e) {
+						  console.log("鍒嗕韩鎴愬姛", e);
+						},
+						fail(e) {
+						  console.log('鍒嗕韩澶辫触', e);
+						}
+					  });
+					}).catch(err => {
+					  // 澶勭悊閿欒鎯呭喌锛屼緥濡備娇鐢ㄩ粯璁ゅ弬鏁�
+					  console.error('鑾峰彇鍒嗕韩ID澶辫触', err);
+					  resolve({
+						title: this.goodsDetail.goodsName,
+						path: '/pages/product/goods' +'?id='+ e.id+ '&goodsId=' + e.goodsId,
+						imageUrl: this.goodsDetail.goodsGalleryList[0],
+					  });
+					});
+		});
+	},
 	methods: {
 		// 鑾峰彇鍟嗗搧鍒楄〃
 		async getGoodsList() {

--
Gitblit v1.8.0