From 50eac4101c827bc7202b8259534eed70aa909a49 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 15 十月 2025 00:42:55 +0800
Subject: [PATCH] Merge branch 'dev_fix_sub' of http://42.193.1.25:9521/r/lmk-shop-wx into dev_fix_sub
---
pages/video/video-similar.vue | 87 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 85 insertions(+), 2 deletions(-)
diff --git a/pages/video/video-similar.vue b/pages/video/video-similar.vue
index 6fc7b5d..19a4b88 100644
--- a/pages/video/video-similar.vue
+++ b/pages/video/video-similar.vue
@@ -108,7 +108,7 @@
<script>
import { getGoodsSimilarlyVideos, savePlayRecord, changeCollect, changeThumbsUp } from "@/api/video.js"
-
+import { getSessionId, userAction ,userShare } from "@/api/userAction.js";
export default {
data() {
return {
@@ -146,10 +146,41 @@
// 鍙虫粦杩斿洖棣栭〉鐩稿叧
touchStartX: 0,
touchEndX: 0,
- minSwipeDistance: 100 // 鏈�灏忔粦鍔ㄨ窛绂�
+ minSwipeDistance: 100 ,// 鏈�灏忔粦鍔ㄨ窛绂�
+ pageSessionNo:"",
+ actionParam:{
+ sessionId:'',
+ actionType:"PAGE",
+ joinType:"SELF",
+ pageCode:"RECOMMEND_VIDEO_RIGHT_VIDEO",
+ pageParams:"{}",
+ pageStatus:"JOIN",
+ pageType:"DETAIL"
+ },
+ shareParam:{
+ pageCode:"RECOMMEND_VIDEO_RIGHT_VIDEO",
+ shareOption:"{}",
+ pageType:"DETAIL"
+ },
+ shareId:'',
}
},
onLoad(options) {
+ if(options.shareId){
+ 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.goodsId) {
this.loadSimilarVideos(options.goodsId, options.currentVideoId);
@@ -161,6 +192,15 @@
const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
videoContext.play();
}
+ getSessionId().then(res=>{
+ this.pageSessionNo = res.data.data
+ this.actionParam.sessionId = res.data.data
+ if(this.pageSessionNo){
+ let param = Object.assign({}, this.actionParam);
+ param.sessionId = this.pageSessionNo
+ userAction(param)
+ }
+ })
},
onHide() {
// 椤甸潰闅愯棌鏃舵殏鍋滆棰�
@@ -168,6 +208,49 @@
const videoContext = uni.createVideoContext(`video${this.currentIndex}`, this);
videoContext.pause();
}
+ this.startHidenTime = Date.now()
+ let param = Object.assign({}, this.actionParam);
+ this.sendOnShow = true;
+ param.pageStatus = "LEAVE"
+ userAction(param)
+ },
+ onShareAppMessage(e){
+ const userInfo = storage.getUserInfo();
+ if (!userInfo) {
+ console.log("鏈櫥褰曚笉鑳藉垎浜�");
+ return
+ }
+ const videoInfo = e.target.dataset.obj;
+ 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;
+ 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: {
// 鍔犺浇鐩镐技瑙嗛
--
Gitblit v1.8.0