| | |
| | | import { setPopupRedisTime, getPopupAcitivty } from '@/api/popup.js' |
| | | import { changeCollect } from "@/api/collect.js"; |
| | | import { saveShare, saveShareClickRecord } from "@/api/share.js"; |
| | | import { getSessionId, userAction } from "@/api/userAction.js"; |
| | | import { getSessionId, userAction,userShare } from "@/api/userAction.js"; |
| | | import { silentLogin } from "@/api/connect.js"; |
| | | import { getUserInfo } from "@/api/members"; |
| | | import storage from "@/utils/storage.js"; |
| | | import TopBar from "@/components/TopBar.vue"; |
| | | import { nextTick } from "vue"; |
| | | import { getVideoCover } from "@/api/common.js" |
| | | import {addPrizeNum} from '@/api/prize.js' |
| | | export default { |
| | | components: { TopBar, ActivityPopup }, |
| | | computed: { |
| | |
| | | similarlyLoading: false, // 相似视频加载 |
| | | marginBottom: 0 ,// 底部安全区域 |
| | | pageSessionNo:"", |
| | | shareId:"", |
| | | actionParam:{ |
| | | sessionId:'', |
| | | actionType:"PAGE", |
| | |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"LIST" |
| | | } |
| | | }, |
| | | shareParam:{ |
| | | pageCode:"RECOMMEND_VIDEO", |
| | | shareOption:"{}", |
| | | pageType:"LIST" |
| | | }, |
| | | } |
| | | }, |
| | | onShow() { |
| | | getSessionId().then(res=>{ |
| | | console.log('res',JSON.stringify(res)) |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = this.actionParam; |
| | | let param = Object.assign({},this.actionParam); |
| | | this.actionParam.sessionId = this.pageSessionNo |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | |
| | | } |
| | | }, |
| | | 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) |
| | |
| | | // } |
| | | |
| | | // }) |
| | | console.log(videoInfo) |
| | | return { |
| | | // 保存分享记录 |
| | | |
| | | // 返回一个Promise |
| | | return new Promise((resolve) => { |
| | | this.shareId = ''; |
| | | this.shareParam.shareOption = JSON.stringify({ |
| | | id:this.activityId |
| | | }) |
| | | userShare(this.shareParam).then(res => { |
| | | this.shareId = res.data.data; |
| | | let param = { |
| | | addType:"SHARE_GOODS_VIDEO", |
| | | extend:"", |
| | | } |
| | | let extend = {shareId:this.shareId} |
| | | param.extend = JSON.stringify(extend) |
| | | addPrizeNum(param); |
| | | // 当获取到shareId后,再resolve分享配置 |
| | | 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: { |
| | | async openActivityPopup() { |