| | |
| | | <button class="chance-item" open-type="share"> |
| | | <view class="chance-icon">👥</view> |
| | | <text class="chance-title">分享好友</text> |
| | | <text class="chance-subtitle">+1次机会</text> |
| | | </button> |
| | | <!-- <view class="chance-item" @tap="shareToTimeline"> |
| | | <view class="chance-icon">🌐</view> |
| | |
| | | <view class="chance-item" @tap="watchVideo"> |
| | | <view class="chance-icon">🎬</view> |
| | | <text class="chance-title">浏览视频</text> |
| | | <text class="chance-subtitle">+1次机会</text> |
| | | </view> |
| | | <view class="chance-item" @tap="browseProduct"> |
| | | <view class="chance-icon">🛍️</view> |
| | | <text class="chance-title">浏览商品</text> |
| | | <text class="chance-subtitle">+1次机会</text> |
| | | </view> |
| | | <view class="chance-item " @tap="goShopping"> |
| | | <view class="chance-icon">🛒</view> |
| | | <text class="chance-title">去购物</text> |
| | | <text class="chance-subtitle">享受购物乐趣</text> |
| | | </view> |
| | | </view> |
| | | |
| | |
| | | </template> |
| | | <script> |
| | | import bgConfig from '@/pages/prize/PrizeDetail/prize-bgConfig.js' |
| | | import { getSessionId, userAction } from "@/api/userAction.js"; |
| | | import { getSessionId, userAction ,userShare } from "@/api/userAction.js"; |
| | | |
| | | import { |
| | | prizeInfo, |
| | | prizeNum, |
| | | prize, |
| | | grantRecord |
| | | grantRecord, |
| | | addPrizeNum |
| | | } from '@/api/prize.js' |
| | | export default { |
| | | data() { |
| | |
| | | pageParams:"{}", |
| | | pageStatus:"JOIN", |
| | | pageType:"DETAIL" |
| | | } |
| | | }, |
| | | shareParam:{ |
| | | pageCode:"PRIZE_DETAIL", |
| | | shareOption:"{}", |
| | | pageType:"DETAIL" |
| | | }, |
| | | shareId:'', |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | 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) |
| | |
| | | onShow() { |
| | | getSessionId().then(res=>{ |
| | | this.pageSessionNo = res.data.data |
| | | this.actionParam.sessionId = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = this.actionParam; |
| | | let param = Object.assign({}, this.actionParam); |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | | }) |
| | | }) |
| | | const shareId = uni.getStorageSync("shareId"); |
| | | if(shareId){ |
| | | let param = { |
| | | addType:"SHARE_USER_REGISTRY", |
| | | extend:"", |
| | | } |
| | | let extend = {shareId:shareId} |
| | | param.extend = JSON.stringify(extend) |
| | | addPrizeNum(param); |
| | | |
| | | let param2 = { |
| | | addType:"USER_STAY_TIME", |
| | | extend:"", |
| | | } |
| | | addPrizeNum(param2); |
| | | } |
| | | }, |
| | | 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() |
| | |
| | | // 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() |