| | |
| | | </template> |
| | | <script> |
| | | import bgConfig from '@/pages/prize/PrizeDetail/prize-bgConfig.js' |
| | | import { getSessionId, userAction ,userShare } from "@/api/userAction.js"; |
| | | |
| | | import { |
| | | prizeInfo, |
| | | prizeNum, |
| | |
| | | shareTimelineAttempt: false, |
| | | activityCover: '', |
| | | activityName: '', |
| | | couponId: '' |
| | | couponId: '', |
| | | pageSessionNo:"", |
| | | actionParam:{ |
| | | sessionId:'', |
| | | actionType:"PAGE", |
| | | joinType:"SELF", |
| | | pageCode:"PRIZE_DETAIL", |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"DETAIL" |
| | | }, |
| | | shareParam:{ |
| | | pageCode:"PRIZE_DETAIL", |
| | | shareOption:"{}", |
| | | pageType:"DETAIL" |
| | | }, |
| | | shareId:'', |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | return [...this.originalWinners] |
| | | } |
| | | }, |
| | | onUnload() { |
| | | let param = Object.assign({}, this.actionParam); |
| | | if (this.sendOnShow)return |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | }, |
| | | onHide() { |
| | | this.startHidenTime = Date.now() |
| | | let param = Object.assign({}, this.actionParam); |
| | | this.sendOnShow = true; |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | }, |
| | | onShow() { |
| | | 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) |
| | | } |
| | | }) |
| | | }, |
| | | async onLoad(option) { |
| | | if(option.shareId){ |
| | | this.actionParam.shareId = option.shareId; |
| | | this.actionParam.joinType = 'SHARE' |
| | | console.log('触发onLoad') |
| | | } |
| | | this.actionParam.pageParams = JSON.stringify(option) |
| | | |
| | | const pages = getCurrentPages() |
| | | console.log('================pages ', pages) |
| | | this.activityId = option.id |
| | |
| | | // this.startAutoScroll() |
| | | }, |
| | | onShareAppMessage() { |
| | | 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; |
| | | console.log('------------------1》', this.shareId); |
| | | |
| | | // 当获取到shareId后,再resolve分享配置 |
| | | resolve({ |
| | | title: this.activityName, |
| | | path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId, |
| | | path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId + '&shareId=' + this.shareId, |
| | | imageUrl: this.activityCover, |
| | | success(e) { |
| | | console.log("分享成功", e) |
| | | console.log("分享成功", e); |
| | | }, |
| | | fail(e) { |
| | | console.log('分享失败', e) |
| | | console.log('分享失败', e); |
| | | } |
| | | } |
| | | }); |
| | | }).catch(err => { |
| | | // 处理错误情况,例如使用默认参数 |
| | | console.error('获取分享ID失败', err); |
| | | resolve({ |
| | | title: this.activityName, |
| | | path: '/pages/prize/PrizeDetail/PrizeDetail?id=' + this.activityId, |
| | | imageUrl: this.activityCover |
| | | }); |
| | | }); |
| | | }); |
| | | }, |
| | | beforeDestroy() { |
| | | this.stopAutoScroll() |