From 883630c60e9a941d6cf721cfb4b9160ab406a7dd Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 30 九月 2025 10:26:44 +0800
Subject: [PATCH] 商品行为分析
---
pages/kitchen/KitchenVideo.vue | 71 ++++++++++++--
pages/product/goods.vue | 8 +
pages/video/video-goods-detail-swiper.vue | 101 ++++++++++++++++----
pages/health/healthVideo.vue | 69 +++++++++++--
pages/tabbar/index/home.vue | 15 ++
5 files changed, 221 insertions(+), 43 deletions(-)
diff --git a/pages/health/healthVideo.vue b/pages/health/healthVideo.vue
index cb9bc81..0283f4e 100644
--- a/pages/health/healthVideo.vue
+++ b/pages/health/healthVideo.vue
@@ -264,7 +264,7 @@
import { silentLogin } from "@/api/connect.js";
import { getUserInfo } from "@/api/members";
import storage from "@/utils/storage.js";
-import { getSessionId, userAction } from "@/api/userAction.js";
+import { getSessionId, userAction,userShare } from "@/api/userAction.js";
export default {
components: {TopBar},
computed: {
@@ -364,14 +364,20 @@
pageParams:"{}",
pageStatus:"JOIN",
pageType:"DETAIL"
- }
+ },
+ shareParam:{
+ pageCode:"HEALTH_VIDEO",
+ shareOption:"{}",
+ pageType:"DETAIL"
+ },
+ shareId:'',
}
},
onShow() {
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)
}
@@ -391,19 +397,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鎴愬姛');
+ }
+ });
+ }
this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom
let queryParam = this.videoQuery;
if (option.q) {
@@ -460,11 +478,42 @@
shareUser: userInfo.id
}
saveShare(data)
- return {
- title: videoInfo.title,
- path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
- imageUrl: videoInfo.coverUrl
- }
+ // return {
+ // title: videoInfo.title,
+ // path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
+ // imageUrl: videoInfo.coverUrl
+ // }
+ return new Promise((resolve) => {
+ this.shareId = '';
+ let shareObj ={
+ videoId:videoInfo.id,
+ userId:userInfo.id
+ }
+ this.shareParam.shareOption = JSON.stringify(shareObj)
+ userShare(this.shareParam).then(res => {
+ this.shareId = res.data.data;
+ // 褰撹幏鍙栧埌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: {
// 瑙f瀽URL鍙傛暟
diff --git a/pages/kitchen/KitchenVideo.vue b/pages/kitchen/KitchenVideo.vue
index a2b54e4..a1367b0 100644
--- a/pages/kitchen/KitchenVideo.vue
+++ b/pages/kitchen/KitchenVideo.vue
@@ -285,7 +285,7 @@
} from "@/api/collect.js";
import { saveShare, saveShareClickRecord } from "@/api/share.js";
import storage from "@/utils/storage.js";
-import { getSessionId, userAction } from "@/api/userAction.js";
+import { getSessionId, userAction,userShare } from "@/api/userAction.js";
export default {
computed: {
hasPlayTime() {
@@ -397,14 +397,21 @@
pageParams:"{}",
pageStatus:"JOIN",
pageType:"LIST"
- }
+ },
+ shareParam:{
+ pageCode:"KITCHEN_VIDEO",
+ shareOption:"{}",
+ pageType:"DETAIL"
+ },
+ shareId:'',
+
}
},
onShow() {
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)
}
@@ -418,19 +425,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鎴愬姛');
+ }
+ });
+ }
this.marginBottom = uni.getSystemInfoSync().safeAreaInsets.bottom;
// 鑾峰彇鐘舵�佹爮楂樺害
const systemInfo = uni.getSystemInfoSync();
@@ -500,11 +519,43 @@
shareUser: userInfo.id
}
saveShare(data)
- return {
- title: videoInfo.title,
- path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
- imageUrl: videoInfo.coverUrl
- }
+ // return {
+ // title: videoInfo.title,
+ // path: `/pages/tabbar/index/home?videoId=${videoInfo.id}&userId=${userInfo.id}`,
+ // imageUrl: videoInfo.coverUrl
+ // }
+
+ return new Promise((resolve) => {
+ this.shareId = '';
+ let shareObj ={
+ videoId:videoInfo.id,
+ userId:userInfo.id
+ }
+ this.shareParam.shareOption = JSON.stringify(shareObj)
+ userShare(this.shareParam).then(res => {
+ this.shareId = res.data.data;
+ // 褰撹幏鍙栧埌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: {
// 瑙f瀽URL鍙傛暟
diff --git a/pages/product/goods.vue b/pages/product/goods.vue
index f6eca6c..f44ad0c 100644
--- a/pages/product/goods.vue
+++ b/pages/product/goods.vue
@@ -572,6 +572,13 @@
this.actionParam.shareId = options.shareId;
this.actionParam.joinType = 'SHARE'
console.log('瑙﹀彂onLoad')
+ uni.setStorage({
+ key: 'shareId',
+ data: options.shareId,
+ success: function () {
+ console.log('缂撳瓨shareId鎴愬姛');
+ }
+ });
}
this.actionParam.pageParams = JSON.stringify(options)
if(options.q){
@@ -620,6 +627,7 @@
getSessionId().then(res=>{
this.pageSessionNo = res.data.data
this.actionParam.sessionId = this.pageSessionNo
+ this.actionParam.sessionId = res.data.data
if(this.pageSessionNo){
let param = Object.assign({}, this.actionParam);
userAction(param)
diff --git a/pages/tabbar/index/home.vue b/pages/tabbar/index/home.vue
index 00fd2d7..bd05123 100644
--- a/pages/tabbar/index/home.vue
+++ b/pages/tabbar/index/home.vue
@@ -441,7 +441,18 @@
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
@@ -513,7 +524,7 @@
// })
// 淇濆瓨鍒嗕韩璁板綍
-
+
// 杩斿洖涓�涓狿romise
return new Promise((resolve) => {
this.shareId = '';
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