// pages/mobileInfo/index.js const app = getApp(); Page({ /** * 页面的初始数据 */ data: { userId:'', record:{}, topTips:false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options); this.setData({ userId: options.id }); }, makePhoneCall(e){ wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.tel, }); }, getUserInfoBtn(){ app.getUserInfoBtn(this); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { if(app.globalData.hasAva){ this.setData({ topTips:false }) }else{ this.setData({ topTips:true }) } this.getDetailById(); }, getDetailById: function () { var that = this; wx.showLoading({ title: '加载中...', }) wx.request({ url: app.globalData.ip + '/corp/user/detail/' + that.data.userId, // data: { // id: that.data.userId // }, header: app.globalData.header, method: "GET", success: function (res) { console.log(res.data); if (res.data.status == 200) { that.setData({ record: res.data.data.record, }); } else { app.showTips(that, res.data.msg); } that.setData({ dataLoading:true }); wx.hideLoading() }, fail: function (res) { console.log(res); that.setData({ dataLoading:true }); wx.hideLoading() } }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })