| | |
| | | eventBus |
| | | } from '../../utils/eventBus' |
| | | const app = getApp() |
| | | var touchDot = 0; //触摸时的原点 |
| | | Page({ |
| | | |
| | | /** |
| | |
| | | // 顶部nav |
| | | topHeadStyle: 1, |
| | | top: 0, |
| | | open: false, |
| | | desc: true, |
| | | font_color: '#ffffff', |
| | | ZSZXCata: {}, |
| | | |
| | |
| | | // 已经登录,可以走依赖token的逻辑了 |
| | | console.log('首页的onLoadLogin', options, `{"token":"${app.globalData.token}"}`); |
| | | this.initData() |
| | | const member = wx.getStorageSync('member') |
| | | this.setData({ |
| | | member |
| | | }) |
| | | }, |
| | | onReady() { |
| | | const windowInfo = wx.getWindowInfo() |
| | |
| | | rect.top // 节点的上边界坐标 |
| | | rect.bottom // 节点的下边界坐标 |
| | | }).exec(res => { |
| | | console.log('res', res); |
| | | console.log(windowInfo.windowHeight) |
| | | this.setData({ videoTop: res[0].top,windowHeight: windowInfo.windowHeight}) |
| | | }) |
| | |
| | | this.setData({ |
| | | member |
| | | }) |
| | | |
| | | eventBus.once("reloadHome", () => { |
| | | console.log('reloadHome'); |
| | | this.onLoad() |
| | |
| | | }) |
| | | }, |
| | | onLoad(options) { |
| | | console.log(options) |
| | | this.initDictData() |
| | | this.initData() |
| | | }, |
| | |
| | | let that = this |
| | | switch (index) { |
| | | case '0': |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index', |
| | | success: function (res) { |
| | | // 通过eventChannel向被打开页面传送数据 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | link: that.data.testUrl |
| | | }) |
| | | } |
| | | }) |
| | | if (member && member.phone) { |
| | | wx.navigateTo({ |
| | | url: '/pages/webView/index', |
| | | success: function (res) { |
| | | // 通过eventChannel向被打开页面传送数据 |
| | | res.eventChannel.emit('acceptDataFromOpenerPage', { |
| | | link: that.data.testUrl |
| | | }) |
| | | } |
| | | }) |
| | | } else { |
| | | wx.navigateTo({ |
| | | url: '/pages/auth/auth', |
| | | }) |
| | | } |
| | | break; |
| | | |
| | | case '1': |
| | |
| | | url: '/pages/design/design' |
| | | }) |
| | | } else { |
| | | wx.setStorageSync('tempPath', '/pages/design/design') |
| | | wx.navigateTo({ |
| | | url: '/pages/auth/auth', |
| | | }) |
| | |
| | | id |
| | | }) |
| | | }, |
| | | hdBtn() { |
| | | this.setData({ showWhiteHead: true, open: true,font_color: "#000000", sty: '',topHeadStyle: 1, desc: false }) |
| | | }, |
| | | touchStart: function (e) { |
| | | touchDot = e.touches[0].pageY; |
| | | }, |
| | | touchMove: function (e) { |
| | | var touchMove = e.touches[0].pageY; |
| | | if (touchMove - touchDot <= 0 && this.data.top <= 1 && this.data.desc) { |
| | | this.setData({ showWhiteHead: true, open: false, desc: false }) |
| | | setTimeout(() => { |
| | | this.setData({ open: true, sty: '' }) |
| | | }, 1000) |
| | | } |
| | | if (touchMove - touchDot >= 50 && this.data.top <= 1 && !this.data.desc) { |
| | | this.setData({ showWhiteHead: false, open: false, desc: true, sty: 'overflow: hidden;' }) |
| | | } |
| | | }, |
| | | onPageScroll(e) { |
| | | const { videoTop, windowHeight, videoPlay } = this.data |
| | | if(e.scrollTop - 100 > videoTop - (windowHeight / 2) && videoPlay ){ |
| | | 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({ |