// pages/webview/index.js var api = require('../../config/api.js'); var util = require('../../utils/util.js'); const URL = 'https://www.4dkankan.com/mallscene.html?m=' Page({ /** * 页面的初始数据 */ data: { rnd:'', temp:'' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getBrandDetail(options.id) // this.setData({ // url: (URL + options.url) || '', // m: options.url, // img: options.img, // imgServer: util.imgServer // }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, getBrandDetail: function (id) { util.request(api.BrandDetail, { id: id }).then( (res) => { if (res.errno === 0) { this.setData({ url: res.data.brand.sceneUrl + "#" + id, id: id, newPicUrl: res.data.brand.newPicUrl }) wx.onAppHide(() => { this.setData({ url: res.data.brand.sceneUrl + '&rnd='+Math.random() + "#" + id, }) }) } console.log(this.data.url) }); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { // this.getCartList() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let { id, newPicUrl } = this.data return { title: '看店4DKanKan:宅家中,云逛街,轻松买', imageUrl: newPicUrl, url: `/pages/webview/index?id=${id}`, } } })