// pages/html/banner/index.js const math = require('../../../utils/math') const app = getApp() Page({ /** * 页面的初始数据 */ data: { src: null, height: 1200 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if(!options.src){ wx.navigateBack() return } wx.showLoading({ title: '处理中', mask: true }) this.setData({ StatusBar: app.globalData.StatusBar || 40, CustomBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60), src: options.src }) }, onImageLoad: function({detail}){ if(detail && detail.width){ var radio = math.divide(detail.width, 750) var height = parseInt(math.divide(detail.height, radio)) this.setData({ height }) } wx.hideLoading() }, backPage() { wx.navigateBack() }, onClick: function(){ wx.redirectTo({ url: '/pages/goods/ablility/index' }) } })