|  |  |  | 
|---|
|  |  |  | getZhongTaiVideoPage, | 
|---|
|  |  |  | getZhongTaiProductNewsPage | 
|---|
|  |  |  | } from '../../api/index' | 
|---|
|  |  |  | import { eventBus } from '../../utils/eventBus' | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | eventBus | 
|---|
|  |  |  | } from '../../utils/eventBus' | 
|---|
|  |  |  | const app = getApp() | 
|---|
|  |  |  | Page({ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | consultList: [], | 
|---|
|  |  |  | consultImgHeight: 0, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | videoTop: 0, | 
|---|
|  |  |  | windowHeight: 0, | 
|---|
|  |  |  | videoPlay: true, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | productVideo: {}, | 
|---|
|  |  |  | bannerSwiperOption: { | 
|---|
|  |  |  | indicatorDots: true, | 
|---|
|  |  |  | 
|---|
|  |  |  | console.log('首页的onLoadLogin',options,`{"token":"${app.globalData.token}"}`); | 
|---|
|  |  |  | this.initData() | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onReady() { | 
|---|
|  |  |  | const windowInfo = wx.getWindowInfo() | 
|---|
|  |  |  | setTimeout(() => { | 
|---|
|  |  |  | const query = wx.createSelectorQuery() | 
|---|
|  |  |  | query.select('.product_video').boundingClientRect(function (rect) { | 
|---|
|  |  |  | rect.top // 节点的上边界坐标 | 
|---|
|  |  |  | rect.bottom // 节点的下边界坐标 | 
|---|
|  |  |  | }).exec(res => { | 
|---|
|  |  |  | console.log('res', res); | 
|---|
|  |  |  | console.log(windowInfo.windowHeight) | 
|---|
|  |  |  | this.setData({ videoTop: res[0].top,windowHeight: windowInfo.windowHeight}) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, 2000) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onShow() { | 
|---|
|  |  |  | const member = wx.getStorageSync('member') | 
|---|
|  |  |  | this.setData({ member }) | 
|---|
|  |  |  | this.setData({ | 
|---|
|  |  |  | member | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | eventBus.once("reloadHome", () => { | 
|---|
|  |  |  | console.log('reloadHome'); | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | videoClick(e) { | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | videourl | 
|---|
|  |  |  | videourl, | 
|---|
|  |  |  | id | 
|---|
|  |  |  | } = e.currentTarget.dataset | 
|---|
|  |  |  | actionDo({ | 
|---|
|  |  |  | actionType: 'view', | 
|---|
|  |  |  | id | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | let videoPlay = this.selectComponent('.videoPlay'); | 
|---|
|  |  |  | if(videoPlay){ | 
|---|
|  |  |  | videoPlay.startPlayVideo(videourl,this ); | 
|---|
|  |  |  | 
|---|
|  |  |  | url: '/pages/webView/index', | 
|---|
|  |  |  | success: function(res) { | 
|---|
|  |  |  | // 通过eventChannel向被打开页面传送数据 | 
|---|
|  |  |  | res.eventChannel.emit('acceptDataFromOpenerPage', { link: item.content, title: item.title }) | 
|---|
|  |  |  | res.eventChannel.emit('acceptDataFromOpenerPage', { | 
|---|
|  |  |  | link: item.content, | 
|---|
|  |  |  | title: item.title | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 生命周期函数--监听页面初次渲染完成 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bindVideoPlay() { | 
|---|
|  |  |  | const { id } = this.data.productVideo[0] | 
|---|
|  |  |  | actionDo({ | 
|---|
|  |  |  | actionType: 'view', | 
|---|
|  |  |  | id | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | onPageScroll(e) { | 
|---|
|  |  |  | const { videoTop, windowHeight, videoPlay } = this.data | 
|---|
|  |  |  | if(e.scrollTop - 100 > videoTop - (windowHeight / 2) && videoPlay ){ | 
|---|
|  |  |  | this.setData({ videoPlay: false }) | 
|---|
|  |  |  | let videoplay = wx.createVideoContext('myvideo', this) | 
|---|
|  |  |  | videoplay.play(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | let scrollTop = e.scrollTop / 100 | 
|---|
|  |  |  | if (scrollTop <= 0.1) { | 
|---|
|  |  |  | this.setData({ | 
|---|