From 90fa9b82d2d5e5165190944ed89042511c25cb11 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 30 九月 2025 09:36:53 +0800
Subject: [PATCH] 商品行为分析
---
pages/product/goods.vue | 86 +++++++++++++++++++++++++++++++++---------
1 files changed, 67 insertions(+), 19 deletions(-)
diff --git a/pages/product/goods.vue b/pages/product/goods.vue
index 94fd6cd..cf365da 100644
--- a/pages/product/goods.vue
+++ b/pages/product/goods.vue
@@ -6,13 +6,15 @@
<!-- 浠卙5鏈夋晥 鎵撳紑App -->
<!-- 鍒嗕韩 -->
- <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="
+<!-- <shares v-if="enableShare && goodsDetail.id" :skuId="this.routerVal.id" :goodsId="this.routerVal.goodsId" :link="
'/pages/product/goods?id=' +
this.routerVal.id +
'&goodsId=' +
this.routerVal.goodsId
" :thumbnail="goodsDetail.thumbnail" :goodsName="goodsDetail.goodsName" type="goods"
@close="enableShare = false" />
+ -->
+
<popups v-model="popupsSwitch" @tapPopup="handleNavbarList" :popData="navbarListData" :x="navbarListX"
:y="navbarListY" placement="top-start" />
<view class="index">
@@ -114,10 +116,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"></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>
@@ -301,18 +311,15 @@
import GoodsSwiper from "@/pages/product/product/goods/-goods-swiper.vue"; //杞挱鍥剧粍浠�
import popupGoods from "@/pages/product/m-buy/goods.vue"; //璐墿杞﹀晢鍝佺殑妯″潡
import popupAddress from "@/pages/product/product/popup/address.vue"; //鍦板潃閫夋嫨妯″潡
-import shares from "@/pages/product/m-share/index.vue"; //鍒嗕韩
+
import popups from "@/pages/product/popups/popups.vue"; //姘旀场妗�
import takeDownFormSaleGoods from "@/pages/product/m-take-down-sale-goods/index.vue"; //涓嬫灦妗�
import setup from "./product/popup/popup";
-import { getSessionId, userAction } from "@/api/userAction.js";
- import {
- getSTSToken
- } from '@/api/common.js'
+import { getSessionId, userAction,userShare } from "@/api/userAction.js";
+import { getSTSToken } from '@/api/common.js'
export default {
components: {
popups,
- shares,
PromotionLayout,
PromotionDetailsLayout,
PromotionAssembleLayout,
@@ -461,7 +468,8 @@
pageCode:"GOODS_DETAILS",
shareOption:"{}",
pageType:"DETAIL"
- }
+ },
+ shareId:'',
};
},
@@ -514,8 +522,51 @@
this.productRefHeight = windowHeight - bottomHeight + "px";
},
+
+
+
+ onShareAppMessage(e) {
+ console.log("寮�濮嬪垎浜�")
+ console.log(this.goodsDetail)
+ // 杩斿洖涓�涓狿romise
+ return new Promise((resolve) => {
+
+ this.shareId = '';
+ this.shareParam.shareOption = JSON.stringify(this.routerVal)
+ userShare(this.shareParam).then(res => {
+ this.shareId = res.data.data;
+
+
+ // 褰撹幏鍙栧埌shareId鍚庯紝鍐峳esolve鍒嗕韩閰嶇疆
+ resolve({
+ title: this.goodsDetail.goodsName,
+ path: '/pages/product/goods' +'?id='+ this.routerVal.id + '&goodsId=' + this.routerVal.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='+ this.routerVal.id + '&goodsId=' + this.routerVal.goodsId,
+ imageUrl: this.goodsDetail.goodsGalleryList[0],
+ });
+ });
+ });
+ },
async onLoad (options) {
-
+ if(option.shareId){
+ this.actionParam.shareId = option.shareId;
+ this.actionParam.joinType = 'SHARE'
+ console.log('瑙﹀彂onLoad')
+ }
+ this.actionParam.pageParams = JSON.stringify(option)
if(options.q){
const queryParam = {
id:'',
@@ -541,22 +592,19 @@
console.log(this.routerVal)
// #ifdef MP-WEIXIN
- // 灏忕▼搴忛粯璁ゅ垎浜�
- 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)
@@ -565,7 +613,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)
}
--
Gitblit v1.8.0