const util = require("../../../utils/util") const app = getApp() Page({ data: { id:0, info:{} }, onLoad: function (options) { let id = +options.id||2; this.setData({id}); }, onShow: function(){ app.checkLogin( this.loadData ) }, loadData(){ let id = this.data.id app.formPost( "User.getVisitInfo", {id}).then( res=>{ if( res.code == 200 ){ this.setData({info: res.data}) } }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { let {id, username} = this.data.info; return { title: `【${username}】莅临信息`, path: `/pages/detail/visit/index?id=${id}` } } })