| | |
| | | onShow() { |
| | | getSessionId().then(res=>{ |
| | | console.log('res',JSON.stringify(res)) |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = Object.assign({},this.actionParam); |
| | | this.actionParam.sessionId = this.pageSessionNo |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | | if (res.code === 200){ |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = Object.assign({},this.actionParam); |
| | | this.actionParam.sessionId = this.pageSessionNo |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | | this.getONPrizeActivity() |
| | | let showPopup = storage.getPopupShow(); |
| | | console.log(showPopup) |
| | | if (showPopup) { |
| | | console.log("首次打开,显示弹窗"); |
| | | storage.setPopupShow(true); // 标记为已显示 |
| | | } else { |
| | | console.log("已显示过,不弹窗"); |
| | | } |
| | | if(showPopup){ |
| | | this.openActivityPopup() |
| | | } |
| | | if (!this.userId) { |
| | | this.getUserId() |
| | | } |
| | | // const token = storage.getAccessToken(); |
| | | // if (! token) { |
| | | // this.wxSilentLogin(() => { |
| | | // this.loadVideos(); |
| | | // }) |
| | | // } else { |
| | | // this.loadVideos(); |
| | | // } |
| | | if (this.videoList.length < 1) { |
| | | this.loading = false; |
| | | this.videoNoMore = false; |
| | | console.log('触发数据加载') |
| | | this.loadVideos(); |
| | | } |
| | | // 如果视频按下暂停后切换页面再回到页面时,只算暂停时间(因为暂停时间和离开页面时间是重复的,只算一个) |
| | | if (this.startHidenTime !== 0 && this.currentVideoIsPlaying) { |
| | | const duration = Date.now() - this.startHidenTime |
| | | this.totalHidenTime += duration |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }) |
| | | this.getONPrizeActivity() |
| | | let showPopup = storage.getPopupShow(); |
| | | console.log(showPopup) |
| | | if (showPopup) { |
| | | console.log("首次打开,显示弹窗"); |
| | | storage.setPopupShow(true); // 标记为已显示 |
| | | } else { |
| | | console.log("已显示过,不弹窗"); |
| | | } |
| | | if(showPopup){ |
| | | this.openActivityPopup() |
| | | } |
| | | |
| | | |
| | | |
| | | if (!this.userId) { |
| | | this.getUserId() |
| | | } |
| | | // const token = storage.getAccessToken(); |
| | | // if (! token) { |
| | | // this.wxSilentLogin(() => { |
| | | // this.loadVideos(); |
| | | // }) |
| | | // } else { |
| | | // this.loadVideos(); |
| | | // } |
| | | if (this.videoList.length < 1) { |
| | | this.loading = false; |
| | | this.videoNoMore = false; |
| | | console.log('触发数据加载') |
| | | this.loadVideos(); |
| | | } |
| | | // 如果视频按下暂停后切换页面再回到页面时,只算暂停时间(因为暂停时间和离开页面时间是重复的,只算一个) |
| | | if (this.startHidenTime !== 0 && this.currentVideoIsPlaying) { |
| | | const duration = Date.now() - this.startHidenTime |
| | | this.totalHidenTime += duration |
| | | } |
| | | }, |
| | | onUnload() { |
| | | let param = Object.assign({},this.actionParam); |
| | | if (this.sendOnShow)return |
| | | param.pageStatus = "LEAVE" |
| | | userAction(param) |
| | | // if (this.isNotEmpty(param.sessionId)){ |
| | | console.log("离开页面开始记录") |
| | | //TODO 页面刷新 导致onshow未执行,导致sessionId未赋值 |
| | | userAction(param) |
| | | // } |
| | | |
| | | }, |
| | | onHide() { |
| | | this.startHidenTime = Date.now() |
| | | let param = Object.assign({},this.actionParam); |
| | | this.sendOnShow = true; |
| | | param.pageStatus = "LEAVE" |
| | | console.log("执行onHide的userAction") |
| | | userAction(param) |
| | | }, |
| | | onLoad(option) { |
| | |
| | | console.log('缓存shareId成功'); |
| | | } |
| | | }); |
| | | } |
| | | 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); |
| | | } |
| | | console.log('-----------分享出的数据---------->', option) |
| | | //处理扫码出来的视频 |
| | |
| | | }); |
| | | }, |
| | | methods: { |
| | | isNotEmpty(value) { |
| | | if (value === null || value === undefined) { |
| | | return false; |
| | | } |
| | | if (typeof value === 'string') { |
| | | return value.trim() !== ''; |
| | | } |
| | | return true; |
| | | }, |
| | | getONPrizeActivity(){ |
| | | getONPrizeActivity().then(res =>{ |
| | | if(res.statusCode=== 200){ |
| | |
| | | position: relative; |
| | | width: 100%; |
| | | height: 10px; |
| | | background-color: rgba(255, 255, 255, 0.2); |
| | | /* 半透明背景 */ |
| | | background-color: transparent; |
| | | /* 透明背景 */ |
| | | overflow: hidden; |
| | | border-radius: 1.5px; |
| | | cursor: pointer; |
| | | transition: height 0.2s; |
| | | /* 添加padding-top来扩大触摸区域 */ |
| | | padding-top: 20px; |
| | | margin-top: -10px; |
| | | } |
| | | |
| | | .progress-fill { |
| | | |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | top: 10px; |
| | | height: 100%; |
| | | border-radius: 2px; |
| | | background-color: lightgray; |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | /* 添加padding-top来扩大触摸区域 */ |
| | | padding-top: 30px; |
| | | box-sizing: content-box; |
| | | } |
| | | |
| | | .progress-text { |