From 297f2479b8280eb65903ffd5e08431a20b23e15b Mon Sep 17 00:00:00 2001 From: yu <479214531@qq.com> Date: Fri, 28 Feb 2025 14:02:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=92=AD=E6=94=BE=E5=AE=8C?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E8=A7=86=E9=A2=91=E7=9A=84=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=E3=80=81=E5=88=87=E6=8D=A2=E5=88=B0=E5=B0=8F=E7=AA=97=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/DisplayVideo/index.tsx | 33 +++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/pages/DisplayVideo/index.tsx b/src/pages/DisplayVideo/index.tsx index a936dab..d229dcf 100644 --- a/src/pages/DisplayVideo/index.tsx +++ b/src/pages/DisplayVideo/index.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react' -import Taro, { useLoad, useShareAppMessage, useShareTimeline } from '@tarojs/taro' +import Taro, { useLoad, useShareAppMessage, useShareTimeline, useDidHide } from '@tarojs/taro' import { View, Text, Video, Image, ScrollView, CoverView, CoverImage } from '@tarojs/components' import './index.less' @@ -129,6 +129,23 @@ export default function Index() { } }) + // 页面隐藏(用于播放视频的时候进入小窗模式时发送埋点) + useDidHide(() => { + console.log('页面离开', alldata[displayindex['index']].ResId) + Taro.request({ + method: 'POST', + url: 'https://interapi.jm-kid.com/api/embedpoint', + header: { + authorization: `bearer ${Taro.getStorageSync('UserToken')}` + }, + data: { + timestamp: Date.now(), + action_code: '1005006', + value: alldata[displayindex['index']].ResId + } + }) + }) + useLoad((query) => { console.log('id=>', query.id) if(Taro.getStorageSync('UserToken')){ @@ -318,6 +335,20 @@ export default function Index() { poster: rres.data.data.body.videoBase.coverURL, title: rres.data.data.body.playInfoList.playInfo[0].ResTitle || '', }) + + // 埋点 + Taro.request({ + method: 'POST', + url: 'https://interapi.jm-kid.com/api/embedpoint', + header: { + authorization: `bearer ${Taro.getStorageSync('UserToken')}` + }, + data: { + timestamp: Date.now(), + action_code: '1005007', + value: alldata[nowindex].ResId + } + }) } }) },