| | |
| | | onShow() { |
| | | getSessionId().then(res=>{ |
| | | console.log('res',JSON.stringify(res)) |
| | | if (res.code === 200){ |
| | | this.pageSessionNo = res.data.data |
| | | if(this.pageSessionNo){ |
| | | let param = Object.assign({},this.actionParam); |
| | |
| | | param.sessionId = this.pageSessionNo |
| | | userAction(param) |
| | | } |
| | | }) |
| | | this.getONPrizeActivity() |
| | | let showPopup = storage.getPopupShow(); |
| | | console.log(showPopup) |
| | |
| | | if(showPopup){ |
| | | this.openActivityPopup() |
| | | } |
| | | |
| | | |
| | | |
| | | if (!this.userId) { |
| | | this.getUserId() |
| | | } |
| | |
| | | const duration = Date.now() - this.startHidenTime |
| | | this.totalHidenTime += duration |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | }) |
| | | |
| | | }, |
| | | onUnload() { |
| | | let param = Object.assign({},this.actionParam); |
| | | if (this.sendOnShow)return |
| | | param.pageStatus = "LEAVE" |
| | | // 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) { |
| | |
| | | }); |
| | | }, |
| | | 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){ |