// pages/gzh/index.js Page({ /** * 页面的初始数据 */ data: { url: '' }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getData(options.wxid) }, /** * 生命周期函数--监听页面初次渲染完成 */ getData(id){ let that=this wx.request({ url: 'https://honmeigui.huiliuwan.cn/gzhurl?wxid=' + id, //仅为示例,并非真实的接口地址 header: { "Content-Type": "application/x-www-form-urlencoded" }, success (res) { if(res.data.link){ that.setData({ url:res.data.link }) }else{ wx.switchTab({ url: 'pages/index' }) } } }) }, onReady() { // var currentWebview = this.$scope // console.log("currentWebview", this); }, receivePostMsg(e) { console.log("接受从+++++++++") }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })