From f159e97a15a5c29475a936a03c581663e32bb84b Mon Sep 17 00:00:00 2001 From: shaojing <2901156235@qq.com> Date: Tue, 16 Apr 2024 10:37:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index 307d89f..03a741e 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -56,10 +56,10 @@ Page({ 'https://static.ticket.sz-trip.com/uploads/20240228/24010b7a7a88b91c0ea75cf3f073702e.png', 'https://static.ticket.sz-trip.com/uploads/20240228/59e199b98bfb9fbe4fd996503d5f5698.png', ], - // viewHeight:"0px", + viewHeight:"0px", }, onLoad: function (options) { - // this.getHeight() + this.getHeight() //全屏广告 wx.hideTabBar() //这里隐藏了底部导航栏 commonApi._post("adv/getAdv", { @@ -84,7 +84,7 @@ Page({ }, 1000) let length = res.data.length if (res.data.length > 1) { - let num = Math.round(Math.random()*length)-1; + let num = Math.floor(Math.random()*length); console.log('num',num); this.setData({ startList:res.data[num] @@ -146,18 +146,18 @@ Page({ this.getVideoPrize() this.getXpthList() }, - // getHeight() { - // let that = this - // wx.getSystemInfo({ - // success(res) { - // console.log(res) - // that.setData({ - // viewHeight:res.windowHeight+'px' - // }) - // console.log(that.data.viewHeight) - // } - // }) - // }, + getHeight() { + let that = this + wx.getSystemInfo({ + success(res) { + console.log(res) + that.setData({ + viewHeight:res.windowHeight+'px' + }) + console.log(that.data.viewHeight) + } + }) + }, getXpthList:function () { // 元旦新增 新品特惠 commonApi._post("product/get_product_indulgence", {